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

Fix signalOnStop bug #329

Merged
merged 2 commits into from
Sep 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (a *Agent) signal(sig os.Signal, allowOverride bool) {
log.Printf("Sending %s signal to running child processes.", sig)
done := make(chan bool)
go func() {
a.scheduler.Signal(a.graph, sig, done, false)
a.scheduler.Signal(a.graph, sig, done, allowOverride)
}()
timeout := time.After(a.DAG.MaxCleanUpTime)
tick := time.After(time.Second * 5)
Expand Down Expand Up @@ -381,6 +381,7 @@ func (a *Agent) handleHTTP(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("OK"))
go func() {
log.Printf("stop request received. shutting down...")
a.signal(syscall.SIGTERM, true)
}()
default:
Expand Down
7 changes: 7 additions & 0 deletions examples/stopOnSignal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
steps:
- name: step1
command: bash
script: |
for s in {1..64}; do trap "echo trap $s" $s; done
sleep 60
signalOnStop: "SIGINT"