What's the supsend/resume/stop/terminate action theory? #10419
Replies: 1 comment
-
The Argo Workflows, suspend, resume, stop, and terminate actions control the execution flow of workflows. Suspend: Pauses the workflow at a specified point and remains in a suspended state until manually resumed. Resume: Resumes the execution of a previously suspended workflow. Stop: Ceases the workflow execution but allows running steps to complete. No new steps are scheduled, however, exit handlers are executed. Terminate: Immediately terminates the workflow without running any exit handlers. To handle these actions within a Java application within a container, signal handling can be implemented to catch termination signals sent to the container. Allowing the Java application to perform necessary cleanup and/or state-saving operations before shutdown. To handle termination signals in a Java application running within a container, the sun.misc.Signal class can be used to set up signal handlers. import sun.misc.Signal;
import sun.misc.SignalHandler;
public class SignalCatcher {
public static void main(String[] args) {
Signal.handle(new Signal("TERM"), new SignalHandler() {
@Override
public void handle(Signal sig) {
System.out.println("Received TERM signal. Performing cleanup...");
// Perform cleanup operations here
System.exit(0);
}
});
// Application logic here
while (true) {
// Simulate work
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}
} Resources: https://argo-workflows.readthedocs.io/en/latest/walk-through/suspending https://argo-workflows.readthedocs.io/en/latest/cli/argo_terminate/ https://argo-workflows.readthedocs.io/en/stable/cli/argo_suspend/ |
Beta Was this translation helpful? Give feedback.
-
Argo workflow provide supsend/resume/stop/terminate action, when i using the JVM container to run, how can i catch the action in my java code? Like some signal?
Beta Was this translation helpful? Give feedback.
All reactions