# TaskRunner
# TaskRunner
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.
Args:
task (Task)
: the Task to be run / executedstate_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 thenew_state
argument will be the result of the previous handler.flow_result
: the result instance configured for the flow (if any)
methods: |
---|
prefect.engine.task_runner.TaskRunner.cache_result (state, inputs)[source] |
Caches the result of a successful task, if appropriate. Alternatively, if the task is failed, caches the inputs.
|
prefect.engine.task_runner.TaskRunner.call_runner_target_handlers (old_state, new_state)[source] |
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
|
prefect.engine.task_runner.TaskRunner.check_for_retry (state, inputs)[source] |
Checks to see if a FAILED task should be retried.
|
prefect.engine.task_runner.TaskRunner.check_target (state, inputs)[source] |
Checks if a Result exists at the task's target.
|
prefect.engine.task_runner.TaskRunner.check_task_is_cached (state, inputs)[source] |
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
|
prefect.engine.task_runner.TaskRunner.check_task_is_ready (state)[source] |
Checks to make sure the task is ready to run (Pending or Mapped).
|
prefect.engine.task_runner.TaskRunner.check_task_reached_start_time (state)[source] |
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 (
|
prefect.engine.task_runner.TaskRunner.check_task_ready_to_map (state, upstream_states)[source] |
Checks if the parent task is ready to proceed with mapping.
|
prefect.engine.task_runner.TaskRunner.check_task_trigger (state, upstream_states)[source] |
Checks if the task's trigger function passes.
|
prefect.engine.task_runner.TaskRunner.check_upstream_finished (state, upstream_states)[source] |
Checks if the upstream tasks have all finshed.
|
prefect.engine.task_runner.TaskRunner.check_upstream_skipped (state, upstream_states)[source] |
Checks if any of the upstream tasks have skipped.
|
prefect.engine.task_runner.TaskRunner.get_task_inputs (state, upstream_states)[source] |
Given the task's current state and upstream states, generates the inputs for this task. Upstream state result values are used.
|
prefect.engine.task_runner.TaskRunner.get_task_run_state (state, inputs)[source] |
Runs the task and traps any signals or errors it raises. Also checkpoints the result of a successful task, if
|
prefect.engine.task_runner.TaskRunner.initialize_run (state, context)[source] |
Initializes the Task run by initializing state and context appropriately.
|
prefect.engine.task_runner.TaskRunner.load_results (state, upstream_states)[source] |
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
|
prefect.engine.task_runner.TaskRunner.set_task_run_name (task_inputs)[source] |
Sets the name for this task run and adds to
|
prefect.engine.task_runner.TaskRunner.set_task_to_running (state, inputs)[source] |
Sets the task to running
|
This documentation was auto-generated from commit ffa9a6c
on February 1, 2023 at 18:44 UTC