# Cloud
# CloudFlowRunner
FlowRunners handle the execution of Flows and determine the State of a Flow before, during and after the Flow is run.
In particular, through the FlowRunner you can specify which tasks should be the first tasks to run, which tasks should be returned after the Flow is finished, and what states each task should be initialized with.
Args:
flow (Flow)
: theFlow
to be runstate_handlers (Iterable[Callable], optional)
: A list of state change handlers that will be called whenever the flow changes state, providing an opportunity to inspect or modify the new state. The handler will be passed the flow runner instance, the old (prior) state, and the new (current) state, with the following signature:
state_handler(
flow_runner: FlowRunner,
old_state: State,
new_state: State) -> State
If multiple functions are passed, then the new_state
argument will be the result of the previous handler.
Note: new FlowRunners are initialized within the call to Flow.run()
and in general, this is the endpoint through which FlowRunners will be interacted with most frequently.
Example:
@task
def say_hello():
print('hello')
with Flow("My Flow") as f:
say_hello()
fr = FlowRunner(flow=f)
flow_state = fr.run()
methods: |
---|
prefect.engine.cloud.flow_runner.CloudFlowRunner.call_runner_target_handlers (old_state, new_state)[source] |
A special state handler that the FlowRunner uses to call its flow's state handlers. This method is called as part of the base Runner's
|
prefect.engine.cloud.flow_runner.CloudFlowRunner.check_for_cancellation ()[source] |
Contextmanager used to wrap a cancellable section of a flow run. |
prefect.engine.cloud.flow_runner.CloudFlowRunner.initialize_run (state, task_states, context, task_contexts, parameters)[source] |
Initializes the Task run by initializing state and context appropriately.
|
prefect.engine.cloud.flow_runner.CloudFlowRunner.run (state=None, task_states=None, return_tasks=None, parameters=None, task_runner_state_handlers=None, executor=None, context=None, task_contexts=None)[source] |
The main endpoint for FlowRunners. Calling this method will perform all computations contained within the Flow and return the final state of the Flow.
|
# CloudTaskRunner
class
prefect.engine.cloud.task_runner.CloudTaskRunner
(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.
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) -> 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.cloud.task_runner.CloudTaskRunner.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.cloud.task_runner.CloudTaskRunner.check_task_is_cached (state, inputs)[source] |
Checks if task is cached in the DB and whether any of the caches are still valid.
|
prefect.engine.cloud.task_runner.CloudTaskRunner.initialize_run (state, context)[source] |
Initializes the Task run by initializing state and context appropriately.
|
prefect.engine.cloud.task_runner.CloudTaskRunner.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.cloud.task_runner.CloudTaskRunner.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.cloud.task_runner.CloudTaskRunner.set_task_run_name (task_inputs)[source] |
Sets the name for this task run by calling the
|
This documentation was auto-generated from commit n/a
on July 1, 2021 at 18:35 UTC