<@ULVA73B9P> If I use set_flow_run_state, what is ...
# ask-marvin
m
@Marvin If I use set_flow_run_state, what is the different in setting force to True or False is regards to orchestration logic?
m
The difference when setting the
force
parameter to
True
or
False
in
set_flow_run_state
influences how orchestration rules are applied: -
force=False
: When
force
is set to
False
, orchestration rules are observed. It means the state transition will follow Prefect's orchestration policies, ensuring that the state transition is valid as per the defined rules. -
force=True
: If
force
is set to
True
, it bypasses the orchestration rules. This option allows the user to manually push a state change, regardless of whether it conforms to the standard orchestration policies or not. Sources: - Prefect Workflow Engine - GitHub Issue on Manual Flow Retries In summary,
force=True
overrides orchestration rules, while
force=False
adheres to them.
m
@Marvin Can you give me an example of the orchestration rules or standard orchestration policies?
m
Orchestration rules in Prefect are designed to manage state transitions in a controlled manner. Here are some examples of such rules: 1. Scheduled Time Constraint: - A flow run will be rejected from entering the
Pending
state until its scheduled time is reached. This ensures that the flow does not start prematurely. 2. Concurrency Limits: - If there are limits on concurrent workflows, the orchestrator might block a flow from entering the
Running
state until those conditions are met. 3. Task Retry Logic: - When a task attempts to enter a
Failed
state, the orchestrator checks how many retries the task has remaining. If retries are available, the transition to
Failed
is rejected and the task is instructed to await retry. These rules are enforced by the orchestrator to ensure smooth and predictable workflow execution. Users can manually override these rules, but doing so (e.g., by setting
force=True
in
set_flow_run_state
) disregards the built-in safeguards and policies. For a deeper dive into orchestration rules of Prefect's Orion engine, you might want to read this article. Source: - Prefect Blog: Second-Generation Workflow Engine