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

Unify validate_output logic in CompletenessCheckingStore and CacheLookupScheduler #826

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

blizzardc0der
Copy link
Contributor

@blizzardc0der blizzardc0der commented Apr 3, 2024

Description

We have duplicated work in CacheLookupScheduler and CompletenessCheckingStore.
To resolve this, I removed the validation logic in CacheLookupScheduler and instead make it have CompletenessCheckingStore always.

Fixes #677

Type of change

Please delete options that aren't relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

Checklist

  • Updated documentation if needed
  • Tests added/amended
  • bazel test //... passes locally
  • PR is contained in a single commit, using git amend see some docs

This change is Reviewable

@blizzardc0der
Copy link
Contributor Author

I hope you to review this. cc: @allada.

Copy link
Member

@allada allada 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 4 of 4 files at r1.
Reviewable status: 1 of 1 LGTMs obtained, and 5 discussions need to be resolved


-- commits line 2 at r1:
nit: Change this to:

[Breaking] Remove completeness checking logic in CacheLookupScheduler

Since the CompletenessCheckingStore had landed, users should now use this
store if they need CompletenessChecking for their action cache store.

Breaking change only affects CacheLookupScheduler.

nativelink-config/src/schedulers.rs line 148 at r1 (raw file):

#[serde(deny_unknown_fields)]
pub struct CacheLookupScheduler {
    /// The reference to the CompletenessCheckingStore used to return cached

nit: Lets instead accept any Store, but add:

To prevent unintended issues, this store should probably be a CompletenessCheckingStore.

because they might use a GRPC store that does this under the hood.


nativelink-scheduler/src/cache_lookup_scheduler.rs line 107 at r1 (raw file):

    ) -> Result<Self, Error> {
        let any_store = ac_store.clone().inner_store_arc(None).as_any_arc();
        let _ = any_store.downcast::<CompletenessCheckingStore>().map_err(|_| {

nit: We can remove this, we'll put the blame on the user if they don't honor documentation.


nativelink-scheduler/src/cache_lookup_scheduler.rs line 175 at r1 (raw file):

                    .await
            {
                if let Ok(_) = Pin::new(ac_store.clone().as_ref())

This is not correct, it should be Ok(Some(_))...

But regardless lets print warning if an error is returned.


nativelink-scheduler/tests/cache_lookup_scheduler_test.rs line 52 at r1 (raw file):

fn make_cache_scheduler() -> Result<TestContext, Error> {
    let mock_scheduler = Arc::new(MockActionScheduler::new());
    let ac_store = Arc::new(CompletenessCheckingStore::new(

for the test, lets just go back to memory store.

Copy link
Member

@allada allada left a 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: 1 of 1 LGTMs obtained, and 5 discussions need to be resolved

@blizzardc0der blizzardc0der force-pushed the unify-validate-output branch 3 times, most recently from c06b895 to 83a7f13 Compare April 3, 2024 16:59
Copy link
Contributor Author

@blizzardc0der blizzardc0der 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 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 2 discussions need to be resolved


nativelink-scheduler/src/cache_lookup_scheduler.rs line 175 at r1 (raw file):

Previously, allada (Nathan (Blaise) Bruer) wrote…

This is not correct, it should be Ok(Some(_))...

But regardless lets print warning if an error is returned.

Done.


nativelink-scheduler/tests/cache_lookup_scheduler_test.rs line 52 at r1 (raw file):

Previously, allada (Nathan (Blaise) Bruer) wrote…

for the test, lets just go back to memory store.

Done.

@blizzardc0der blizzardc0der requested a review from allada April 3, 2024 17:00
Copy link
Member

@allada allada left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r2, all commit messages.
Reviewable status: 1 of 1 LGTMs obtained, and pending CI: Cargo Dev / ubuntu-22.04, pre-commit-checks

Copy link
Contributor

@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 4 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: 2 of 1 LGTMs obtained, and pending CI: Cargo Dev / ubuntu-22.04, pre-commit-checks

Copy link
Member

@allada allada left a comment

Choose a reason for hiding this comment

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

Could you rebase this on latest main, CI should be resolved now.

Reviewable status: 2 of 1 LGTMs obtained, and pending CI: Cargo Dev / ubuntu-22.04, pre-commit-checks

Since the CompletenessCheckingStore had landed, users should now use
this store if they need CompletenessChecking for their action cache store.

Breaking change only affects CacheLookupScheduler.
@blizzardc0der blizzardc0der force-pushed the unify-validate-output branch from 83a7f13 to 630e9ba Compare April 5, 2024 16:24
Copy link
Contributor Author

@blizzardc0der blizzardc0der left a comment

Choose a reason for hiding this comment

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

Done. cc: @allada.

Reviewable status: 2 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, 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, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, windows-2022 / stable, zig-cc ubuntu-20.04, zig-cc ubuntu-22.04

Copy link
Contributor

@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 all commit messages.
Reviewable status: 2 of 1 LGTMs obtained, and pending CI: Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / 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), macos-13, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, windows-2022 / stable, zig-cc ubuntu-20.04, zig-cc ubuntu-22.04

@allada allada merged commit 692e4de into TraceMachina:main Apr 5, 2024
26 checks passed
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.

Unify validate_output logic in CompletenessCheckingStore and CacheLookupScheduler
3 participants