Bazel: Allow persistent workers to communicate with Bazel using JSON instead of protos

Created on 10 Apr 2019  路  6Comments  路  Source: bazelbuild/bazel

Description of the problem / feature request:

Currently, persistent workers must use protocol buffers to communicate with Bazel. This limits the languages that workers can be implemented in to those that have first-class protocol buffer support.

Allowing workers to use a JSON serialization of the worker protocol would make it easier to implement workers in languages other than Java/C++. Since languages without first-class proto support often also have performance problems, this could open a number of interesting use cases (for example, a worker written as a shell script).

What underlying problem are you trying to solve with this feature?

I recently implemented a persistent worker in Python. Although it is possible, it is not easy, mostly because of the immaturity of the Python proto toolchain and APIs (no py_proto_library (https://github.com/bazelbuild/bazel/issues/2626), no methods for varint-delimited reading/writing (https://github.com/protocolbuffers/protobuf/issues/54), etc.). The repo linked above discusses the workarounds I needed to use to get a Python worker working.

The actual worker protocol is quite simple. I think it would be amenable to JSON serialization, which would make the Python worker much simpler.

P1 team-Local-Exec feature request

Most helpful comment

@karljamesgray is looking into this.

All 6 comments

The actual worker protocol is quite simple.

Related: #2832

Closed for lack of activity. Please ping the reviewers to reopen if this is still a problem.

@karljamesgray is looking into this.

Yes, the infrastructure is there as of September, and is documented in https://docs.bazel.build/versions/master/persistent-workers.html. We're doing a bit more testing; stay tuned for a blog post in the next couple of weeks.

Was this page helpful?
0 / 5 - 0 ratings