Skip to content

Commit

Permalink
feat: determine runType by root task
Browse files Browse the repository at this point in the history
Previously, the appearance of any "long" task in a run would make the
whole run "long" (and therefore not exit upon completion of the root
task). That meant you couldn't have, eg, a CI test depend on a
long-running mock server.

Now, we determine the runType based on the root task only.
  • Loading branch information
amonks committed Jan 18, 2024
1 parent f225d79 commit 72e6ef8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
10 changes: 5 additions & 5 deletions pkg/run/run_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func RunTask(dir string, allTasks Tasks, taskID string) (*Run, error) {
return nil, err
}

runType := RunTypeShort
tasks := map[string]Task{}
byDep := map[string][]string{}
byTrigger := map[string][]string{}
Expand All @@ -45,10 +44,6 @@ func RunTask(dir string, allTasks Tasks, taskID string) (*Run, error) {
return errors.New(strings.Join(lines, "\n"))
}

if t.Metadata().Type == "long" {
runType = RunTypeLong
}

tasks[id] = t
taskStatus.set(id, TaskStatusNotStarted)

Expand All @@ -72,6 +67,11 @@ func RunTask(dir string, allTasks Tasks, taskID string) (*Run, error) {
return nil, err
}

runType := RunTypeShort
if tasks[taskID].Metadata().Type == "long" {
runType = RunTypeLong
}

run := Run{
mu: newMutex("run"),

Expand Down
11 changes: 3 additions & 8 deletions pkg/run/testdata/snapshots/long-dependency/out.log
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
long
ok

prereq starting
...
Expand All @@ -8,11 +8,6 @@ long
hello
exit ok

prereq ...
...
...
...
canceled; stopping
run done

run run canceled
done
prereq canceled; stopping

0 comments on commit 72e6ef8

Please sign in to comment.