https://prefect.io logo
Title
m

Marwan Sarieddine

06/24/2020, 4:59 PM
Hi folks, I am trying to programmatically “timeout a flow run” by marking it as failed using
prefect.client.client.Client
- looking at the docs I see:
set_flow_run_state(
        self, flow_run_id: str, version: int, state: "prefect.engine.state.State"
    )
where I can pass the
flow_run_id
and
state
, but I am trying to understand the intuition behind setting
version
Would I have to find the version of the task the flow is currently on and increment it ?
I suppose as a follow up - is
version
referencing the task version or the flow version ? [if it is the flow version, why is that needed given I am passing the
flow_run_id
) if it is the task version - why do I have to manually set it instead of prefect incrementing it for me ?
c

Chris White

06/24/2020, 5:05 PM
Hi Marwan - that
version
is there for our “version locking” feature (which is currently only available on paid versions of Prefect Cloud), that ensures no tasks or flows are ever run twice. Basically it forces any client that ever attempts to update state to prove it is doing so with the latest state information (by providing the correct version number, otherwise an error is produced). If you aren’t on a paid Cloud plan, then you can provide any integer there with no effect.
m

Marwan Sarieddine

06/24/2020, 5:08 PM
@Chris White - gotcha, thanks for the prompt response !
c

Chris White

06/24/2020, 5:08 PM
👍 anytime!
@Marvin archive “What is the version keyword used for in the set run state functions?”