Can you implement a "manual" task in a middle of a...
# prefect-community
n
Can you implement a "manual" task in a middle of a workflow with prefect? The expected behavior would be something like: the workflow stops to the manual steps. Once the work is done, somebody, from the web interface, mark the task as done, and the workflow continue its job.
👍 1
j
Yup! The building blocks for this have been in place for a long time but I think people are just starting to use it (based on questions) so we’ll be taking a look at the UX (both in code and in the UI) in the near future to improve it 🙂 It’s actually simple - any task can put itself into a
PAUSE
state, and all automatic progression will stop. To continue, put it into a
RESUME
state manually (via GraphQL, code, or the UI). The one caveat is that your task logic needs to check for a special value
prefect.context.get('resume') is True
so that it can tell if it was put into the
RESUME
state and run itself appropriately.
upvote 1
c
Pro-tip: if you use a
manual_only
trigger on a Task, Prefect takes care of context for you
j
Ah thank you @Chris White
👍 1
n
OK. Thanks. Do you have some code sample to share? I'm starting with Prefect, give it a try and still don't have a good understanding of it ;)
c
Hi @Nicolas Michel - check out this issue for a code snippet and some work being done to improve this API: https://github.com/PrefectHQ/prefect/issues/2615
👍 1