microsoft / lage

Task runner in JS monorepos
https://microsoft.github.io/lage
MIT License
725 stars 70 forks source link

Pending tasks not included in `Incomplete` count #212

Open AlekhyaYalla opened 2 years ago

AlekhyaYalla commented 2 years ago

Example scenario for the issue: Consider a yarn monorepo having with packages and 3 of them are a,b,c where pkg-a build task depends on pkg-b, pkg-c. And every test task depends on its build. The Lage config for this is

module.exports = {
  pipeline: {
    build: ["^build"],
    test: ["build"],
  },
};

When I run the command yarn lage build test, the tasks listed in topological order would be like pkg-b build pkg-c build pkg-a build pkg-a test

Different cases of success and failure: Case 1: yarn build test --to pkg-a If everything is successful, the summary would be

pkg-b build done
pkg-c build done
pkg-a build done
pkg-a test done
[Tasks Count] success: 4, skipped: 0, incomplete: 0.

Case 2: yarn build test --to pkg-a If pkg-a build is failing, the summary is

pkg-b build done
pkg-c build done
pkg-a build failed
[Tasks Count] success: 2, skipped: 0, incomplete: 1

Case 3: yarn build test --to pkg-a If pkg-c build is failing, the summary is

pkg-b build done
pkg-c build failed
[Tasks Count] success: 1, skipped: 0, incomplete: 1

In the above cases, the total no of tasks is 4. In case 2,3, the incomplete field is counting only the failed tasks but not the "incomplete" ones. In case 2,
pkg-a build failed pkg-a test incomplete

In case 3,
pkg-c build failed pkg-a build incomplete pkg-a test incomplete

Issue: "Incomplete" field has to consider the count of both failures and pending tasks in the graph, to summarize the count of tasks that were yet to run and the tasks that were failed till that point, isn't it.? But it is counting only the failed tasks. All the pending tasks count are unknown to the user until that task node is reached in the tree. Because of this , user can't always rely on the "incomplete" field to know how much of the build graph is yet to run Can we do something like,

Then in case 2,3 , the summary would be like

case 2:
[Tasks Count] success: 2, skipped: 0, incomplete: 2
case 3:
[Tasks Count] success: 1, skipped: 0, incomplete: 3

@kenotron Would love to hear your thoughts on this and understand better.

kenotron commented 2 years ago

I THINK incomplete are tasks that got triggered and then has to be cancelled. If you're looking for a "not even started" count, then it's easy to do some math to display it.

AlekhyaYalla commented 2 years ago

Hi @kenotron, thanks for replying. Apologies for the delayed response. I'm looking for the "not even started" count as well, as they all should sum up the total tasks (started + completed + failed + remaining)

Do I have anyway to get that count displayed?