darshan darshan
04/15/2023, 9:56 AMNate
04/16/2023, 1:21 AMfrom prefect import flow, task
@task
def say(message: str):
print(message) # note this logged since tasks inherit log_prints=True
@flow(name="hello-prefect", log_prints=True)
def hello_world_flow(message: str):
say(message)
# and run it
if __name__ == "__main__":
hello_world_flow('hi from earth!')
and then if you want to deploy this and then create a flow run of it, you can:
• use the cli
prefect deployment run 'hello-prefect/first-deployment-name'
• use the python api
from prefect.deployments import run_deployment
run_deployment(name='hello-prefect/first-deployment-name')
darshan darshan
04/16/2023, 7:10 AMNate
04/16/2023, 4:21 PMrun_deployment
you just pass a flow_run_name
run_deployment(name='hello-prefect/first-deployment-name', flow_run_name="custom-flowrun-name")