Skip to content

Engine can work with Bazel Remote Execution API - #4910

Merged
stuhood merged 2 commits into
pantsbuild:masterfrom
illicitonion:dwagnerhall/grpc-0
Sep 29, 2017
Merged

Engine can work with Bazel Remote Execution API#4910
stuhood merged 2 commits into
pantsbuild:masterfrom
illicitonion:dwagnerhall/grpc-0

Conversation

@illicitonion

Copy link
Copy Markdown
Contributor

Sets up the plumbing to do codegen to get Rust interface with protos.
Generates .rs files every build. Doesn't check them in.

Adds a test to show that we can interact with protos.

Splits process_executor into a local and remote module.

Doesn't yet touch gRPC.

@illicitonion

Copy link
Copy Markdown
Contributor Author

@jsirois @stuhood

I realise this has a few open questions. Off the top of my head:

  • Should we be checking in the codegen'd rust files? (@cosmicexplorer had an opinion here too)
  • Should we do the codegen as I'm currently doing in a shell script which is called from build.rs, or more natively in rust? (I'm happy to implement either, but I worked out what to do in a shell script, so that's what I include)
    And I'm sure some others too.

@illicitonion

Copy link
Copy Markdown
Contributor Author

I'm also happy to split this into smaller commits if desired, but I figured getting the whole compile flow in would be handy to see where it's going.

@stuhood stuhood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome, thanks Daniel! I'm pre-approving because nothing is really a blocker, although I think it would be good to take a shot at pruning the extra protos.

@@ -39,7 +39,7 @@ fn main() {
(command, env)
};

let result = process_executor::run_command(process_executor::ExecuteProcessRequest { argv, env }).unwrap();
let result = process_executor::local::run_command_locally(process_executor::ExecuteProcessRequest { argv, env }).unwrap();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Take it or leave it, but: there might already be an advantage to adding a trait Executor (even with only one method), as it will help make it obvious that there should be uniformity between the two implementations moving forward.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

They're actually not quite compatible today (slightly different error types), and they're also not on any struct... I'll pull one out when there's actually a caller :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok, that's fine too!

For the record, it's still possible to implement a trait, as traits can have "static" (no self arg) methods... you can then use them generically via:

fn execute_thing<E: Executor>(cmd: ...) -> ... {
  E::execute(cmd)
}

}

let mut action = bazel_protos::remote_execution::Action::new();
action.set_command_digest(digest(&command)?);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sidenote: it's interesting that this requires double-serializing things for the purposes of digesting them... perhaps there are "set_field_as_raw_bytes" type APIs on the Java/C++ side to avoid double serializing? *shrug

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, a little annoying. I guess we can try to hack something clever into place if this becomes noticeable :)

Comment thread 3rdparty/protobuf/googleapis/README.md Outdated

This dump was taken at git sha e17dbfb19652240490cae8adeb89991d13cf9df7.

It contains many more protos than we actually use, but performing dependency analysis to work out

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So, I could understand this argument if it were a dozen files or so, but for a few hundred it doesn't quite jive for me. In particular, the cost continues after the initial commit in that whenever we bump/update these files, we'll have hundreds of edits to things we're not using.

Are you expecting that the number of "live" files here is going to be more than a dozen or so? If not, it would be good to do something like "delete all but the root, and re-add things one by one until it compiles".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Turns out the deps were actually pretty small. Done.

@@ -0,0 +1,3 @@
remote_execution.rs
remote_execution_grpc.rs
status.rs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If lib.rs is always supposed to be the only live file, you can do something like:

*.rs
!lib.rs

...to ignore all non-lib.rs rs files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice :) Done

@stuhood

stuhood commented Sep 28, 2017

Copy link
Copy Markdown
Member

Should we be checking in the codegen'd rust files? (@cosmicexplorer had an opinion here too)

I'd rather not check in generated code. I understand the readability argument, but just including a link to a gist of the generated code when we change the protos would seem to go far enough toward reviewing what comes out.

Should we do the codegen as I'm currently doing in a shell script which is called from build.rs, or more natively in rust?

Shell seems fine for now.

The Weezy image uses a glibc which isn't compatible with the
binary_utils binaries we publish for Linux.
Sets up the plumbing to do codegen to get Rust interface with protos.
Generates .rs files every build. Doesn't check them in.

Adds a test to show that we can interact with protos.

Splits process_executor into a local and remote module.

Doesn't yet touch gRPC.
@stuhood
stuhood merged commit d89eb35 into pantsbuild:master Sep 29, 2017
stuhood pushed a commit that referenced this pull request Sep 30, 2017
### Problem

We're currently using a "very modern" debian version, which unblocked landing #4910. See #4915 for more info.

### Solution

Bump to a more-compatibly-built version of `protoc` created in pantsbuild/binaries#40, and downgrade docker images to Wheezy.

### Result

Rust protobuf generation will use newer protoc, and CI will use older debian. Fixes #4915.
@illicitonion
illicitonion deleted the dwagnerhall/grpc-0 branch February 26, 2018 11:52
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.

3 participants