prefect.server.orchestration.policies
Policies are collections of orchestration rules and transforms.
Prefect implements (most) orchestration with logic that governs a Prefect flow or task changing state. Policies organize of orchestration logic both to provide an ordering mechanism as well as provide observability into the orchestration process.
While Prefect's orchestration rules can gracefully run independently of one another, ordering can still have an impact on the observed behavior of the system. For example, it makes no sense to secure a concurrency slot for a run if a cached state exists. Furthermore, policies, provide a mechanism to configure and observe exactly what logic will fire against a transition.
BaseOrchestrationPolicy
Bases: ABC
An abstract base class used to organize orchestration rules in priority order.
Different collections of orchestration rules might be used to govern various kinds of transitions. For example, flow-run states and task-run states might require different orchestration logic.
Source code in src/prefect/server/orchestration/policies.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
compile_transition_rules(from_state=None, to_state=None)
classmethod
Returns rules in policy that are valid for the specified state transition.
Source code in src/prefect/server/orchestration/policies.py
36 37 38 39 40 41 42 43 44 45 46 |
|
priority()
abstractmethod
staticmethod
A list of orchestration rules in priority order.
Source code in src/prefect/server/orchestration/policies.py
27 28 29 30 31 32 33 34 |
|