https://prefect.io logo
b

Brett Naul

01/07/2021, 6:52 PM
quick q on Pause behavior: is there any way to know inside a task (e.g. from the prefect context) whether the current run was restarted manually (i.e. by clicking Approve in the UI)? I'm aiming for something like the
manual_only
trigger but that can be achieved at runtime instead. so something like
Copy code
if condition and not prefect.context["manual_approval"]:
    raise signals.PAUSE()
d

Dylan

01/07/2021, 9:22 PM
Hey @Brett Naul,
resume=True
Should be in the top-level of context whenever manually restarting from Paused
So you should be able to
prefect.context.get("resume")
to determine if it was a manual restart
b

Brett Naul

01/07/2021, 9:27 PM
perfect! that's exactly what I was looking for; I think it's missing from https://docs.prefect.io/api/latest/utilities/context.html ... maybe there's all sorts of goodies I'm missing out on 🕵️
d

Dylan

01/07/2021, 9:29 PM
Good call!
@Marvin open “Add ‘Resume’ and other values to context docs”
m

Marvin

01/07/2021, 9:29 PM
3 Views