Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark workunits blocked, and skip rendering completed workunits (cherrypick of #12369) #12376

Merged
merged 1 commit into from
Jul 20, 2021

Conversation

stuhood
Copy link
Member

@stuhood stuhood commented Jul 19, 2021

Our "graph" of execution is a DAG, while the workunits (used to visualize and record traces) form a tree. Because they form a tree, workunits do not always report that they are blocked on work that they didn't start, but which some other node started (common when lots of @rules are waiting on another single @rule which only one of them started).

To fix this, we make the blocked property of a workunit an atomic mutable, and skip rendering the parents of blocked leaves. We use the blocked flag both for Tasks (which wait directly for memoized Nodes, and so frequently block in this way), and in BoundedCommandRunner, which temporarily blocks the workunit while we're acquiring the semaphore. Additionally, we skip rendering or walking through Completed workunits, which can happen in the case of speculation if a parent workunit completes before a child.

In order to toggle the blocked property on workunits, we expose the current RunningWorkunit in two new places: the CommandRunner and WrappedNode. In both cases, this is to allow the generic code to consume the workunit created by their callers and mark it blocked (for Task and BoundedCommandRunner).

Fixes #12349.

[ci skip-build-wheels]

…build#12369)

Our "graph" of execution is a DAG, while the workunits (used to visualize and record traces) form a tree. Because they form a tree, workunits do not always report that they are blocked on work that they didn't start, but which some other node started (common when lots of @rules are waiting on another single @rule which only one of them started).

To fix this, we make the `blocked` property of a workunit an atomic mutable, and skip rendering the parents of blocked leaves. We use the `blocked` flag both for `Tasks` (which wait directly for memoized Nodes, and so frequently block in this way), and in `BoundedCommandRunner`, which temporarily blocks the workunit while we're acquiring the semaphore. Additionally, we skip rendering or walking through `Completed` workunits, which can happen in the case of speculation if a parent workunit completes before a child.

In order to toggle the `blocked` property on workunits, we expose the current `RunningWorkunit` in two new places: the `CommandRunner` and `WrappedNode`. In both cases, this is to allow the generic code to consume the workunit created by their callers and mark it blocked (for `Task` and `BoundedCommandRunner`).

Fixes pantsbuild#12349.

[ci skip-build-wheels]
@stuhood stuhood merged commit eadca88 into pantsbuild:2.6.x Jul 20, 2021
@stuhood stuhood deleted the stuhood/pick-12369-for-2.6.x branch July 20, 2021 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants