Compare commits
3 Commits
fd6959fff8
...
d4405a0cde
Author | SHA1 | Date | |
---|---|---|---|
d4405a0cde | |||
274e71fb6a | |||
7bec477266 |
24
acid.go
24
acid.go
@ -183,7 +183,7 @@ var templateTask = template.Must(template.New("tasks").Parse(`
|
||||
{{end}}
|
||||
</head>
|
||||
<body>
|
||||
<h1><a href="/">Tasks</a> » {{.ID}}</h1>
|
||||
<h1><a href="..">Tasks</a> » {{.ID}}</h1>
|
||||
<dl>
|
||||
<dt>Project</dt>
|
||||
<dd><a href="{{.RepoURL}}">{{.FullName}}</a></dd>
|
||||
@ -374,7 +374,8 @@ func rpcRestart(w io.Writer, ids []int64) {
|
||||
// The executor bumps to "running" after inserting into gRunning,
|
||||
// so we should not need to exclude that state here.
|
||||
result, err := gDB.ExecContext(context.Background(),
|
||||
`UPDATE task SET state = ? WHERE id = ?`, taskStateNew, id)
|
||||
`UPDATE task SET state = ?, detail = '' WHERE id = ?`,
|
||||
taskStateNew, id)
|
||||
if err != nil {
|
||||
fmt.Fprintf(w, "%d: %s\n", id, err)
|
||||
} else if n, _ := result.RowsAffected(); n != 1 {
|
||||
@ -787,6 +788,22 @@ func executorRunTask(ctx context.Context, task Task) error {
|
||||
"ACID_RUNNER="+rt.DB.Runner,
|
||||
)
|
||||
|
||||
// Pushing the runner into a new process group that can be killed at once
|
||||
// with all its children isn't bullet-proof, it messes with job control
|
||||
// when acid is run from an interactive shell, and it also seems avoidable
|
||||
// (use "exec" in runner scripts, so that VMs take over the process).
|
||||
// Maybe this is something that could be opt-in.
|
||||
/*
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
cmd.Cancel = func() error {
|
||||
err := syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
|
||||
if err == syscall.ESRCH {
|
||||
return os.ErrProcessDone
|
||||
}
|
||||
return err
|
||||
}
|
||||
*/
|
||||
|
||||
log.Printf("task %d for %s: starting %s\n",
|
||||
rt.DB.ID, rt.DB.FullName(), rt.Runner.Name)
|
||||
|
||||
@ -812,10 +829,9 @@ func executorRunTask(ctx context.Context, task Task) error {
|
||||
case <-ctxRunner.Done():
|
||||
// This doesn't leave the runner almost any time on our shutdown,
|
||||
// but whatever--they're supposed to be ephemeral.
|
||||
// Moreover, we don't even override cmd.CancelFunc.
|
||||
case <-time.After(5 * time.Second):
|
||||
}
|
||||
_ = cmd.Process.Kill()
|
||||
_ = cmd.Cancel()
|
||||
}()
|
||||
|
||||
client, err := executorConnect(ctxRunner, &ssh.ClientConfig{
|
||||
|
Loading…
x
Reference in New Issue
Block a user