vcorelib.task
index
/home/vkottler/src/vkottler/workspace/vcorelib/vcorelib/task/__init__.py

A module for implementing tasks in a dependency tree.

 
Package Contents
       
dict (package)
manager
subprocess (package)
time (package)

 
Classes
       
builtins.Exception(builtins.BaseException)
TaskFailed
vcorelib.logging.LoggerMixin(builtins.object)
Task
FailTask
Phony

 
class FailTask(Task)
    FailTask(name: 'str', *args, execute: 'TaskExecute' = None, log: 'Logger' = None, timer: 'Timer' = None, target: 'Target' = None, **kwargs) -> 'None'
 
A task that always fails.
 
 
Method resolution order:
FailTask
Task
vcorelib.logging.LoggerMixin
builtins.object

Methods defined here:
async run(self, inbox: 'Inbox', outbox: 'Outbox', *args, **kwargs) -> 'bool'
Task fails by default.

Data and other attributes defined here:
__annotations__ = {}

Methods inherited from Task:
__init__(self, name: 'str', *args, execute: 'TaskExecute' = None, log: 'Logger' = None, timer: 'Timer' = None, target: 'Target' = None, **kwargs) -> 'None'
Initialize this task.
__str__(self) -> 'str'
Convert this task into a string.
create_execute(self, *args, **kwargs) -> 'TaskExecute'
Create a default execute function for this task.
depend_on(self, task: "'Task'", eloop: '_asyncio.AbstractEventLoop' = None, **kwargs) -> 'bool'
Register other tasks' output data to your input box. Return true
if a new dependency was added.
depend_on_all(self, tasks: "_Iterable['Task']", **kwargs) -> 'int'
Register multiple dependencies. Return the number of dependencies
added.
async dispatch(self, caller: "'Task'" = None, init_only: 'bool' = False, substitutions: 'Substitutions' = None, **kwargs) -> 'None'
Dispatch this task and return whether or not it succeeded.
dispatch_init(self, caller: "'Task'" = None, substitutions: 'Substitutions' = None, **kwargs) -> '_Tuple[Substitutions, str]'
Perform some dispatch initialization.
resolve(self, log: 'Logger', compiled: 'str', substitutions: 'Substitutions' = None) -> 'None'
Mark this task resolved.
async resolve_dependencies(self, **substitutions) -> 'None'
A default dependency resolver for tasks. Note that the default
dependency resolver cannot propagate current-task substitutions to
its dependencies as they've already been explicitly registered.
resolved(self, compiled: 'str', substitutions: 'Substitutions' = None) -> 'bool'
Override this in a derived task to implement more complex logic.
async run_enter(self, _inbox: 'Inbox', _outbox: 'Outbox', *_args, **_kwargs) -> 'bool'
A default enter method.
async run_exit(self, _inbox: 'Inbox', _outbox: 'Outbox', *_args, **_kwargs) -> 'bool'
A default exit method.
task_fail(self, compiled: 'str', substitutions: 'Substitutions', caller: "'Task'" = None, indent: 'int' = 4) -> 'TaskFailed'
Build an exception message for when this task fails.

Readonly properties inherited from Task:
stack
Get this task's execution stack.

Data and other attributes inherited from Task:
default_requirements = set()
stages = ['run_enter', 'run', 'run_exit']

Methods inherited from vcorelib.logging.LoggerMixin:
log_time(self, message: str, *args, level: int = 20, reminder: bool = False, **kwargs) -> Iterator[NoneType]
A simple wrapper.

Data descriptors inherited from vcorelib.logging.LoggerMixin:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class Phony(Task)
    Phony(name: 'str', *args, execute: 'TaskExecute' = None, log: 'Logger' = None, timer: 'Timer' = None, target: 'Target' = None, **kwargs) -> 'None'
 
A task stub that doesn't do anything. Useful for top-level targets that
depend on other concrete tasks.
 
 
Method resolution order:
Phony
Task
vcorelib.logging.LoggerMixin
builtins.object

Methods defined here:
async run(self, inbox: 'Inbox', outbox: 'Outbox', *args, **kwargs) -> 'bool'
Override this method to implement the task.

Data and other attributes defined here:
__annotations__ = {}

Methods inherited from Task:
__init__(self, name: 'str', *args, execute: 'TaskExecute' = None, log: 'Logger' = None, timer: 'Timer' = None, target: 'Target' = None, **kwargs) -> 'None'
Initialize this task.
__str__(self) -> 'str'
Convert this task into a string.
create_execute(self, *args, **kwargs) -> 'TaskExecute'
Create a default execute function for this task.
depend_on(self, task: "'Task'", eloop: '_asyncio.AbstractEventLoop' = None, **kwargs) -> 'bool'
Register other tasks' output data to your input box. Return true
if a new dependency was added.
depend_on_all(self, tasks: "_Iterable['Task']", **kwargs) -> 'int'
Register multiple dependencies. Return the number of dependencies
added.
async dispatch(self, caller: "'Task'" = None, init_only: 'bool' = False, substitutions: 'Substitutions' = None, **kwargs) -> 'None'
Dispatch this task and return whether or not it succeeded.
dispatch_init(self, caller: "'Task'" = None, substitutions: 'Substitutions' = None, **kwargs) -> '_Tuple[Substitutions, str]'
Perform some dispatch initialization.
resolve(self, log: 'Logger', compiled: 'str', substitutions: 'Substitutions' = None) -> 'None'
Mark this task resolved.
async resolve_dependencies(self, **substitutions) -> 'None'
A default dependency resolver for tasks. Note that the default
dependency resolver cannot propagate current-task substitutions to
its dependencies as they've already been explicitly registered.
resolved(self, compiled: 'str', substitutions: 'Substitutions' = None) -> 'bool'
Override this in a derived task to implement more complex logic.
async run_enter(self, _inbox: 'Inbox', _outbox: 'Outbox', *_args, **_kwargs) -> 'bool'
A default enter method.
async run_exit(self, _inbox: 'Inbox', _outbox: 'Outbox', *_args, **_kwargs) -> 'bool'
A default exit method.
task_fail(self, compiled: 'str', substitutions: 'Substitutions', caller: "'Task'" = None, indent: 'int' = 4) -> 'TaskFailed'
Build an exception message for when this task fails.

Readonly properties inherited from Task:
stack
Get this task's execution stack.

Data and other attributes inherited from Task:
default_requirements = set()
stages = ['run_enter', 'run', 'run_exit']

Methods inherited from vcorelib.logging.LoggerMixin:
log_time(self, message: str, *args, level: int = 20, reminder: bool = False, **kwargs) -> Iterator[NoneType]
A simple wrapper.

Data descriptors inherited from vcorelib.logging.LoggerMixin:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class Task(vcorelib.logging.LoggerMixin)
    Task(name: 'str', *args, execute: 'TaskExecute' = None, log: 'Logger' = None, timer: 'Timer' = None, target: 'Target' = None, **kwargs) -> 'None'
 
A basic task interface definition.
 
 
Method resolution order:
Task
vcorelib.logging.LoggerMixin
builtins.object

Methods defined here:
__init__(self, name: 'str', *args, execute: 'TaskExecute' = None, log: 'Logger' = None, timer: 'Timer' = None, target: 'Target' = None, **kwargs) -> 'None'
Initialize this task.
__str__(self) -> 'str'
Convert this task into a string.
create_execute(self, *args, **kwargs) -> 'TaskExecute'
Create a default execute function for this task.
depend_on(self, task: "'Task'", eloop: '_asyncio.AbstractEventLoop' = None, **kwargs) -> 'bool'
Register other tasks' output data to your input box. Return true
if a new dependency was added.
depend_on_all(self, tasks: "_Iterable['Task']", **kwargs) -> 'int'
Register multiple dependencies. Return the number of dependencies
added.
async dispatch(self, caller: "'Task'" = None, init_only: 'bool' = False, substitutions: 'Substitutions' = None, **kwargs) -> 'None'
Dispatch this task and return whether or not it succeeded.
dispatch_init(self, caller: "'Task'" = None, substitutions: 'Substitutions' = None, **kwargs) -> '_Tuple[Substitutions, str]'
Perform some dispatch initialization.
resolve(self, log: 'Logger', compiled: 'str', substitutions: 'Substitutions' = None) -> 'None'
Mark this task resolved.
async resolve_dependencies(self, **substitutions) -> 'None'
A default dependency resolver for tasks. Note that the default
dependency resolver cannot propagate current-task substitutions to
its dependencies as they've already been explicitly registered.
resolved(self, compiled: 'str', substitutions: 'Substitutions' = None) -> 'bool'
Override this in a derived task to implement more complex logic.
async run(self, inbox: 'Inbox', outbox: 'Outbox', *args, **kwargs) -> 'bool'
Override this method to implement the task.
async run_enter(self, _inbox: 'Inbox', _outbox: 'Outbox', *_args, **_kwargs) -> 'bool'
A default enter method.
async run_exit(self, _inbox: 'Inbox', _outbox: 'Outbox', *_args, **_kwargs) -> 'bool'
A default exit method.
task_fail(self, compiled: 'str', substitutions: 'Substitutions', caller: "'Task'" = None, indent: 'int' = 4) -> 'TaskFailed'
Build an exception message for when this task fails.

Readonly properties defined here:
stack
Get this task's execution stack.

Data and other attributes defined here:
__annotations__ = {'default_requirements': '_Set[str]'}
default_requirements = set()
stages = ['run_enter', 'run', 'run_exit']

Methods inherited from vcorelib.logging.LoggerMixin:
log_time(self, message: str, *args, level: int = 20, reminder: bool = False, **kwargs) -> Iterator[NoneType]
A simple wrapper.

Data descriptors inherited from vcorelib.logging.LoggerMixin:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class TaskFailed(builtins.Exception)
    A custom exception to indicate that a task failed.
 
 
Method resolution order:
TaskFailed
builtins.Exception
builtins.BaseException
builtins.object

Data descriptors defined here:
__weakref__
list of weak references to the object

Methods inherited from builtins.Exception:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.

Static methods inherited from builtins.Exception:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Methods inherited from builtins.BaseException:
__delattr__(self, name, /)
Implement delattr(self, name).
__getattribute__(self, name, /)
Return getattr(self, name).
__reduce__(...)
Helper for pickle.
__repr__(self, /)
Return repr(self).
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
__setstate__(...)
__str__(self, /)
Return str(self).
add_note(...)
Exception.add_note(note) --
add a note to the exception
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.

Data descriptors inherited from builtins.BaseException:
__cause__
exception cause
__context__
exception context
__dict__
__suppress_context__
__traceback__
args

 
Data
        Inbox = typing.Dict[str, typing.Dict[str, typing.Any]]
Outbox = typing.Dict[str, typing.Any]
Substitutions = typing.Dict[str, typing.Union[str, int]]
TaskExecute = typing.Callable[[typing.Dict[str, typing.Dict[st..., typing.Coroutine[typing.Any, typing.Any, bool]]
TaskGenerator = typing.Callable[..., _asyncio.Task[typing.Any]]