-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
Support concurrent execution of goals in a single run #10542
Comments
This comment has been minimized.
This comment has been minimized.
How does |
This would need to be adjusted to use a similar "waiting to acquire" API, or the "run" method would just be made asynchronous itself. I've added this to the |
The potential API changes here to |
I think that this could be accomplished by treating use of the
Together these constraints would mean that |
I thought that #9462 would not require us to change the public API of pants/src/rust/engine/src/externs/interface.rs Lines 1937 to 1953 in 3d45c04
So, that means that to resolve #9462, we need to choose an async API for A few potential APIs:
|
How about something like this? process_result = await SideEffect(InteractiveProcessResult, InteractiveProcess) I agree with not |
+1 for option 3, with a dedicated keyword, I also believe it will be easier to check the pre conditions etc, and also being clearer what it does. Also helps the documentation case I think, by having a standard "entry point" to reason about, rather than vaguely referring to "any side effecting method..". |
I also like the new keyword option. |
#13178 added this as The rest of this ticket involves porting the other |
…change (#13178) Adds `pex_binary(.., restartable=True)` and `repl --restartable` to optionally allow user processes to be restarted when files change. See `run_integration_test.py` for an example. `InteractiveProcess` is used for any process that needs to run in the foreground, including those for `run`, and `repl`. To support restarting those processes, we make invoking an `InteractiveProcess` async, which allows it to (optionally) be restarted when files change. To make `InteractiveProcess` async, we convert it into a rust-side `Intrinsic`, and introduce a new `Effect` awaitable type, which is used in place of `Get` when a type is `SideEffecting`. This also prepares the other `SideEffecting` param types to be converted to `Effect`s as well (in order to accomplish #10542). Fixes #9462.
I was thinking about the UI side of this. We can either decide which goals should be run together and make it just work for the user. Or we can introduce new syntax so we don't have to make assumptions. I lean towards 2. Something like |
@thejcannon when would you not want to run in parallel, when it would have been safe to do? Also I fear that introduces a new error mode. |
I'm thinking if I have lint/check and test, I don't think it's worthwhile to run tests on bad code. But then again maybe it's harmless 🤔 |
Racing |
Currently
./pants test lint $target
runs sequentially, and does not start any of the work involved withlint
until aftertest
has finished. This is because goals are currently implemented as sequential requests from outside the engine, which allows us to avoid needing to worry about how their outputs might be interleaved.But because we have carefully controlled how goal rules trigger sideeffects (either via using the
Workspace
object to write outputs to disk, or theConsole
object to write stdio to the user), we might be able to use finer-grained locking to allow goals to run concurrently/in-parallel until they need access to theWorkspace
orConsole
, at which point they would be allowed to acquire those in the order specified on the commandline."Waiting to acquire" in the goal might mean adding an async API to acquire access to the
Console
/Workspace
though, which will take some thought. One other area that might be challenging isfmt
, which uses theWorkspace
to create sideeffects that other goals would like to consume: running./pants fmt lint
should never fail inlint
due to errors that have been fixed duringfmt
, and with naive concurrency, that might not be the case.The above is sufficient for the 80% of usecases where the goals all wanted to operate on the same set of targets. For the other 20% where your CI environment wants to skip some targets/tags for some goals, something like the Root Selection Overhaul proposal might be necessary.
The text was updated successfully, but these errors were encountered: