Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelvigee committed Apr 20, 2024
1 parent 2fd0d8f commit ba629a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
5 changes: 0 additions & 5 deletions worker2/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"github.com/hephbuild/heph/utils/ads"
"github.com/hephbuild/heph/utils/sets"
"github.com/hephbuild/heph/utils/xtypes"
"strings"
"sync"
)
Expand Down Expand Up @@ -55,10 +54,6 @@ func (d *Node[T]) AddDependency(deps ...*Node[T]) {
}

func (d *Node[T]) addDependency(dep *Node[T]) {
if xtypes.IsNil(dep) {
return
}

if !d.dependencies.Has(dep) {
if dep.HasTransitiveDependency(d) {
panic("cycle")
Expand Down
4 changes: 4 additions & 0 deletions worker2/dep.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package worker2

import (
"context"
"github.com/hephbuild/heph/utils/xtypes"
"sync"
"time"
)
Expand Down Expand Up @@ -59,6 +60,9 @@ func (a *baseDep) GetNode() *Node[Dep] {

func (a *baseDep) AddDep(deps ...Dep) {
for _, dep := range deps {
if xtypes.IsNil(dep) {
continue
}
if named, ok := dep.(Named); ok {
a.named[named.Name] = dep
dep = named.Dep
Expand Down
7 changes: 4 additions & 3 deletions worker2/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ func (e *Engine) waitForDeps(exec *Execution) error {
exec.c.L.Lock()
defer exec.c.L.Unlock()

var errs []error
for {
depObj := exec.Dep.GetNode()

allDepsSucceeded := true
allDepsDone := true
var errs []error
errs = errs[:0]
for _, dep := range depObj.Dependencies() {
depExec := e.scheduleOne(dep)

Expand Down Expand Up @@ -183,7 +184,7 @@ func (e *Engine) waitForDepsAndSchedule(exec *Execution) {
if exec.scheduler == nil {
if _, ok := exec.Dep.(*Group); ok {
// TODO: change to properly use ResourceScheduler
exec.scheduler = groupSchedulers
exec.scheduler = groupScheduler
} else {
exec.scheduler = e.defaultScheduler
}
Expand All @@ -193,7 +194,7 @@ func (e *Engine) waitForDepsAndSchedule(exec *Execution) {
e.queue(exec)
}

var groupSchedulers = NewLimitScheduler(runtime.NumCPU())
var groupScheduler = NewLimitScheduler(runtime.NumCPU())

func (e *Engine) queue(exec *Execution) {
e.notifyQueued(exec)
Expand Down

0 comments on commit ba629a3

Please sign in to comment.