-
Notifications
You must be signed in to change notification settings - Fork 414
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
Passive watch mode for tests #4678
Conversation
9eab063
to
edf1cd8
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Remove clients from session set after disconnect Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
…g_by mode Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
f13fb5f
to
0627881
Compare
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
… into dune-build-rpc-for-tests
Signed-off-by: Jeremie Dimino <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
… into dune-build-rpc-for-tests
…rn for fswatch Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
src/dune_engine/scheduler.mli
Outdated
( report_error:(Exn_with_backtrace.t -> unit) | ||
-> unit | ||
-> [ `Continue | `Stop ] Fiber.t) | ||
(report_error:(Exn_with_backtrace.t -> unit) -> [ `Continue ] Fiber.t) |
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.
Could we make poll
and poll_passive
have a more similar API? I find it odd that one takes a "one step" function, while the other takes a get_build_request
that returns a "one step" function. The fact that get_build_request
is blocking on the RPC is an implementation detail that is not very interesting from the point of view the scheduler.
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 thinking of the RPC as not being the part of the build because including RPCs into build seems weird (breaks some intuitions about the build being deterministic).
But there are also practical reasons related to scheduler:
- The build can be cancelled by a filesystem event, while the wait for the RPC can not.
- The inotify sync needs to happen after the rpc, but before the build.
I'm not sure how to abstract that away.
Overall, I feel like polling loop is inherently going to interact with these concerns, but the scheduler does not have to. Having polling loop integrated with the scheduler is what seems weird to me.
I took a bite at one step in what seems the right direction to me in:
aalekseyev@dbf0c25
This moves the filesystem event notifications into a separate variable (Invalidation_accumulator_var.t), but it's not really achieving enough to claim any separation.
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'm not arguing for having a single function, but at least similar APIs to learn to work with. The two run_...
functions in build_cmd.ml
end up having pretty different structure, which makes the code harder to review. If the two poll
function had a similar API, then the two functions in build_cmd.ml
should be more similar as well.
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.
Oh, got it. I'd argue build_cmd.ml
is messy for a different reason: because I wrote it badly.
I just pushed a commit that simplifies code in build_cmd.ml
.
As for the scheduler.mli
, my initial desire was to move the entire implementation of poll_passive
into build_cmd.ml
, but I couldn't do it without exposing details of the state machine. Any ideas for any specific improvements are very welcome!
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
…lity Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
Signed-off-by: Arseniy Alekseyev <[email protected]>
@jeremiedimino, OK, I merged and the types in scheduler.mli look nicer now. The error handling unification also let me unify the |
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.
Looks good. I didn't check the changes to the RPC, but the other changes look good to me.
88ac915
to
5f7424a
Compare
Signed-off-by: Arseniy Alekseyev <[email protected]>
@rgrinberg, I made some changes to rpc code in this PR (mainly: factor pieces out to be able to support the |
By the way, @rgrinberg, I never tested if |
This PR makes the following changes:
This is much better for dune automation than the vanilla watching mode itself because it lets the automation harness decide when to proceed with the build. We'll use it for tests now, but it can also be useful for the CI.
Implement
dune rpc build
command which sends thebuild
rpc to dune, to interact with the passive watch mode. I re-purposed a stub of an existingbuild
rpc which already existed, but was not usable and behaved strangely.To implement (dune rpc build) in a race-free way, added an inotify Sync mechanism to the filesystem watcher. By doing an inotify sync you're making sure that you've consumed all inotify events generated so far before proceeding with the build.
Add the beginning of watching mode test suite that makes use of this functionality.