Skip to content

Commit

Permalink
fix: fix task order again
Browse files Browse the repository at this point in the history
taskfile ingestion put tasks in order, which was enough to make `run
-list` appear correct, but then when run_task picked the subset for a
given run to put in the sidebar, it put them out-of-order again.

I've now verified that the tasks appear in the correct order in the
sidebar. I ought to write a test for this, but I don't feel like it.

fixes #123
  • Loading branch information
amonks committed Apr 5, 2024
1 parent 566bdcb commit fb9ac7c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
20 changes: 10 additions & 10 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ <h3>Package files</h3>



<h2 id="MultiWriter">type <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L154">MultiWriter</a>
<h2 id="MultiWriter">type <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L167">MultiWriter</a>
<a class="permalink" href="#MultiWriter">&#xb6;</a>


Expand Down Expand Up @@ -450,7 +450,7 @@ <h2 id="MultiWriter">type <a href="https://github.com/amonks/run/blob/main/pkg/r



<h2 id="Run">type <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L108">Run</a>
<h2 id="Run">type <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L121">Run</a>
<a class="permalink" href="#Run">&#xb6;</a>


Expand Down Expand Up @@ -493,7 +493,7 @@ <h3 id="RunTask">func <a href="https://github.com/amonks/run/blob/main/pkg/run/r



<h3 id="Run.IDs">func (*Run) <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L162">IDs</a>
<h3 id="Run.IDs">func (*Run) <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L175">IDs</a>
<a class="permalink" href="#Run.IDs">&#xb6;</a>


Expand All @@ -509,7 +509,7 @@ <h3 id="Run.IDs">func (*Run) <a href="https://github.com/amonks/run/blob/main/pk



<h3 id="Run.Invalidate">func (*Run) <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L182">Invalidate</a>
<h3 id="Run.Invalidate">func (*Run) <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L195">Invalidate</a>
<a class="permalink" href="#Run.Invalidate">&#xb6;</a>


Expand All @@ -523,7 +523,7 @@ <h3 id="Run.Invalidate">func (*Run) <a href="https://github.com/amonks/run/blob/



<h3 id="Run.Start">func (*Run) <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L205">Start</a>
<h3 id="Run.Start">func (*Run) <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L218">Start</a>
<a class="permalink" href="#Run.Start">&#xb6;</a>


Expand All @@ -537,7 +537,7 @@ <h3 id="Run.Start">func (*Run) <a href="https://github.com/amonks/run/blob/main/



<h3 id="Run.TaskStatus">func (*Run) <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L176">TaskStatus</a>
<h3 id="Run.TaskStatus">func (*Run) <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L189">TaskStatus</a>
<a class="permalink" href="#Run.TaskStatus">&#xb6;</a>


Expand All @@ -550,7 +550,7 @@ <h3 id="Run.TaskStatus">func (*Run) <a href="https://github.com/amonks/run/blob/



<h3 id="Run.Tasks">func (*Run) <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L171">Tasks</a>
<h3 id="Run.Tasks">func (*Run) <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L184">Tasks</a>
<a class="permalink" href="#Run.Tasks">&#xb6;</a>


Expand All @@ -563,7 +563,7 @@ <h3 id="Run.Tasks">func (*Run) <a href="https://github.com/amonks/run/blob/main/



<h3 id="Run.Type">func (*Run) <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L199">Type</a>
<h3 id="Run.Type">func (*Run) <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L212">Type</a>
<a class="permalink" href="#Run.Type">&#xb6;</a>


Expand All @@ -582,7 +582,7 @@ <h3 id="Run.Type">func (*Run) <a href="https://github.com/amonks/run/blob/main/p



<h2 id="RunType">type <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L494">RunType</a>
<h2 id="RunType">type <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L507">RunType</a>
<a class="permalink" href="#RunType">&#xb6;</a>


Expand Down Expand Up @@ -791,7 +791,7 @@ <h2 id="TaskMetadata">type <a href="https://github.com/amonks/run/blob/main/pkg/



<h2 id="TaskStatus">type <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L133">TaskStatus</a>
<h2 id="TaskStatus">type <a href="https://github.com/amonks/run/blob/main/pkg/run/run_task.go#L146">TaskStatus</a>
<a class="permalink" href="#TaskStatus">&#xb6;</a>


Expand Down
11 changes: 9 additions & 2 deletions pkg/run/run_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func RunTask(dir string, allTasks Tasks, taskID string) (*Run, error) {
}

var (
ids = []string{}
tasks = map[string]Task{}
byDep = map[string][]string{}
byTrigger = map[string][]string{}
Expand Down Expand Up @@ -52,7 +51,6 @@ func RunTask(dir string, allTasks Tasks, taskID string) (*Run, error) {
return errors.New(strings.Join(lines, "\n"))
}

ids = append(ids, id)
t := allTasks.Get(id)
tasks[id] = t
taskStatus.set(id, TaskStatusNotStarted)
Expand All @@ -77,6 +75,15 @@ func RunTask(dir string, allTasks Tasks, taskID string) (*Run, error) {
return nil, err
}

// Now that we know which tasks we need, put their IDs in the same
// order they appear in allTasks.
ids := []string{}
for _, id := range allTasks.IDs() {
if _, isIncluded := tasks[id]; isIncluded {
ids = append(ids, id)
}
}

runType := RunTypeShort
if tasks[taskID].Metadata().Type == "long" {
runType = RunTypeLong
Expand Down
Binary file modified screenshots/nontty.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/printer.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/tui.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fb9ac7c

Please sign in to comment.