https://prefect.io logo
а

Андрій Демиденко

02/23/2022, 4:07 PM
Hi everybody, Does anybody know how to make a one-time artifact for a flow run? Love this feature but it is a little pain to delete them)) I would really appreciate to hear your experience. Thank you in advance
k

Kevin Kho

02/23/2022, 4:10 PM
Hey, you can write it based on a parameter input to your Flow, just get the parameter value using
prefect.context.parameters
inside a Flow
а

Андрій Демиденко

02/23/2022, 6:56 PM
Could you tell this a little more in detail?
k

Kevin Kho

02/23/2022, 7:03 PM
If you have:
Copy code
with Flow(...) as flow:
    persist = Parameter("persist", False)
and then in your task
Copy code
@task
def some_task():
    if prefect.context.parameters["persist"] == True:
        create_artifact()
So now you can do a quick run in the UI and set the parameter
persist
to True and it’s a one time thing. Does that make sense?
а

Андрій Демиденко

02/24/2022, 4:23 PM
Yeah. Thank you vey much))
3 Views