Hi I am new to this , I am using python, after ini...
# ask-community
a
Hi I am new to this , I am using python, after initialising a prefect flow , we use flow.run() to start the flow . I would like to know any command which can terminate this flow . Did not find any such thing on prefect doc.
a
Can you try just control + C? 🙂
a
oh no , actually I have deployed the flow code to our server. so was thinking to make some API to terminate the flow if not required
a
if you start the flow with flow.run() then it doesn't run on Server, it runs locally as a local process running on that machine. 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
But if you registered the flow and started it through the backend, then you can cancel it directly from the UI as shown below:
a
yes I have started the flow using a backend API
yet not connected the flow and tasks to prefect cloud UI
a
it's not possible 😄 backend means it's connected to either Prefect Server or Cloud - which one did you use?
a
I had just made an API , with 2 lines
Copy code
flow = prefect_flow()
flow.run()
and in another file I have implemented the method prefect_flow() and tasks
this will enable me to start the flow with API hit and I was expecting some command to run in the API endpoint to terminate the flow as well
a
I recommend you follow this guide - it will bring more clarity what is happening and why you need either Server or Cloud https://docs.prefect.io/orchestration/getting-started/quick-start.html
🙌 1
a
Thank you . I will go through this .
👍 1