Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make shutdown parameter available to exit-handler #5936

Open
szab100 opened this issue May 18, 2021 · 4 comments
Open

Make shutdown parameter available to exit-handler #5936

szab100 opened this issue May 18, 2021 · 4 comments
Labels
area/exit-handler area/shutdown Shutdown Strategy: Stop and Terminate type/feature Feature request

Comments

@szab100
Copy link

szab100 commented May 18, 2021

Summary

We need to be able to detect in the exit-handler whether the workflow has been STOPped or not. Currently, this is not possible, since when the 'exit-handler' is invoked, the Workflow object's status structure is not yet finalized, the workflow's and last steps' states are still Running. The only way to know the final Workflow status is the {{workflow.status}} & {{workflow.failures}} variables that can be added as step parameters. However, there is currently no way to know the shutdown flag's value, that is normally available on a finished workflow at workflow.status.shutdown.

@alexec's initial suggestion was to detect the stop from workflow steps (by detecting SIGTERM signals, which we do), then make an output parameter based on that, which then is available to the exit-handler. However, that doesn't look like an ultimate solution as the step(s) doing this detection might fail to start for various reasons.

My suggestion is to make the shutdown field available to the 'exit-handler', similarly how the final status & list of failures.

Use Cases

The 'exit-handler' is typically used to react to the workflow's status as a final step, usually pushing a final state update of the workflow to various backend system(s). Since we support "STOP" as a user-action, we need to be able to show proper "CANCELLED" status for workflows that have been stopped.


Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

@szab100 szab100 added the type/feature Feature request label May 18, 2021
@alexec
Copy link
Contributor

alexec commented May 18, 2021

I think this might be a duplicate.

@szab100
Copy link
Author

szab100 commented May 18, 2021

I think this might be a duplicate.

@alexec sure, it might be, feel free to close / mark this if that is the case. I could not find other, related (open) issues though: https://github.com/argoproj/argo-workflows/issues?q=is%3Aissue+is%3Aopen+shutdown

@pmareke
Copy link
Contributor

pmareke commented Feb 14, 2023

Hi @alexec @szab100 I have the same problem almost two years after this question, do you know if it's possible to detect in the exit-handler whether the workflow has been stopped or not?

Thanks for your time!

@agilgur5 agilgur5 changed the title Make 'shutdown: true / false' parameter available to exit-handler Make shutdown parameter available to exit-handler Mar 9, 2024
@agilgur5
Copy link
Member

agilgur5 commented Mar 9, 2024

Since we support "STOP" as a user-action, we need to be able to show proper "CANCELLED" status for workflows that have been stopped.

Potentially superseded by #11849

@agilgur5 agilgur5 added the area/shutdown Shutdown Strategy: Stop and Terminate label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/exit-handler area/shutdown Shutdown Strategy: Stop and Terminate type/feature Feature request
Projects
None yet
Development

No branches or pull requests

4 participants