prefect.engine.task_runner.TaskRunner(task, state_handlers=None, flow_result=None)[source]
TaskRunners handle the execution of Tasks and determine the State of a Task before, during and after the Task is run.
In particular, through the TaskRunner you can specify the states of any upstream dependencies and what state the Task should be initialized with.
task (Task): the Task to be run / executed
state_handlers (Iterable[Callable], optional): A list of state change handlers that will be called whenever the task changes state, providing an opportunity to inspect or modify the new state. The handler will be passed the task runner instance, the old (prior) state, and the new (current) state, with the following signature:
state_handler(TaskRunner, old_state, new_state) -> Optional[State]; If multiple functions are passed, then the
new_stateargument will be the result of the previous handler.
flow_result: the result instance configured for the flow (if any)
Caches the result of a successful task, if appropriate. Alternatively, if the task is failed, caches the inputs.
A special state handler that the TaskRunner uses to call its task's state handlers. This method is called as part of the base Runner's
Checks to see if a FAILED task should be retried.
Checks if a Result exists at the task's target.
Checks if task is cached and whether the cache is still valid.
prefect.engine.task_runner.TaskRunner.check_task_is_looping(state, inputs=None, upstream_states=None, context=None)[source]
Checks to see if the task is in a
Checks to make sure the task is ready to run (Pending or Mapped).
Checks if a task is in a Scheduled state and, if it is, ensures that the scheduled time has been reached. Note: Scheduled states include Retry states. Scheduled states with no start time (
Checks if the parent task is ready to proceed with mapping.
Checks if the task's trigger function passes.
Checks if the upstream tasks have all finshed.
Checks if any of the upstream tasks have skipped.
Given the task's current state and upstream states, generates the inputs for this task. Upstream state result values are used.
Runs the task and traps any signals or errors it raises. Also checkpoints the result of a successful task, if
Initializes the Task run by initializing state and context appropriately.
Given the task's current state and upstream states, populates all relevant result objects for this task run.
prefect.engine.task_runner.TaskRunner.run(state=None, upstream_states=None, context=None, is_mapped_parent=False)[source]
The main endpoint for TaskRunners. Calling this method will conditionally execute
Sets the name for this task run and adds to
Sets the task to running
This documentation was auto-generated from commit 01705d3
on January 14, 2022 at 15:39 UTC