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

[Refactor] Move scheduler state behind mutex #1062

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

allada
Copy link
Member

@allada allada commented Jun 28, 2024

In prep to support a distributed/redis scheduler, prepare the state interface to no longer take mutable references.

This is a partial PR and should be landed immediately with follow up PRs that will remove many of the locking in the SimpleScheduler.

towards: #359


This change is Reviewable

Copy link
Member

@adam-singer adam-singer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 12 of 13 files at r1, all commit messages.
Reviewable status: 0 of 1 LGTMs obtained, and pending CI: pre-commit-checks

@allada allada force-pushed the move-scheduler-state-behind-mutex branch from b3b9128 to 5dd9dec Compare June 28, 2024 20:32
Refactoring to include the `awaited_action` watch channel `notify_channel: watch::Sender<Arc<ActionState>>`
to be provided via `MatchingEngineActionStateResult`. This aids the matching engine's need for
access to `OperationId`.
Copy link
Member

@adam-singer adam-singer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 13 files at r1.
Reviewable status: 1 of 1 LGTMs obtained, and pending CI: Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Installation / macos-13, Installation / macos-14, Installation / ubuntu-22.04, Local / ubuntu-22.04, Publish image, Publish nativelink-worker-init, 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, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, windows-2022 / stable

In prep to support a distributed/redis scheduler, prepare the state
interface to no longer take mutable references.

This is a partial PR and should be landed immediately with followup PRs
that will remove many of the locking in the SimpleScheduler.

towards: TraceMachina#359
@allada allada force-pushed the move-scheduler-state-behind-mutex branch from 5dd9dec to be1e41a Compare June 28, 2024 21:02
Copy link
Member

@adam-singer adam-singer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 14 of 14 files at r2.
Reviewable status: :shipit: complete! 1 of 1 LGTMs obtained

Copy link
Member

@zbirenbaum zbirenbaum left a 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 1 discussions need to be resolved


nativelink-scheduler/src/simple_scheduler.rs line 109 at r3 (raw file):

        &self,
        unique_qualifier: &ActionInfoHashKey,
    ) -> Result<Option<watch::Receiver<Arc<ActionState>>>, Error> {

Would it be ok to just do an error event here detailing to show how and why the check failed and then just return None instead of propagating and handling it all the way up the call stack?

An alternative could be to return just a Result instead of a Result<Option> and have the Error code be ActionNotFound or something.

Either way works but I think wrapping this twice is overkill.

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.

None yet

3 participants