Skip to content

Add poll_now_notify parameter to poll_loop and on_work_available callback - #12

Merged
phillipleblanc merged 1 commit into
spiceai-51from
phillip/260126-poll-loop-interrupt
Jan 26, 2026
Merged

phillipleblanc merged 1 commit into
spiceai-51from
phillip/260126-poll-loop-interrupt

Conversation

@phillipleblanc

Copy link
Copy Markdown
  • Add poll_now_notify: Option<Arc> parameter to poll_loop in execution_loop.rs
  • Update idle sleep to use tokio::select! - wakes on 100ms timeout OR notify signal
  • Add OnWorkAvailableFn callback type and field to SchedulerConfig
  • Invoke callback after JobSubmitted and TaskUpdating events when new work available
  • Update standalone executor and executor_process to pass None for poll_now_notify

…back

- Add poll_now_notify: Option<Arc<Notify>> parameter to poll_loop in execution_loop.rs
- Update idle sleep to use tokio::select! - wakes on 100ms timeout OR notify signal
- Add OnWorkAvailableFn callback type and field to SchedulerConfig
- Invoke callback after JobSubmitted and TaskUpdating events when new work available
- Update standalone executor and executor_process to pass None for poll_now_notify
@phillipleblanc
phillipleblanc force-pushed the phillip/260126-poll-loop-interrupt branch from e0ab27e to 6088cdb Compare January 26, 2026 07:03
@phillipleblanc
phillipleblanc merged commit d827769 into spiceai-51 Jan 26, 2026
29 checks passed
@phillipleblanc
phillipleblanc deleted the phillip/260126-poll-loop-interrupt branch January 26, 2026 18:43
@milenkovicm

Copy link
Copy Markdown

Hey @phillipleblanc I've noticed you guys are doing great job extending ballista, would you consider contributing patches back to ballista for things like #12, #13, #14, #15 ?

@milenkovicm

Copy link
Copy Markdown

Also, it would be great if could get involved into steering ballista's direction

@phillipleblanc

Copy link
Copy Markdown
Author

@milenkovicm Yes! We can definitely upstream some of the work we've been doing. What would be the best way to start participating in steering ballista's direction?

@milenkovicm

Copy link
Copy Markdown

cool! if ok, i would cherry pick few commits from your repo an back-port them to ballista, will add you do PR review. also, feel free to suggest things needed on master

with regards to ballista steering participations, whatever you guys have bandwidth to do, even just opening bugs or keeping an eye on PR would be appreciated

phillipleblanc added a commit that referenced this pull request Jul 27, 2026
…he#1892)

* feat: allow an external semaphore for executor task concurrency

Adds an optional available_task_slots: Option<Arc<Semaphore>> parameter to
the executor poll_loop. When provided, the caller supplies the semaphore
that bounds concurrent task execution; this enables sharing it across poll
loops connected to different schedulers and observing executor busy state
via available_permits(). When None, the loop creates one internally sized
to the executor's task slots (unchanged behavior).

Ported from #14 for upstreaming. Note: layers
on the poll_loop signature; if landed after #12 (poll_now_notify) it needs
a trivial rebase to add both parameters.

* fix(examples): pass optional semaphore arg in mtls-cluster and reformat standalone

* fix(executor): address PR review feedback on shared-semaphore poll_loop

- Handle AcquireError from semaphore acquire/acquire_owned by mapping to
  BallistaError instead of panicking, since the semaphore may now be
  externally owned and closed by the caller
- Assert that the provided semaphore has at least one permit on entry to
  fail fast rather than deadlock
- Rewrite poll_loop doc comment to be public-facing: remove references
  to internal variable names and implementation types, document shared-
  semaphore over-commit semantics and sizing tradeoffs in behavioral
  terms, and add a # Panics section for the zero-permit case

* style: cargo fmt execution_loop.rs

---------

Co-authored-by: Phillip LeBlanc <879445+phillipleblanc@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants