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

Remove --experimental_worker_allow_json_protocol #14679

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions site/en/docs/creating-workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ would benefit from cross-action caching, you may want to implement your own
persistent worker to perform these actions.

The Bazel server communicates with the worker using `stdin`/`stdout`. It
supports the use of protocol buffers or JSON strings. Support for JSON is
experimental and thus subject to change. It is guarded behind the
`--experimental_worker_allow_json_protocol` flag.
supports the use of protocol buffers or JSON strings.

The worker implementation has two parts:

Expand Down
19 changes: 7 additions & 12 deletions site/en/docs/persistent-workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@ flag makes each worker request use a separate sandbox directory for all its
inputs. Setting up the [sandbox](/docs/sandboxing) takes some extra time,
especially on macOS, but gives a better correctness guarantee.

You can use the `--experimental_worker_allow_json_protocol` flag to allow
workers to communicate with Bazel through JSON instead of protocol buffers
(protobuf). The worker and the rule that consumes it can then be modified to
support JSON.

The
[`--worker_quit_after_build`](/reference/command-line-reference#flag--worker_quit_after_build)
flag is mainly useful for debugging and profiling. This flag forces all workers
Expand Down Expand Up @@ -197,13 +192,13 @@ inputs: [
```

The worker receives this on `stdin` in JSON format (because
`requires-worker-protocol` is set to JSON, and
`--experimental_worker_allow_json_protocol` is passed to the build to enable
this option). The worker then performs the action, and sends a JSON-formatted
`WorkResponse` to Bazel on its stdout. Bazel then parses this response and
manually converts it to a `WorkResponse` proto. To communicate
with the associated worker using binary-encoded protobuf instead of JSON,
`requires-worker-protocol` would be set to `proto`, like this:
`requires-worker-protocol` is set to JSON). Each WorkRequest json blob
is separated by a newline. The worker then performs the action, and
sends a JSON-formatted `WorkResponse` to Bazel on its stdout. Bazel then
parses this response and manually converts it to a `WorkResponse` proto.
To communicate with the associated worker using binary-encoded protobuf
instead of JSON, `requires-worker-protocol` would be set to `proto` or
omitted, like this:

```
execution_requirements = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ public class WorkerOptions extends OptionsBase {
})
public Void experimentalPersistentJavac;

@Option(
name = "experimental_worker_allow_json_protocol",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS},
help =
"Allows workers to use the JSON worker protocol until it is determined to be"
+ " stable.")
public boolean experimentalJsonWorkerProtocol;

/**
* Defines a resource converter for named values in the form [name=]value, where the value is
* {@link ResourceConverter.FLAG_SYNTAX}. If no name is provided (used when setting a default),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ public WorkerConfig compute(Spawn spawn, SpawnExecutionContext context)

HashCode workerFilesCombinedHash = WorkerFilesHash.getCombinedHash(workerFiles);

WorkerProtocolFormat protocolFormat = Spawns.getWorkerProtocolFormat(spawn);
if (!workerOptions.experimentalJsonWorkerProtocol) {
if (protocolFormat == WorkerProtocolFormat.JSON) {
throw new IOException(
"Persistent worker protocol format must be set to proto unless"
+ " --experimental_worker_allow_json_protocol is used");
}
}
WorkerKey key =
createWorkerKey(
spawn,
Expand All @@ -108,7 +100,7 @@ public WorkerConfig compute(Spawn spawn, SpawnExecutionContext context)
workerFiles,
workerOptions,
context.speculating(),
protocolFormat);
Spawns.getWorkerProtocolFormat(spawn));
return new WorkerConfig(key, flagFiles);
}

Expand Down
1 change: 0 additions & 1 deletion src/test/shell/integration/bazel_worker_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ example_worker=$(find $BAZEL_RUNFILES -name ExampleWorker_deploy.jar)

add_to_bazelrc "build -s"
add_to_bazelrc "build --spawn_strategy=worker,standalone"
add_to_bazelrc "build --experimental_worker_allow_json_protocol"
add_to_bazelrc "build --worker_verbose --worker_max_instances=1"
add_to_bazelrc "build --debug_print_action_contexts"
add_to_bazelrc "build --noexperimental_worker_multiplex"
Expand Down