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

Add RedisOperation and RedisOperationState #1020

Closed

Conversation

zbirenbaum
Copy link
Contributor

@zbirenbaum zbirenbaum commented Jun 18, 2024

Description

Creates groundwork for Redis State Manager implementation by introducing two new structs. RedisOperation represents an operation stored in redis and RedisOperationState represents the wrapped object which implements the ActionStateResult trait.

Type of change

  • New feature (non-breaking change which adds functionality)

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

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 6 of 7 files at r1, all commit messages.
Reviewable status: 0 of 1 LGTMs obtained, and pending CI: docker-compose-compiles-nativelink (20.04), docker-compose-compiles-nativelink (22.04), integration-tests (20.04), integration-tests (22.04), and 2 discussions need to be resolved


nativelink-scheduler/BUILD.bazel line 20 at r1 (raw file):

        "src/platform_property_manager.rs",
        "src/property_modifier_scheduler.rs",
        "src/redis_operation_state.rs",

can redis stuff be scoped under a redis folder ?


nativelink-scheduler/src/redis_operation_state.rs line 90 at r1 (raw file):

                );
                if let Err(_e) = res {
                    todo!()

Why are these todo? Would it be odd to return a Result from a "new" constructor?

Copy link
Contributor Author

@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: 0 of 1 LGTMs obtained, and pending CI: docker-compose-compiles-nativelink (20.04), docker-compose-compiles-nativelink (22.04), integration-tests (20.04), integration-tests (22.04), and 2 discussions need to be resolved


nativelink-scheduler/BUILD.bazel line 20 at r1 (raw file):

Previously, adam-singer (Adam Singer) wrote…

can redis stuff be scoped under a redis folder ?

Let's do that in a followup if possible, happy to make a ticket for it. Right now it's all contained in one place so it's not much clutter. If we want to break it out into multiple files in a sub dir that's fine but will require a lot of overhead since there are 3 other PRs to rebase.


nativelink-scheduler/src/redis_operation_state.rs line 90 at r1 (raw file):

Previously, adam-singer (Adam Singer) wrote…

Why are these todo? Would it be odd to return a Result from a "new" constructor?

Blaise and I discussed this and the error handling here get's extremely complicated. They will have to be sent like event notifications and figuring out the best way to do it will take some thought.

Returning a result from a new constructor isn't an issue, but returning it from a spawn is.

Creates groundwork for Redis State Manager implementation by introducing
two new structs. RedisOperation represents an operation stored in redis
and RedisOperationState represents the wrapped object which implements
the ActionStateResult trait.
@zbirenbaum zbirenbaum mentioned this pull request Jun 19, 2024
4 tasks
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 7 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 1 LGTMs obtained

@zbirenbaum zbirenbaum requested a review from allada June 19, 2024 20:53
Copy link
Contributor Author

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


nativelink-scheduler/src/redis_operation_state.rs line 34 at r2 (raw file):

use crate::operation_state_manager::{ActionStateResult, OperationStageFlags};

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]

I don't love this enum and I really don't like the parse_state_flags method below it. The problem is that we


nativelink-scheduler/src/redis_operation_state.rs line 43 at r2 (raw file):

}

fn _parse_stage_flags(flags: &OperationStageFlags) -> Vec<OperationStage> {

I added some context on why this exists in the client pr where this function is actually called. The bottom line is I really don't like it but I'm not entirely sure what the best way to do this is and am open to suggestions.

I don't think this code should be merged, it's just too verbose.

@zbirenbaum
Copy link
Contributor Author

Changes merged in #1023

@zbirenbaum zbirenbaum closed this Jun 28, 2024
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