Skip to content

Lage scheduler adding "phantom" tasks to the graph. #592

@Philip-Scott

Description

@Philip-Scott

Describe the bug
Running a command with Lage acts as if the command exists across all packages rather than checking if a package actually has this script or not. This is a problem for pipelines trying to optimize build processes of subtasks as Lage is running more tasks than required.

For example, if we wanted to have a pipeline that just ran tests, we shouldn't need to run the full repo's build steps.

To Reproduce

  • git clone https://github.com/Philip-Scott/lage-tasks-min-repro.git
  • npm install
  • npm run test

Expected Behavior

On that min-repro repo, running npm run test should run the build task of the parent package, then the build task of the child2 package, and finally the test task of the child2 package. Since child1 does not have a test package, it should not be built.

$ npm run test:expected 
> lage-tasks-min-repro@1.0.0 test:expected
> lage test --to child2 --no-cache
Lage running tasks with 15 workers
Summary
Slowest targets
  parent#build - 0.36s
  child2#test - 0.27s  
  child2#build - 0.27s
success: 3, skipped: 0, pending: 0, aborted: 0, failed: 0
Took a total of 0.93s to complete.

Current Behavior

Running npm run test is running build for child1, even though it does not have a test task. I see on the log skipped: 2 which I think is the number of packages that do not have a test task.

$ npm run test 
> lage-tasks-min-repro@1.0.0 test
> lage test --no-cache
Lage running tasks with 15 workers
Summary
Slowest targets
  parent#build - 0.39s
  child2#test - 0.33s
  child2#build - 0.30s
  child1#build - 0.29s  # <- This should not be running. 
success: 4, skipped: 2, pending: 0, aborted: 0, failed: 0
Took a total of 1.05s to complete.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions