Is it possible to start a task of a flow run, gett...
# ask-community
g
Is it possible to start a task of a flow run, getting the flow run via get_client().read_flow_runs()?
d
What agent are you assuming to run the flow on?
g
I start the agent running
prefect agent start --pool
it runs on ec2 instance
d
theres a method
create_flow
under client
but thats not it
create_flow_run
g
mmm that is the point, I don’t want to create another flow, I would like to run a task (like an inactive task) on the same flow run
so the flow is A->B->C->D and there is an E task which does nothing. When the associated deployment runs, creating a flow run, let’s call it Y, and it executes A->B->C->D. If this flow run is still executing during the execution of another flow run from a different deployment (let’s call it Z), I would like to run the task E of the flow run Y from the flow run Z
and the flow run Z will run independently from Y
I cannot say in Y to start Z when it finishes
d
y not make E run all the time, and E can check for the state of flow runs in deployment Y using the api and do its thing?
g
it may work, but maybe there is a better way. I’ve just found create_task_run on the client which should be able to attach a task run to a flow run. That would be interesting because, if this works, you do not have to add the task to every flow code, instead Z would attach it
something to test
d
give it a try
g
I will try it when I have some time ahahah 🫣
for now I opted for a semi-automatic solution