Joe D
11/01/2023, 9:44 PMMarvin
11/01/2023, 9:44 PMbash
prefect flow-run ls
This command will list all flow-runs. If you want to filter only the running ones, you might need to add some additional filtering.
Please note that this command lists all flow-runs, not just the currently running ones. If you want to filter only the running ones, you might need to add some additional filtering or use the Prefect API directly.
For more detailed information, you might want to check the Prefect documentation or their community forum.Joe D
11/01/2023, 9:45 PMMarvin
11/01/2023, 9:46 PMflow_run
query with the state
filter set to "Running". Here is an example of how you might do this:
from prefect import Client
# Instantiate the client
client = Client()
# Query for running flow runs
flow_runs = client.graphql(
"""
query {
flow_run(where: { state: { _eq: "Running" } }) {
id
name
state
}
}
"""
)
# Print the running flow runs
for flow_run in flow_runs.data.flow_run:
print(f"ID: {flow_run.id}, Name: {flow_run.name}, State: {flow_run.state}")
This script will print the ID, name, and state of each running flow run.
Please note that you will need to have the Prefect server running and be authenticated with the Prefect API for this script to work. For more information on how to do this, please refer to the Prefect documentation.Nate
11/01/2023, 9:52 PMread_flow_runs
on the orchestration clientMarvin
11/01/2023, 9:53 PMread_flow_runs
method of the Client
class in the prefect
module. Here is an example:
from prefect import Client
# Instantiate the client
client = Client()
# Get all flow runs
all_flow_runs = client.read_flow_runs()
# Filter for running flow runs
running_flow_runs = [fr for fr in all_flow_runs if fr.state == 'Running']
# Print the running flow runs
for flow_run in running_flow_runs:
print(f"ID: {flow_run.id}, Name: {flow_run.name}, State: {flow_run.state}")
This script will print the ID, name, and state of each running flow run.
Please note that you will need to have the Prefect server running and be authenticated with the Prefect API for this script to work. For more information on how to do this, please refer to the Prefect documentation.Nate
11/01/2023, 9:53 PMJoe D
11/01/2023, 9:58 PMNate
11/01/2023, 9:58 PMNate
11/01/2023, 9:59 PMJoe D
11/01/2023, 10:00 PMinstrument-A-flow-run
on Tuesday, I don't want it to launch on Wednesday if the previous instrument-A-flow-run
is still workingJoe D
11/01/2023, 10:01 PMNate
11/02/2023, 3:52 AMJoe D
11/02/2023, 4:59 PM