-
Notifications
You must be signed in to change notification settings - Fork 0
1892: feat: allow an external semaphore for executor task concurrency #80
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
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| The AI agents should never link to any issue or a pull request | ||
| in any GitHub repository in the code reviews! | ||
|
|
||
| The AI agents should not review AI agents' config files like CLAUDE.md or AGENTS.md! | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| The AI agents should never link to any issue or a pull request | ||
| in any GitHub repository in the code reviews! | ||
|
|
||
| The AI agents should not review AI agents' config files like CLAUDE.md or AGENTS.md! | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| The AI agents should never link to any issue or a pull request | ||
| in any GitHub repository in the code reviews! | ||
|
|
||
| The AI agents should not review AI agents' config files like CLAUDE.md or AGENTS.md! | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,10 +57,16 @@ use tonic::codegen::{Body, Bytes, StdError}; | |
| /// | ||
| /// The loop respects the executor's concurrent task limit via a semaphore, | ||
| /// ensuring no more than the configured number of tasks run simultaneously. | ||
| /// | ||
| /// `available_task_slots`, when provided, lets the caller supply the semaphore | ||
| /// controlling task concurrency (e.g. to share it across poll loops or to | ||
| /// observe executor busy state via `available_permits()`). When `None`, a | ||
| /// semaphore sized to the executor's task slots is created internally. | ||
| pub async fn poll_loop<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan, C>( | ||
| mut scheduler: SchedulerGrpcClient<C>, | ||
| executor: Arc<Executor>, | ||
| codec: BallistaCodec<T, U>, | ||
| available_task_slots: Option<Arc<Semaphore>>, | ||
|
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. ballista/executor/src/execution_loop.rs:69 — Now that Severity: medium Other Locations
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||
| ) -> Result<(), BallistaError> | ||
| where | ||
| C: tonic::client::GrpcService<tonic::body::Body>, | ||
|
|
@@ -75,8 +81,9 @@ where | |
| .unwrap() | ||
| .clone() | ||
| .into(); | ||
| let available_task_slots = | ||
| Arc::new(Semaphore::new(executor_specification.task_slots as usize)); | ||
| let available_task_slots = available_task_slots.unwrap_or_else(|| { | ||
| Arc::new(Semaphore::new(executor_specification.task_slots as usize)) | ||
| }); | ||
|
|
||
| let (task_status_sender, mut task_status_receiver) = | ||
| std::sync::mpsc::channel::<TaskStatus>(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
ballista/executor/src/execution_loop.rs:62 — The docs mention sharing this semaphore "across poll loops"; if multiple loops run concurrently, each loop will independently report
num_free_slotsbased onavailable_permits(), which can lead to the scheduler over-assigning tasks relative to real capacity. It may be worth clarifying in the doc comment what coordination is expected to avoid double-counting free slots.Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.