b

    Brett Naul

    1 year ago
    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
    if condition and not prefect.context["manual_approval"]:
        raise signals.PAUSE()
    Dylan

    Dylan

    1 year ago
    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

    1 year ago
    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 🕵
    Dylan

    Dylan

    1 year ago
    Good call!
    @Marvin open “Add ‘Resume’ and other values to context docs”