sfini.worker module¶
Activity task polling and execution.
You can provide you’re own workers: the interface to the activities is public. This module’s worker implementation uses threading, and is designed to be resource-managed outside of Python.
-
class
sfini.worker.
TaskExecution
(activity, task_token: str, task_input: Union[None, bool, str, int, float, List[JSONable], Dict[str, JSONable]], *, session: sfini._util.AWSSession = None)[source]¶ Bases:
object
Execute a task, providing heartbeats and catching failures.
Parameters: - activity (sfini.activity.CallableActivity) – activity to execute task of
- task_token – task token for execution identification
- task_input – task input
- session – session to use for AWS communication
-
class
sfini.worker.
Worker
(activity, name: str = None, *, session: sfini._util.AWSSession = None)[source]¶ Bases:
object
Worker to poll for activity task executions.
Parameters: - activity (sfini.activity.CallableActivity) – activity to poll and run executions of
- name – name of worker, used for identification, default: a combination of UUID and host’s FQDN
- session – session to use for AWS communication