prefect.server.orchestration.global_policy
Bookkeeping logic that fires on every state transition.
For clarity, GlobalFlowpolicy
and GlobalTaskPolicy
contain all transition logic
implemented using BaseUniversalTransform
. None of these operations modify state, and regardless of what orchestration Prefect REST API might
enforce on a transition, the global policies contain Prefect’s necessary bookkeeping.
Because these transforms record information about the validated state committed to the
state database, they should be the most deeply nested contexts in orchestration loop.
Functions
COMMON_GLOBAL_TRANSFORMS
Classes
GlobalFlowPolicy
Global transforms that run against flow-run-state transitions in priority order.
These transforms are intended to run immediately before and after a state transition
is validated.
Methods:
priority
GlobalTaskPolicy
Global transforms that run against task-run-state transitions in priority order.
These transforms are intended to run immediately before and after a state transition
is validated.
Methods:
priority
SetRunStateType
Updates the state type of a run on a state transition.
Methods:
before_transition
SetRunStateName
Updates the state name of a run on a state transition.
Methods:
before_transition
SetStartTime
Records the time a run enters a running state for the first time.
Methods:
before_transition
SetRunStateTimestamp
Records the time a run changes states.
Methods:
before_transition
SetEndTime
Records the time a run enters a terminal state.
With normal client usage, a run will not transition out of a terminal state.
However, it’s possible to force these transitions manually via the API. While
leaving a terminal state, the end time will be unset.
Methods:
before_transition
IncrementRunTime
Records the amount of time a run spends in the running state.
Methods:
before_transition
IncrementFlowRunCount
Records the number of times a run enters a running state. For use with retries.
Methods:
before_transition
RemoveResumingIndicator
Removes the indicator on a flow run that marks it as resuming.
Methods:
before_transition
IncrementTaskRunCount
Records the number of times a run enters a running state. For use with retries.
Methods:
before_transition
SetExpectedStartTime
Estimates the time a state is expected to start running if not set.
For scheduled states, this estimate is simply the scheduled time. For other states,
this is set to the time the proposed state was created by Prefect.
Methods:
before_transition
SetNextScheduledStartTime
Records the scheduled time on a run.
When a run enters a scheduled state, run.next_scheduled_start_time
is set to
the state’s scheduled time. When leaving a scheduled state,
run.next_scheduled_start_time
is unset.
Methods: