-
Notifications
You must be signed in to change notification settings - Fork 69
Conversation
Just a user report: I've tried that and it worked fine for me. |
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.
Can you rebase on master and make sure all commits build by themselves? I tried to rebase, but most of the commits seem to have build errors.
You have to change all ::module::Foo
forms to crate::module::Foo
, because we updated to Rust 2018.
I'll rebase and squash to a single commit when I get a chance. |
Merged with master, removed Heartbeats. |
As each new listener joins, the daemon sends a SectionEnd event to the existing ones. This results in a BrokenPipe for clients that have exited, and keeps the thread and connection consumption under control.
As a workaround, I've implemented a server deadline in |
yeah, if that’s the case go for it. My request for removal came from before the decision was made to throw the socket code away and switch to varlink. Sorry for the overhead. |
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 think this is solid code, and the feature is useful. Thanks for putting in the effort.
First review round done. +866 -48
line changes makes me nervous, but (1) you can just straight delete 50 lines (see comments) and (2) most of that seems to be in TryFrom
declarations, which is benign code.
|
||
let mut snapshot_done = false; | ||
let (tx, rx) = unbounded(); | ||
let recycle = tx.clone(); |
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.
tx_clone
perhaps? recycle
as a name doesn't carry much intuition, at least for me.
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 was hoping to indicate the reason for this channel - to feed a first event back into our local channel that's tee'd from the daemon monitor.
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.
That's fine. I find naming channels particularly difficult - I find myself looking at their uses a lot to figure out what they're actually meant to do. You could document this channel's purpose in a comment if you think that would be useful and possible to do succinctly. If not, don't - your call :)
@@ -19,7 +19,7 @@ pub struct Roots { | |||
|
|||
/// A path to a gc root. | |||
#[derive(Hash, PartialEq, Eq, Clone, Debug, Serialize, Deserialize)] | |||
pub struct RootPath(PathBuf); | |||
pub struct RootPath(pub PathBuf); |
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.
Not super elegant IMO, but I think RootPath
should just go away at some point, so I don't mind breaking the abstraction here.
# indicating that the stream of events is now "live." | ||
method Monitor() -> (event: Event) | ||
|
||
type Event ( |
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.
Varlink does not provide proper enums or gRPC-like oneof
. But I think that events can be modelled in a slightly more "type-safe" way. What do you think about this sort of structure:
type Event {
kind: (section_end, started),
section_end: SectionEnd?, # set iff kind == section_end
started: Started?, # set iff kind == started
# ...
}
where SectionEnd
, Started
, etc. have only non-optional 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 think this might be interesting to experiment, but I think I need to put it into a followup PR.
@curiousleo Thank you for the comprehensive and thoughtful review. Some of your suggestions are already addressed in my local branch. I'll be pushing those changes presently. Of the remainder, I like all of them and intend to implement. I am concern is that the pace of development outstrips my available time. This week has been merging current master back to this branch. If we could merge a sub-optimal version, I'm happy to commit to followup PRs. |
StreamEvents_(StreamEvents_), | ||
|
||
/// Upgrade Lorri | ||
#[structopt(name = "self-upgrade", alias = "self-update")] |
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.
The alias "self-update" was removed in a recent PR. If I had to guess, I'd say that re-introducing it here was not intentional?
#[structopt(name = "self-upgrade")] | ||
/// (plumbing) Ask the lorri daemon to report build events as they occur | ||
#[structopt( | ||
name = "internal__stream_events", |
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.
Nice. I appreciate your adopting the new conventions of the surrounding code here!
Compat(String), | ||
} | ||
|
||
/// See the documentation for lorri::cli::Command::Shell for more |
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.
Sorry, that wasn't a helpful comment! I just wanted to point out that
See the documentation for lorri::cli::Command::Shell for more details.
is perhaps not the best documentation for the stream_events main function.
|
||
let mut snapshot_done = false; | ||
let (tx, rx) = unbounded(); | ||
let recycle = tx.clone(); |
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.
That's fine. I find naming channels particularly difficult - I find myself looking at their uses a lot to figure out what they're actually meant to do. You could document this channel's purpose in a comment if you think that would be useful and possible to do succinctly. If not, don't - your call :)
} | ||
|
||
for event in rx.iter() { | ||
debug!("Received"; "event" => format!("{:#?}", &event)); |
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.
One last format!
that can be replaced by slog's ?&event
syntax.
@@ -17,7 +17,7 @@ use std::time::{Duration, Instant}; | |||
pub fn start_job_with_ping() -> std::io::Result<()> { | |||
// TODO: this code is a mess because Daeomon is not | |||
// nicely abstracted yet. | |||
|
|||
// |
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.
Super-nit: this change looks superfluous.
@nyarly thanks for the work you put in here, and for being very responsive to code review.
That's totally fair. The last couple of weeks were particularly frenetic. Expect fewer sweeping changes from now on.
I'm on board with that idea, with one big caveat I'll expand on in my next comment. The two items of I'd like to see follow-up on are:
I think that you have the most context on this and are probably the best person to do these things, but if you'd like help or would like to work on them together, we can definitely talk about that. |
Problem: implementation details exposed in the outputI think there is an issue with re-using existing structs the way it is done right now in this PR. Here's an example: $ lorri internal__stream_events | jq
{
"started": {
"nix_file": {
"shell": "/home/leo/Code/lorri/shell.nix"
},
"reason": {
"project_added": {
"shell": "/home/leo/Code/lorri/shell.nix"
}
}
}
}
{
"completed": {
"nix_file": {
"shell": "/home/leo/Code/lorri/shell.nix"
},
"result": {
"output_paths": {
"shell_gc_root": "/home/leo/.cache/lorri/gc_roots/2043910c8519bf079838568f54a73839/gc_root/shell_gc_root"
}
}
}
} What is clear here is that this exposes Lines 50 to 55 in c38e0f0
Lines 34 to 44 in c38e0f0
Lines 284 to 287 in c38e0f0
Serialize derives.
This means that any change to any of those structs or enums is likely to change the output format of Context: v1.0 and backwards compatibilityWe are working towards a lorri v1.0 release: #306. From that point on, the versioning scheme will be used to determine the next version. I believe that @Profpatsch may have planned for If Proposal: expose an explicit interfaceMy proposal is thus to separate the internal representation of things like build failure reasons from how they are represented in the output of the I see two options for how the explicit interface can be defined:
I hope this all makes sense. To summarise: |
#320 (comment) describes my proposal for our next steps with this work. |
Adds a
lorri stream_events_
subcommand that receives json formatted representations of events. Each event is its own\n
separated line. The command takes an option to toggle current state reporting vs. live events (or both), which is useful for the motivating use cases.Included are example jq|xargs style scripts to make use of the event streams.