forked from higherkindness/rules_scala
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Sends verbosity from the worker protocol to the worker and enable Java toolchain multiplex sandboxing #55
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load("@rules_scala_annex//rules:scala.bzl", "scala_binary") | ||
load("verbosity_spec_worker_run.bzl", "verbosity_spec_worker_run") | ||
|
||
scala_binary( | ||
name = "verbosity-spec-worker", | ||
srcs = [ | ||
"RunnerThatPrintsVerbosity.scala", | ||
], | ||
scala = "//scala:2_13", | ||
tags = ["manual"], | ||
deps = [ | ||
"@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/sandbox", | ||
"@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/worker", | ||
], | ||
) | ||
|
||
verbosity_spec_worker_run( | ||
name = "verbosity-spec-target", | ||
verbosity_spec_worker = ":verbosity-spec-worker", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package anx.cancellation | ||
|
||
import higherkindness.rules_scala.common.worker.WorkerMain | ||
import higherkindness.rules_scala.common.sandbox.SandboxUtil | ||
|
||
import java.io.{InputStream, PrintStream} | ||
import java.nio.file.{Files, Path, Paths} | ||
|
||
object RunnerThatPrintsVerbosity extends WorkerMain[Unit] { | ||
override def init(args: Option[Array[String]]): Unit = () | ||
override def work(ctx: Unit, args: Array[String], out: PrintStream, workDir: Path, verbosity: Int): Unit = { | ||
out.println(s"Verbosity: ${verbosity}") | ||
Files.createFile(SandboxUtil.getSandboxPath(workDir, Paths.get(args(0)))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash -e | ||
. "$(dirname "$0")"/../common.sh | ||
|
||
# We use modify_execution_info, nouse_action_cache, and bazel shutdown here | ||
# in order to prevent the disk cache, skyframe cache, and persistent action cache | ||
# from being used for the verbosity spec worker actions and thus getting the | ||
# verbosity we want getting printed. The alternative is to bazel clean, which | ||
# takes much longer. | ||
bazel shutdown | ||
bazel build --modify_execution_info="VerbositySpecWorkerRun=+no-cache" --nouse_action_cache :verbosity-spec-target |& grep -q "Verbosity: 0" | ||
bazel shutdown | ||
bazel build --modify_execution_info="VerbositySpecWorkerRun=+no-cache" --nouse_action_cache --worker_verbose :verbosity-spec-target |& grep -q "Verbosity: 10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
def _impl(ctx): | ||
foo_file = ctx.actions.declare_file("foo.txt") | ||
outputs = [foo_file] | ||
|
||
args = ctx.actions.args() | ||
args.add(foo_file) | ||
args.set_param_file_format("multiline") | ||
args.use_param_file("@%s", use_always = True) | ||
|
||
ctx.actions.run( | ||
outputs = outputs, | ||
arguments = [args], | ||
mnemonic = "VerbositySpecWorkerRun", | ||
execution_requirements = { | ||
"supports-multiplex-workers": "1", | ||
"supports-workers": "1", | ||
"supports-multiplex-sandboxing": "1", | ||
"supports-worker-cancellation": "1", | ||
}, | ||
progress_message = "Running verbosity spec worker %{label}", | ||
executable = ctx.executable.verbosity_spec_worker, | ||
) | ||
|
||
return [ | ||
DefaultInfo(files = depset(outputs)), | ||
] | ||
|
||
verbosity_spec_worker_run = rule( | ||
implementation = _impl, | ||
doc = "Runs a worker that prints the verbosity level it received from the work request", | ||
attrs = { | ||
"verbosity_spec_worker": attr.label( | ||
executable = True, | ||
cfg = "host", | ||
allow_files = True, | ||
default = Label(":verbosity-spec-worker"), | ||
), | ||
}, | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're getting the arguments and verbosity directly from the work request, should we just pass that to the worker directly instead of copying so many of its fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should because this does create a nice interface all the workers must adhere to. It does sometimes mean updates when the protocol changes. Good news is that tends to happen rather infrequently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I can see how this forces worker implementers to think about certain things. Nevermind, then.