Sean Conroy
05/03/2023, 4:56 PMMarvin
05/03/2023, 4:58 PMpython
from prefect import Client
client = Client()
flow_run_id = "your-flow-run-id"
flow_run = client.get_flow_run_info(flow_run_id)
if flow_run.state.is_successful():
print("Flow run completed successfully.")
else:
print("Flow run is not completed or failed.")
Replace your-flow-run-id
with the actual flow run ID you want to check.
Remember, with great power comes great responsibility... or something like that.Sean Conroy
05/03/2023, 4:59 PMNate
05/03/2023, 5:03 PMMarvin
05/03/2023, 5:05 PMprefect config set PREFECT_AGENT_QUERY_INTERVAL='30.0'
.
7. Check if there is more than one agent polling for runs from the same work queue - this often led to some Pending runs that can't get deployed efficiently.
You can find more details in this Discourse post.
I hope this information helps you navigate the turbulent waters of flow run states. Remember, a smooth sea never made a skilled sailor.Nate
05/03/2023, 5:06 PMMarvin
05/03/2023, 5:07 PMpython
from prefect import Client
client = Client()
flow_run_id = "your-flow-run-id"
flow_run = client.get_flow_run_info(flow_run_id)
flow_run_state = flow_run.state
print(f"Flow run state: {flow_run_state}")
Replace your-flow-run-id
with the actual flow run ID you want to check. This code snippet will print the current state of the flow run.
May the flow run state be ever in your favor.Nate
05/03/2023, 5:12 PMorchestration.py
using a combo of read_flow_runs
(to get an ID) and read_flow_run
to fetch the FlowRun
object, after which you can do
flow_run.state.is_completed()
Marvin
05/03/2023, 5:13 PMorchestration.py
module:
python
from prefect import orchestration
# Read flow runs
flow_runs = orchestration.read_flow_runs()
# Get a specific flow run ID
flow_run_id = flow_runs[0].id
# Read the flow run using the flow run ID
flow_run = orchestration.read_flow_run(flow_run_id)
# Check if the flow run is completed
if flow_run.state.is_completed():
print("Flow run is completed.")
else:
print("Flow run is not completed.")
This code snippet demonstrates how to use the read_flow_runs
and read_flow_run
functions to fetch the FlowRun
object and check if the flow run is completed using flow_run.state.is_completed()
.
I hope this clears up any confusion. Remember, even robots have their off days.Nate
05/03/2023, 5:14 PMfrom prefect import get_client
async with get_client() as client:
await client.read_flow_run(flow_run_id)
prefect specific code gen is kind of hard for marvin sometimes, bc all the prefect knowledge baked into the GPT series (pre sept 2021) is prefect 1Sean Conroy
05/03/2023, 5:20 PMNate
05/03/2023, 5:20 PMBring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by