https://prefect.io logo
#prefect-community
Title
# prefect-community
t

Tim Helfensdörfer

05/31/2022, 8:55 AM
Hi, how can I stop a running flow-run either with the web ui or the cli?
a

Anna Geller

05/31/2022, 9:37 AM
Assuming you are asking for Prefect 2.0 (since you asked about it yesterday), you can hit Control + C when running from CLI
GIF:

https://media.giphy.com/media/LG4usXVLfNDRSalw3P/giphy.gif

We don't have the option to kill run from the UI yet, this feature may be added later this year but it's hard to do since it requires cancelling resources on a remote infrastructure via an API call which is not always possible
An alternative way to kill it would be to list the processes, find it and then kill it:
Copy code
ps -ef | grep python
kill -s SIGTERM PID
or
Copy code
ps -ef | grep prefect
kill -s SIGTERM PID
here is Discourse topic for 1.0
t

Tim Helfensdörfer

05/31/2022, 9:40 AM
Yes 2.0. Ctrl+C is not possible since it is running inside a container remotely without any manual input.
The task itself is not running anymore. But it is still marked as "Running" in the interface.
I understand the remote infrastructure part only partially. We are running an agent which is listening on a queue. The queue publishes tasks and the agent executes it. The same way the queue could publish "stop task" commands which the agent can stop. Maybe it's more complicated. But on our server no task is running at the moment but the queue is blocked with a "running" task which does not exist anymore.
a

Anna Geller

05/31/2022, 9:51 AM
still marked as "Running" in the interface.
we have an open issue for it, it's on the roadmap I understand your point but this is indeed a bit more complicated than that since there is no concept of a queue in Prefect, you can think of a work queue more as a filter for the agent to decide which work to pick up, but once the agent did pick up some work and started running it on some remote infra deployed by the flow runner, it's not as simple to kill it since Prefect doesn't have access to your infrastructure and can only remotely initialize some action via an API call
t

Tim Helfensdörfer

05/31/2022, 9:53 AM
Just for proof that we really have no running jobs on our system. So our only option at the moment is to raise the concurrency limit for the queues (which are not queues) every time a job keeps showing as running? Is there a reason for this so we can avoid this in the future?
As a last note on this topic: The agent communicates with the api while running a flow, for example to send logs to the server (orion) or for other status notifications. Does the task timeout eventually?
a

Anna Geller

05/31/2022, 10:00 AM
which are not queues
they are still queues, what I meant is that a mental model of a "filter" makes more sense to understand the inner workings here because a queue can make you think Prefect uses some RabbitMQ, SQS or similar system here, while (to keep Orion lightweight and with a minimal set of dependencies), it uses only backend DB and API for that purpose -- but it works the same way as a queue would
👍 2
I would try to figure out why your job keeps hanging for now. Soon, there will be an option to mark such run as Completed from the UI I hear you loud and clear - the problem you raised is that on your infra side nothing is running, but the UI wrongly shows that it is running, which we plan to address soon by introducing an option to mark such run as Completed
t

Tim Helfensdörfer

05/31/2022, 10:03 AM
Thanks!
4 Views