angelos.lib.task.task

Layout for new Facade framework.

class angelos.lib.task.task.TaskFacadeExtension(facade: angelos.lib.facade.base.BaseFacade)

Bases: angelos.lib.facade.base.FacadeExtension, angelos.lib.reactive.NotifierMixin

Task extension that runs as a background job in the facade.

ACTION_COMPLETE = 2
ACTION_CRASH = 3
ACTION_PROGRESS = 4
ACTION_START = 1
INVOKABLE = (False,)
PERIODIC = (False,)
SCHEDULABLE = (False,)
cancel() → None

Cancel a scheduled or periodic pending execution.

invoke() → bool

Invoke the task directly.

Returns True if invocation went through. If invoking isn’t available returns False.

periodic(period: datetime.timedelta, origin: datetime.datetime = datetime.datetime(2021, 1, 26, 12, 16, 25, 98475)) → bool

Execute task periodically until canceled.

Tell the period between executions and from when to count the start. Returns false if periodic execution isn’t available.

property running

Property exposing running state.

schedule(when: datetime.datetime) → bool

Schedule a one-time execution of the task.

Tell when you want the task to be executed. Returns false if task scheduling isn’t available.

class angelos.lib.task.task.TaskWaitress

Bases: angelos.lib.reactive.ObserverMixin

Observer that lets you wait for a facade extension task.

notify(event: angelos.lib.reactive.Event) → None

Receive action-complete event.

wait() → None

Halt execution and wait for event to happen.

wait_for(notifier: angelos.lib.reactive.NotifierMixin) → None

Subscribe to, invoke, and wait for notifier.