-
Notifications
You must be signed in to change notification settings - Fork 59
Decouple gRPC from the worker protocol and add an in-process transport #573
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
base: main
Are you sure you want to change the base?
Changes from all commits
4721f09
b0a7e4a
5f41597
3888470
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,10 +63,10 @@ async fn run_app( | |
| terminal.draw(|frame| ui::render(frame, app))?; | ||
|
|
||
| // Check for keyboard input (16ms timeout ~ 60fps responsiveness) | ||
| if event::poll(Duration::from_millis(16))? { | ||
| if let Event::Key(key) = event::read()? { | ||
| input::handle_key_event(app, key); | ||
| } | ||
| if event::poll(Duration::from_millis(16))? | ||
| && let Event::Key(key) = event::read()? | ||
| { | ||
| input::handle_key_event(app, key); | ||
| } | ||
|
Comment on lines
+66
to
70
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 this change is unrelated right? if it is, I'd avoid introducing unrelated changes, mainly for better traceability. |
||
|
|
||
| if app.should_quit { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,32 +176,32 @@ impl WorkerConn { | |
|
|
||
| // Detect completed tasks: tasks that were running but disappeared | ||
| for old_task in &self.tasks { | ||
| if old_task.status == TaskStatus::Running as i32 { | ||
| if let Some(sk) = &old_task.task_key { | ||
| let key = (sk.query_id.clone(), sk.stage_id, sk.task_number); | ||
| if !new_task_keys.contains(&key) { | ||
| // Task disappeared — assume completed | ||
| let observed_duration = self | ||
| .task_first_seen | ||
| .get(&key) | ||
| .map(|first| first.elapsed()) | ||
| .unwrap_or_default(); | ||
|
|
||
| self.completed_tasks.push_front(CompletedTaskRecord { | ||
| query_id: sk.query_id.clone(), | ||
| stage_id: sk.stage_id, | ||
| task_number: sk.task_number, | ||
| observed_duration, | ||
| }); | ||
|
|
||
| // Maintain bounded size | ||
| while self.completed_tasks.len() > MAX_COMPLETED_TASKS { | ||
| self.completed_tasks.pop_back(); | ||
| } | ||
|
|
||
| // Remove from first_seen tracking | ||
| self.task_first_seen.remove(&key); | ||
| if old_task.status == TaskStatus::Running as i32 | ||
| && let Some(sk) = &old_task.task_key | ||
| { | ||
|
Comment on lines
+179
to
+181
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
| let key = (sk.query_id.clone(), sk.stage_id, sk.task_number); | ||
| if !new_task_keys.contains(&key) { | ||
| // Task disappeared — assume completed | ||
| let observed_duration = self | ||
| .task_first_seen | ||
| .get(&key) | ||
| .map(|first| first.elapsed()) | ||
| .unwrap_or_default(); | ||
|
|
||
| self.completed_tasks.push_front(CompletedTaskRecord { | ||
| query_id: sk.query_id.clone(), | ||
| stage_id: sk.stage_id, | ||
| task_number: sk.task_number, | ||
| observed_duration, | ||
| }); | ||
|
|
||
| // Maintain bounded size | ||
| while self.completed_tasks.len() > MAX_COMPLETED_TASKS { | ||
| self.completed_tasks.pop_back(); | ||
| } | ||
|
|
||
| // Remove from first_seen tracking | ||
| self.task_first_seen.remove(&key); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ impl MetricsStore { | |
| self.rx.borrow().get(key).cloned() | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| #[cfg(all(test, feature = "grpc"))] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like this is needed because this code is used in the task_metrics_rewriter.rs tests, and those tests are still coupled to It'd be nice to decouple that test from |
||
| pub(crate) fn from_entries(entries: impl IntoIterator<Item = (TaskKey, TaskMetrics)>) -> Self { | ||
| let map: HashMap<_, _> = entries.into_iter().collect(); | ||
| let (tx, rx) = watch::channel(map); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ impl MetricsWrapperExec { | |
| Self { inner, metrics } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| #[cfg(all(test, feature = "grpc"))] | ||
| pub(crate) fn inner(&self) -> &Arc<dyn ExecutionPlan> { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only used in task_metrics_rewriter.rs tests. If we manage to decouple those tests from |
||
| &self.inner | ||
| } | ||
|
|
||
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.
These tests should really not be under benchmarks. I think I might be missing the reason for these to be here. Do they really need to be here?