Vipul
12/21/2021, 6:45 PMZanie
Vipul
12/21/2021, 7:26 PMVipul
12/21/2021, 7:29 PMZanie
OrionClient
to set the state of the flow or task run to Failed
with a message that one is already running or you can just have it wait.Vipul
12/21/2021, 7:31 PMVipul
12/21/2021, 7:31 PMZanie
Zanie
Zanie
from prefect import flow
from functools import wraps
def lock_flow(fn):
@flow
@wraps(fn)
def wrapper(*args, **kwargs):
# take lock
return fn(*args, **kwargs)
return wrapper
@lock_flow
def foo(x):
return x
assert foo(2).result() == 2
Vipul
12/21/2021, 7:34 PMZanie
Vipul
12/21/2021, 7:34 PMZanie
Vipul
12/21/2021, 7:35 PM