-
Notifications
You must be signed in to change notification settings - Fork 51
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
Unify RunningAction and AwaitedAction #782
Conversation
83019ef
to
466fee6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 LGTMs obtained
nativelink-scheduler/src/simple_scheduler.rs
line 477 at r2 (raw file):
); Arc::make_mut(&mut awaited_action.current_state).stage = ActionStage::Executing; awaited_action.worker_id = Some(worker_id);
Is it possible for this to be previously set? If so what happens if it is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 LGTMs obtained
nativelink-scheduler/src/simple_scheduler.rs
line 477 at r2 (raw file):
Previously, adam-singer (Adam Singer) wrote…
Is it possible for this to be previously set? If so what happens if it is?
It might be possible for it to be previously set, but it shouldn't be an issue. If an action info in queued_actions has an assigned worker_id, that would mean it was previously running, but got dropped and added back to the queued actions list. If this occurs, then we need to assign it a new worker anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 LGTMs obtained
nativelink-scheduler/src/simple_scheduler.rs
line 477 at r2 (raw file):
Previously, zbirenbaum (Zach Birenbaum) wrote…
It might be possible for it to be previously set, but it shouldn't be an issue. If an action info in queued_actions has an assigned worker_id, that would mean it was previously running, but got dropped and added back to the queued actions list. If this occurs, then we need to assign it a new worker anyway.
It looks like there's a requested change for removing the borrow from &mut awaited_action.current_state
but doing so causes a compiler error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed all commit messages.
Reviewable status: 0 of 1 LGTMs obtained
nativelink-scheduler/src/simple_scheduler.rs
line 595 at r2 (raw file):
Code::Internal, "Got a result from a worker that should not be running the action, Removing worker. Expected worker {} got worker {worker_id}", running_action.worker_id.unwrap(),
Unwrapping a None
here would cause a panic, are we assuming all code paths have properly set this field to an Option?
I've seen this pattern with rust, where Options inner values are reached for but disregarding the None
case.
9d017f9
to
c7ccaf9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 LGTMs obtained, and pending CI: Analyze (javascript-typescript), Analyze (python), Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Local / ubuntu-22.04, Remote / large-ubuntu-22.04, asan / ubuntu-22.04, docker-compose-compiles-nativelink (20.04), docker-compose-compiles-nativelink (22.04), integration-tests (20.04), integration-tests (22.04), macos-13, publish-image, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, windows-2022 / stable, zig-cc ubuntu-20.04, zig-cc ubuntu-22.04
nativelink-scheduler/src/simple_scheduler.rs
line 595 at r2 (raw file):
Previously, adam-singer (Adam Singer) wrote…
Unwrapping a
None
here would cause a panic, are we assuming all code paths have properly set this field to an Option?I've seen this pattern with rust, where Options inner values are reached for but disregarding the
None
case.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: 1 of 1 LGTMs obtained, and pending CI: Analyze (javascript-typescript), Analyze (python), Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Local / ubuntu-22.04, Remote / large-ubuntu-22.04, asan / ubuntu-22.04, docker-compose-compiles-nativelink (20.04), docker-compose-compiles-nativelink (22.04), integration-tests (20.04), integration-tests (22.04), macos-13, publish-image, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, windows-2022 / stable, zig-cc ubuntu-20.04, zig-cc ubuntu-22.04
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 1 LGTMs obtained, and pending CI: Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Remote / large-ubuntu-22.04, asan / ubuntu-22.04, docker-compose-compiles-nativelink (20.04), docker-compose-compiles-nativelink (22.04), integration-tests (20.04), integration-tests (22.04), macos-13, publish-image, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, windows-2022 / stable, zig-cc ubuntu-20.04, zig-cc ubuntu-22.04
c7ccaf9
to
fb37dae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: 1 of 1 LGTMs obtained, and pending CI: Analyze (python), Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Local / ubuntu-22.04, Remote / large-ubuntu-22.04, asan / ubuntu-22.04, docker-compose-compiles-nativelink (20.04), docker-compose-compiles-nativelink (22.04), integration-tests (20.04), integration-tests (22.04), macos-13, publish-image, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, windows-2022 / stable, zig-cc ubuntu-20.04, zig-cc ubuntu-22.04
a2a06c2
to
09defc6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 1 LGTMs obtained
nativelink-scheduler/src/simple_scheduler.rs
line 529 at r4 (raw file):
.update_action_with_internal_error_from_wrong_worker .inc(); match running_action.worker_id {
nit: This ordering is a bit weird, I suggest something more like:
let Some(running_action_worker_id) = running_action.worker_id else {
error!(
"Got a result from a worker that should not be running the action, Removing worker. Expected action to be unassigned got worker {worker_id}"
);
};
nativelink-scheduler/src/simple_scheduler.rs
line 597 at r4 (raw file):
Code::Internal, "Got a result from a worker that should not be running the action, Removing worker. Expected worker {} got worker {worker_id}", running_action_worker_id
nit: inline this variable.
1dbe041
to
4aa4086
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 1 LGTMs obtained, and pending CI: Analyze (javascript-typescript), Analyze (python), Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Local / ubuntu-22.04, Publish image, Publish nativelink-worker-lre-cc, Remote / large-ubuntu-22.04, asan / ubuntu-22.04, docker-compose-compiles-nativelink (20.04), docker-compose-compiles-nativelink (22.04), integration-tests (20.04), integration-tests (22.04), macos-13, pre-commit-checks, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, windows-2022 / stable, zig-cc ubuntu-20.04, zig-cc ubuntu-22.04
nativelink-scheduler/src/simple_scheduler.rs
line 529 at r4 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
nit: This ordering is a bit weird, I suggest something more like:
let Some(running_action_worker_id) = running_action.worker_id else { error!( "Got a result from a worker that should not be running the action, Removing worker. Expected action to be unassigned got worker {worker_id}" ); };
Done.
nativelink-scheduler/src/simple_scheduler.rs
line 597 at r4 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
nit: inline this variable.
Done.
4aa4086
to
efa9bca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 2 of 1 LGTMs obtained
nativelink-scheduler/src/simple_scheduler.rs
line 529 at r4 (raw file):
Previously, zbirenbaum (Zach Birenbaum) wrote…
Done.
nit: Do this the other way and put it above the outer if-statement. It'll make the code much more readable and de-uglify if running_action.worker_id == Some(*worker_id)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 1 LGTMs obtained, and 1 discussions need to be resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r6, all commit messages.
Reviewable status: 2 of 1 LGTMs obtained, and 1 discussions need to be resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 1 LGTMs obtained, and 1 discussions need to be resolved
nativelink-scheduler/src/simple_scheduler.rs
line 529 at r4 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
nit: Do this the other way and put it above the outer if-statement. It'll make the code much more readable and de-uglify
if running_action.worker_id == Some(*worker_id)
By other way do you mean the match statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 1 LGTMs obtained, and 1 discussions need to be resolved
nativelink-scheduler/src/simple_scheduler.rs
line 529 at r4 (raw file):
Previously, zbirenbaum (Zach Birenbaum) wrote…
By other way do you mean the match statement?
No, I just mean, move this if-statement before this one:
if running_action.worker_id == Some(*worker_id) {
Refactor scheduler to use a single struct for state management of all incomplete actions. Removes `RunningAction` entirely and adds an optional `worker_id` field to `AwaitedAction` closes: TraceMachina#781
efa9bca
to
f3b8a3d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 1 LGTMs obtained, and pending CI: Analyze (javascript-typescript), Analyze (python), Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Local / ubuntu-22.04, Publish image, Publish nativelink-worker-lre-cc, Remote / large-ubuntu-22.04, asan / ubuntu-22.04, docker-compose-compiles-nativelink (20.04), docker-compose-compiles-nativelink (22.04), integration-tests (20.04), integration-tests (22.04), macos-13, pre-commit-checks, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, vale, windows-2022 / stable, zig-cc ubuntu-20.04, zig-cc ubuntu-22.04, and 1 discussions need to be resolved
nativelink-scheduler/src/simple_scheduler.rs
line 529 at r4 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
No, I just mean, move this if-statement before this one:
if running_action.worker_id == Some(*worker_id) {
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r7, all commit messages.
Reviewable status:complete! 2 of 1 LGTMs obtained
Refactor scheduler to use a single struct for state management of all incomplete actions. Removes
RunningAction
entirely and adds an optionalworker_id
field toAwaitedAction
closes: #781
Type of change
How Has This Been Tested?
All existing tests pass
Checklist
bazel test //...
passes locallygit amend
see some docsThis change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)