omnipy.compute.task
Task definitions for callable-backed compute jobs.
This module exposes Omnipy's public task-building API. Use TaskTemplate to
define a reusable task from a Python callable, and use Task for the bound
executable job instance created from that template.
| ATTRIBUTE | DESCRIPTION |
|---|---|
TaskTemplate |
Decorator-style task template factory for wrapping a callable as a reusable Omnipy task.
|
| CLASS | DESCRIPTION |
|---|---|
Task |
Execute a single callable-backed Omnipy task. |
TaskBase |
Provide a shared marker base for Omnipy task objects. |
TaskTemplateCore |
Implement the core template behavior for tasks. |
TaskTemplate
module-attribute
TaskTemplate = task_template_as_callable_decorator(to_task_template_init_protocol(TaskTemplateCore))
Decorator-style factory for defining reusable callable-backed tasks.
Use @TaskTemplate() on a Python callable to create a reusable task
template. Calling the resulting template produces executable Task
instances that run as single Omnipy compute steps.
Task
Bases: JobMixin[IsTaskTemplate[_CallP, _RetT], IsTask[_CallP, _RetT], _CallP, _RetT], TaskBase, FuncArgJobBase[IsTaskTemplate[_CallP, _RetT], IsTask[_CallP, _RetT], _CallP, _RetT], Generic[_CallP, _RetT]
flowchart BT
omnipy.compute.task.Task[Task]
omnipy.compute._job.JobMixin[JobMixin]
omnipy.compute.task.TaskBase[TaskBase]
omnipy.compute._func_job.FuncArgJobBase[FuncArgJobBase]
omnipy.compute._func_job.PlainFuncArgJobBase[PlainFuncArgJobBase]
omnipy.compute._job.JobBase[JobBase]
omnipy.hub.log.mixin.LogMixin[LogMixin]
omnipy.util.mixin.DynamicMixinAcceptor[DynamicMixinAcceptor]
omnipy.compute._job.JobMixin --> omnipy.compute.task.Task
omnipy.util.mixin.DynamicMixinAcceptor --> omnipy.compute._job.JobMixin
omnipy.compute.task.TaskBase --> omnipy.compute.task.Task
omnipy.compute._func_job.FuncArgJobBase --> omnipy.compute.task.Task
omnipy.compute._func_job.PlainFuncArgJobBase --> omnipy.compute._func_job.FuncArgJobBase
omnipy.compute._job.JobBase --> omnipy.compute._func_job.PlainFuncArgJobBase
omnipy.hub.log.mixin.LogMixin --> omnipy.compute._job.JobBase
omnipy.util.mixin.DynamicMixinAcceptor --> omnipy.compute._job.JobBase
click omnipy.compute.task.Task href "" "omnipy.compute.task.Task"
click omnipy.compute._job.JobMixin href "" "omnipy.compute._job.JobMixin"
click omnipy.compute.task.TaskBase href "" "omnipy.compute.task.TaskBase"
click omnipy.compute._func_job.FuncArgJobBase href "" "omnipy.compute._func_job.FuncArgJobBase"
click omnipy.compute._func_job.PlainFuncArgJobBase href "" "omnipy.compute._func_job.PlainFuncArgJobBase"
click omnipy.compute._job.JobBase href "" "omnipy.compute._job.JobBase"
click omnipy.hub.log.mixin.LogMixin href "" "omnipy.hub.log.mixin.LogMixin"
click omnipy.util.mixin.DynamicMixinAcceptor href "" "omnipy.util.mixin.DynamicMixinAcceptor"
Execute a single callable-backed Omnipy task.
A Task is the runnable job object produced from a TaskTemplate.
When invoked, it delegates execution of the wrapped callable to the
configured task runner engine.
Use this type when one callable should be scheduled, configured, logged, and optionally persisted as a standalone compute step.
Instances are typically produced by calling a TaskTemplate.
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
accept_mixin |
Register a mixin class for dynamic composition. |
create_job |
Create an applied job instance from the concrete job class. |
log |
Emit a log message, optionally using an explicit event timestamp. |
reset_mixins |
Clear all accepted mixins and restore the original init signature. |
revise |
Return a template reconstructed from this applied job. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
callable_type |
TYPE:
|
config |
Return the job configuration visible to this instance.
TYPE:
|
engine |
Return the engine associated with this job, if any.
TYPE:
|
in_flow_context |
Return whether the job is currently executing inside a flow context.
TYPE:
|
logger |
Return the logger bound to the concrete instance type.
TYPE:
|
time_of_cur_toplevel_flow_run |
Return the start time of the active top-level flow run, if any.
TYPE:
|
Source code in src/omnipy/compute/task.py
config
property
config: IsJobConfig
Return the job configuration visible to this instance.
| RETURNS | DESCRIPTION |
|---|---|
IsJobConfig
|
Active job configuration used for runtime behavior.
TYPE:
|
engine
property
engine: IsEngine | None
Return the engine associated with this job, if any.
| RETURNS | DESCRIPTION |
|---|---|
IsEngine | None
|
IsEngine | None: Engine used for decoration and execution, or |
in_flow_context
property
Return whether the job is currently executing inside a flow context.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
TYPE:
|
logger
property
Return the logger bound to the concrete instance type.
| RETURNS | DESCRIPTION |
|---|---|
Logger
|
Logger used by the object for Omnipy log messages.
TYPE:
|
time_of_cur_toplevel_flow_run
property
Return the start time of the active top-level flow run, if any.
| RETURNS | DESCRIPTION |
|---|---|
datetime | None
|
datetime | None: Timestamp for the current outermost flow run, or |
__init__
accept_mixin
classmethod
Register a mixin class for dynamic composition.
| PARAMETER | DESCRIPTION |
|---|---|
mixin_cls
|
Mixin class whose
TYPE:
|
Source code in src/omnipy/util/mixin.py
create_job
classmethod
Create an applied job instance from the concrete job class.
| PARAMETER | DESCRIPTION |
|---|---|
*args
|
Positional constructor arguments.
TYPE:
|
**kwargs
|
Keyword constructor arguments.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
_JobT
|
New applied job instance.
TYPE:
|
Source code in src/omnipy/compute/_job.py
log
Emit a log message, optionally using an explicit event timestamp.
| PARAMETER | DESCRIPTION |
|---|---|
log_msg
|
Message text to send to the logger.
TYPE:
|
level
|
Standard library logging level.
TYPE:
|
datetime_obj
|
Timestamp to attach to the record instead of wall-clock time.
TYPE:
|
Source code in src/omnipy/hub/log/mixin.py
reset_mixins
classmethod
Clear all accepted mixins and restore the original init signature.
revise
Return a template reconstructed from this applied job.
| RETURNS | DESCRIPTION |
|---|---|
_JobTemplateT
|
Template carrying the current job configuration.
TYPE:
|
Source code in src/omnipy/compute/_job.py
TaskBase
Provide a shared marker base for Omnipy task objects.
TaskBase exists to give concrete task templates and executable task
instances a common nominal base type. It does not add runtime behavior on
its own, but it supports task-specific typing and internal mixin handling.
Source code in src/omnipy/compute/task.py
TaskTemplateCore
Bases: FuncArgJobBase[IsTaskTemplate[_CallP, _RetT], IsTask[_CallP, _RetT], _CallP, _RetT], JobTemplateMixin[IsTaskTemplate[_CallP, _RetT], IsTask[_CallP, _RetT], _CallP, _RetT], TaskBase, Generic[_CallP, _RetT]
flowchart BT
omnipy.compute.task.TaskTemplateCore[TaskTemplateCore]
omnipy.compute._func_job.FuncArgJobBase[FuncArgJobBase]
omnipy.compute._func_job.PlainFuncArgJobBase[PlainFuncArgJobBase]
omnipy.compute._job.JobBase[JobBase]
omnipy.hub.log.mixin.LogMixin[LogMixin]
omnipy.util.mixin.DynamicMixinAcceptor[DynamicMixinAcceptor]
omnipy.compute._job.JobTemplateMixin[JobTemplateMixin]
omnipy.compute.task.TaskBase[TaskBase]
omnipy.compute._func_job.FuncArgJobBase --> omnipy.compute.task.TaskTemplateCore
omnipy.compute._func_job.PlainFuncArgJobBase --> omnipy.compute._func_job.FuncArgJobBase
omnipy.compute._job.JobBase --> omnipy.compute._func_job.PlainFuncArgJobBase
omnipy.hub.log.mixin.LogMixin --> omnipy.compute._job.JobBase
omnipy.util.mixin.DynamicMixinAcceptor --> omnipy.compute._job.JobBase
omnipy.compute._job.JobTemplateMixin --> omnipy.compute.task.TaskTemplateCore
omnipy.compute.task.TaskBase --> omnipy.compute.task.TaskTemplateCore
click omnipy.compute.task.TaskTemplateCore href "" "omnipy.compute.task.TaskTemplateCore"
click omnipy.compute._func_job.FuncArgJobBase href "" "omnipy.compute._func_job.FuncArgJobBase"
click omnipy.compute._func_job.PlainFuncArgJobBase href "" "omnipy.compute._func_job.PlainFuncArgJobBase"
click omnipy.compute._job.JobBase href "" "omnipy.compute._job.JobBase"
click omnipy.hub.log.mixin.LogMixin href "" "omnipy.hub.log.mixin.LogMixin"
click omnipy.util.mixin.DynamicMixinAcceptor href "" "omnipy.util.mixin.DynamicMixinAcceptor"
click omnipy.compute._job.JobTemplateMixin href "" "omnipy.compute._job.JobTemplateMixin"
click omnipy.compute.task.TaskBase href "" "omnipy.compute.task.TaskBase"
Implement the core template behavior for tasks.
A task template wraps a Python callable that performs a single unit of work as a task. Use this when the work can be expressed as a self-contained function call.
Instances are normally produced through the TaskTemplate decorator
factory rather than by direct construction.
- Reference Code reference
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
accept_mixin |
Register a mixin class for dynamic composition. |
apply |
Create an applied job from this template without executing it. |
create_job_template |
Create a job template instance from the concrete template class. |
log |
Emit a log message, optionally using an explicit event timestamp. |
refine |
Forward refinement to the shared template lifecycle implementation. |
reset_mixins |
Clear all accepted mixins and restore the original init signature. |
run |
Apply the template and execute the resulting job immediately. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
callable_type |
TYPE:
|
config |
Return the job configuration visible to this instance.
TYPE:
|
engine |
Return the engine associated with this job, if any.
TYPE:
|
in_flow_context |
Return whether the job is currently executing inside a flow context.
TYPE:
|
logger |
Return the logger bound to the concrete instance type.
TYPE:
|
Source code in src/omnipy/compute/task.py
config
property
config: IsJobConfig
Return the job configuration visible to this instance.
| RETURNS | DESCRIPTION |
|---|---|
IsJobConfig
|
Active job configuration used for runtime behavior.
TYPE:
|
engine
property
engine: IsEngine | None
Return the engine associated with this job, if any.
| RETURNS | DESCRIPTION |
|---|---|
IsEngine | None
|
IsEngine | None: Engine used for decoration and execution, or |
in_flow_context
property
Return whether the job is currently executing inside a flow context.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
TYPE:
|
logger
property
Return the logger bound to the concrete instance type.
| RETURNS | DESCRIPTION |
|---|---|
Logger
|
Logger used by the object for Omnipy log messages.
TYPE:
|
__init__
accept_mixin
classmethod
Register a mixin class for dynamic composition.
| PARAMETER | DESCRIPTION |
|---|---|
mixin_cls
|
Mixin class whose
TYPE:
|
Source code in src/omnipy/util/mixin.py
apply
Create an applied job from this template without executing it.
| RETURNS | DESCRIPTION |
|---|---|
_JobT
|
Applied job instance ready to be called.
TYPE:
|
Source code in src/omnipy/compute/_job.py
create_job_template
classmethod
Create a job template instance from the concrete template class.
| PARAMETER | DESCRIPTION |
|---|---|
*args
|
Positional constructor arguments.
TYPE:
|
**kwargs
|
Keyword constructor arguments.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
_JobTemplateT
|
New job template instance.
TYPE:
|
Source code in src/omnipy/compute/_job.py
log
Emit a log message, optionally using an explicit event timestamp.
| PARAMETER | DESCRIPTION |
|---|---|
log_msg
|
Message text to send to the logger.
TYPE:
|
level
|
Standard library logging level.
TYPE:
|
datetime_obj
|
Timestamp to attach to the record instead of wall-clock time.
TYPE:
|
Source code in src/omnipy/hub/log/mixin.py
refine
Forward refinement to the shared template lifecycle implementation.
See IsFuncArgJobTemplate.refine and
IsChildJobListArgJobTemplate.refine.
Source code in src/omnipy/compute/_job.py
reset_mixins
classmethod
Clear all accepted mixins and restore the original init signature.
run
Apply the template and execute the resulting job immediately.
| PARAMETER | DESCRIPTION |
|---|---|
*args
|
Positional arguments passed to the applied job.
TYPE:
|
**kwargs
|
Keyword arguments passed to the applied job.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
_RetCovT
|
Result returned by the applied job.
TYPE:
|
Source code in src/omnipy/compute/_job.py
task_template_as_callable_decorator
task_template_as_callable_decorator(
decorated_cls: Callable[Concatenate[_CallableT, _InitP], IsTaskTemplate],
) -> Callable[_InitP, Callable[[Callable[_CallP, _RetT]], IsTaskTemplate[_CallP, _RetT]]]
Wrap a template initializer as a callable decorator factory.
| PARAMETER | DESCRIPTION |
|---|---|
decorated_cls
|
Task-template initializer to adapt.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Callable[_InitP, Callable[[Callable[_CallP, _RetT]], IsTaskTemplate[_CallP, _RetT]]]
|
A decorator factory that converts a Python callable into a task template. |
- Reference Code reference
Source code in src/omnipy/compute/task.py
to_task_template_init_protocol
to_task_template_init_protocol(
decorated_cls: Callable[
Concatenate[Callable[_CallP, _RetT], _InitP], TaskTemplateCore[_CallP, _RetT]
],
) -> HasFuncArgJobTemplateInit[IsTaskTemplate[_CallP, _RetT], _CallP, _RetT]
Cast a template initializer to the shared init protocol.
| PARAMETER | DESCRIPTION |
|---|---|
decorated_cls
|
Task-template initializer to cast.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
HasFuncArgJobTemplateInit[IsTaskTemplate[_CallP, _RetT], _CallP, _RetT]
|
The initializer typed as |
- Reference Code reference