Skip to content

Commit

Permalink
More logging to understand how it works
Browse files Browse the repository at this point in the history
  • Loading branch information
mehulkar committed Sep 6, 2022
1 parent 760787a commit 8acc5ef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
5 changes: 3 additions & 2 deletions cli/internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,8 @@ func (g *completeGraph) getPackageTaskVisitor(ctx gocontext.Context, visitor fun
fmt.Printf("\t taskID: %#v\n", taskID)
fmt.Printf("\t task: %#v\n", task)
fmt.Printf("\t Pipeline:\n\t\t%#v\n", g.Pipeline)
fmt.Printf("\t taskDefintion (looked up with taskID):\n\t\t%#v\n", taskDefinition)
fmt.Printf("----------------------------\n")
fmt.Printf("\t taskDefintion (looked up with taskID \"%#v\"):\n\t\t%#v\n", taskID, taskDefinition)
if !ok {
// then check for regular tasks
fallbackTaskDefinition, notcool := g.Pipeline[task]
Expand All @@ -1047,7 +1048,7 @@ func (g *completeGraph) getPackageTaskVisitor(ctx gocontext.Context, visitor fun
return nil
}
// override if we need to...
fmt.Printf("\t fallbackTaskDefinition (looked up with task) %#v\n", fallbackTaskDefinition)
fmt.Printf("\t fallbackTaskDefinition (looked up with task \"%#v\") %#v\n", task, fallbackTaskDefinition)
taskDefinition = fallbackTaskDefinition
}
return visitor(ctx, &nodes.PackageTask{
Expand Down
15 changes: 7 additions & 8 deletions cli/internal/taskhash/taskhash.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ type packageFileHashes map[packageFileHashKey]string
// in the task graph. Must be called before calculating task hashes.
func (th *Tracker) CalculateFileHashes(allTasks []dag.Vertex, workerCount int, repoRoot turbopath.AbsolutePath) error {
fmt.Printf("CalculateFileHashes()\n")

hashTasks := make(util.Set)

for i, v := range allTasks {
Expand All @@ -172,7 +173,6 @@ func (th *Tracker) CalculateFileHashes(allTasks []dag.Vertex, workerCount int, r
}
pkgName, _ := util.GetPackageTaskFromId(taskID)
if pkgName == th.rootNode {
fmt.Printf("\tContinue\n")
continue
}

Expand All @@ -181,19 +181,18 @@ func (th *Tracker) CalculateFileHashes(allTasks []dag.Vertex, workerCount int, r
return fmt.Errorf("missing pipeline entry %v", taskID)
}

taskDefinition.Inputs = append(taskDefinition.Inputs, "./package.json")
// taskDefinition.Inputs = append(taskDefinition.Inputs, "./package.json")

pfs := &packageFileSpec{
pkg: pkgName,
inputs: taskDefinition.Inputs,
}

fmt.Printf("\ttaskDefinition.Inputs: %v\n", taskDefinition.Inputs)
fmt.Printf("\tpfs.inputs: %v\n", pfs.inputs)

hashTasks.Add(pfs)
}

fmt.Printf("\thashTasks\n\t\t %#v\n", hashTasks)

hashes := make(map[packageFileHashKey]string)
hashQueue := make(chan *packageFileSpec, workerCount)
hashErrs := &errgroup.Group{}
Expand All @@ -211,14 +210,14 @@ func (th *Tracker) CalculateFileHashes(allTasks []dag.Vertex, workerCount int, r
}
th.mu.Lock()
pfsKey := packageFileSpec.ToKey()
fmt.Printf("\tadding to hashes\n")
fmt.Printf("\t\t\"%v\": %v\n", pfsKey, hash)
fmt.Printf("\tadding key \"%#v\" with value \"%#v\"\n", pfsKey, hash)
hashes[pfsKey] = hash
th.mu.Unlock()
}
return nil
})
}

for ht := range hashTasks {
hashQueue <- ht.(*packageFileSpec)
}
Expand All @@ -229,7 +228,7 @@ func (th *Tracker) CalculateFileHashes(allTasks []dag.Vertex, workerCount int, r
}
th.packageInputsHashes = hashes

fmt.Printf("\tth.packageInputsHashes: %v\n", th.packageInputsHashes)
fmt.Printf("\t tracker:\n\t\t%#v\n", th)
return nil
}

Expand Down

0 comments on commit 8acc5ef

Please sign in to comment.