1- // Copyright 2018 The Bazel Authors. All rights reserved.
1+ // Copyright 2015 The Bazel Authors. All rights reserved.
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -20,32 +20,81 @@ option java_package = "com.google.devtools.build.lib.worker";
2020
2121// An input file.
2222message Input {
23- // The path in the file system where to read this input artifact from. This is
24- // either a path relative to the execution root (the worker process is
25- // launched with the working directory set to the execution root), or an
26- // absolute path.
27- string path = 1 ;
28-
29- // A hash-value of the contents. The format of the contents is unspecified and
30- // the digest should be treated as an opaque token.
31- bytes digest = 2 ;
23+ // The path in the file system where to read this input artifact from. This is
24+ // either a path relative to the execution root (the worker process is
25+ // launched with the working directory set to the execution root), or an
26+ // absolute path.
27+ string path = 1 ;
28+
29+ // A hash-value of the contents. The format of the contents is unspecified and
30+ // the digest should be treated as an opaque token. This can be empty in some
31+ // cases.
32+ bytes digest = 2 ;
3233}
3334
3435// This represents a single work unit that Blaze sends to the worker.
3536message WorkRequest {
36- repeated string arguments = 1 ;
37+ repeated string arguments = 1 ;
38+
39+ // The inputs that the worker is allowed to read during execution of this
40+ // request.
41+ repeated Input inputs = 2 ;
42+
43+ // Each WorkRequest must have either a unique
44+ // request_id or request_id = 0. If request_id is 0, this WorkRequest must be
45+ // processed alone (singleplex), otherwise the worker may process multiple
46+ // WorkRequests in parallel (multiplexing). As an exception to the above, if
47+ // the cancel field is true, the request_id must be the same as a previously
48+ // sent WorkRequest. The request_id must be attached unchanged to the
49+ // corresponding WorkResponse. Only one singleplex request may be sent to a
50+ // worker at a time.
51+ int32 request_id = 3 ;
52+
53+ // EXPERIMENTAL: When true, this is a cancel request, indicating that a
54+ // previously sent WorkRequest with the same request_id should be cancelled.
55+ // The arguments and inputs fields must be empty and should be ignored.
56+ bool cancel = 4 ;
3757
38- // The inputs that the worker is allowed to read during execution of this
39- // request.
40- repeated Input inputs = 2 ;
58+ // Values greater than 0 indicate that the worker may output extra debug
59+ // information to stderr (which will go into the worker log). Setting the
60+ // --worker_verbose flag for Bazel makes this flag default to 10.
61+ int32 verbosity = 5 ;
62+
63+ // The relative directory inside the workers working directory where the
64+ // inputs and outputs are placed, for sandboxing purposes. For singleplex
65+ // workers, this is unset, as they can use their working directory as sandbox.
66+ // For multiplex workers, this will be set when the
67+ // --experimental_worker_multiplex_sandbox flag is set _and_ the execution
68+ // requirements for the worker includes 'supports-multiplex-sandbox'.
69+ // The paths in `inputs` will not contain this prefix, but the actual files
70+ // will be placed/must be written relative to this directory. The worker
71+ // implementation is responsible for resolving the file paths.
72+ string sandbox_dir = 6 ;
4173}
4274
43- // The worker sends this message to Blaze when it finished its work on the WorkRequest message.
75+ // The worker sends this message to Blaze when it finished its work on the
76+ // WorkRequest message.
4477message WorkResponse {
45- int32 exit_code = 1 ;
78+ int32 exit_code = 1 ;
79+
80+ // Output message for this work unit.
81+ // This is akin to the combined stdout/stderr if the work unit were executed
82+ // as a standalone process. Output pertaining to a work unit should be
83+ // reported here instead of through the stdout/stderr of the worker process.
84+ // Assumed to be UTF-8 encoded.
85+ string output = 2 ;
86+
87+ // This field must be set to the same request_id as the WorkRequest it is a
88+ // response to. Since worker processes which support multiplex worker will
89+ // handle multiple WorkRequests in parallel, this ID will be used to
90+ // determined which WorkerProxy does this WorkResponse belong to.
91+ int32 request_id = 3 ;
4692
47- // This is printed to the user after the WorkResponse has been received and is supposed to contain
48- // compiler warnings / errors etc. - thus we'll use a string type here, which gives us UTF-8
49- // encoding.
50- string output = 2 ;
93+ // EXPERIMENTAL When true, indicates that this response was sent due to
94+ // receiving a cancel request. The exit_code and output fields should be empty
95+ // and will be ignored. Exactly one WorkResponse must be sent for each
96+ // non-cancelling WorkRequest received by the worker, but if the worker
97+ // received a cancel request, it doesn't matter if it replies with a regular
98+ // WorkResponse or with one where was_cancelled = true.
99+ bool was_cancelled = 4 ;
51100}
0 commit comments