Thread
#prefect-server
    Thomas Opsomer

    Thomas Opsomer

    9 months ago
    Hi, we are experiencing 2 strange things: • flows with 'manual validation' are stuck after being approved, the states stay orange in "Resume" • restart of failed flows doesn't work: after click on the restart button, the wheel keeps spinning and the flow never restart Any ideas on how to overcome these issues ?
    Anna Geller

    Anna Geller

    9 months ago
    @Thomas Opsomer regarding Resume: can you share how you defined the manual approval in your flow? Can you try again and send a Screenshot? For both issues: did you specify a Result on your task decorator? Restarts are only possible when results are configured
    Thomas Opsomer

    Thomas Opsomer

    9 months ago
    • resume: basically we have introduced "waiting" tasks in between other tasks to allow us to have "waiting" steps in our flows. The code for these waiting task is:
    @task(
        name="common.wait",
        task_run_name="wait-after-{previous_task_name}",
        trigger=manual_only_after_all_successful,
        state_handlers=[wait_task_slack_handler],
        skip_on_upstream_skip=False,
    )
    def wait_for_human_task(previous_task_name: str = None):
        """ """
        pass
    • result: no there is no Result type specified on the task decorator. But it used to work in the past. How long has it been mandatory to use results to enable restarts ?
    Anna Geller

    Anna Geller

    9 months ago
    is “manual_only_after_all_successful” your custom trigger? we only have manual_only. Could you try using the “manual_only” trigger and see whether this works?
    for Results, it depends whether your tasks return anything. If they don’t, then restart can probably work without results. But it’s definitely recommended to always explicitly configure Results if you want to leverage the restart functionality
    Thomas Opsomer

    Thomas Opsomer

    9 months ago
    the "manual_only_after_all_successful" is just a fix to ensure the flow is failed even if there is a waiting task in it. Because I noticed that my flows with a failed task and a downstream manual task where not in a Failed state. It's a mix between all_successful and manual like this:
    def manual_only_after_all_successful(
        upstream_states: Dict["core.Edge", "state.State"]
    ) -> bool:
        """ """
        if not all(s.is_successful() for s in _get_all_states_as_set(upstream_states)):
            raise signals.TRIGGERFAIL(
                'Trigger was "all_successful" but some of the upstream tasks failed.'
            )
    
        if prefect.context.get("resume"):
            return True
    
        raise signals.PAUSE('Trigger function is "manual_only"')
    Hum ok, some tasks have returns, not that we use it, but more as a coding habit. I'll add results to all my task and see how it goes.
    Anna Geller

    Anna Geller

    9 months ago
    I don’t think that you need this fix as long as you allow the failure to be propagated downstream - the default “all_successful” trigger takes care of that. I would recommend using the default “manual_only” trigger because it was tested to work with the pause for approval pattern - some links on it you can check to be sure: • https://docs.prefect.io/core/idioms/pause-for-approval.html https://medium.com/the-prefect-blog/needs-approval-184f2512a3cf
    Thomas Opsomer

    Thomas Opsomer

    9 months ago
    Thanks for resources, I'll try again with the default manual_only 🙂 When you say "as long as you allow the failure to be propagated downstream", isn't it the default behaviour ? Or should I add something somewhere ?
    Anna Geller

    Anna Geller

    9 months ago
    I thought maybe you set something else there - all_successful is the default
    Thomas Opsomer

    Thomas Opsomer

    9 months ago
    Alright, I'll experiment with your suggestions and get back to you ! Funny thing, while we were discussing, the flows that were stuck in resume state just got resumed and are now running!