Skip to content

[Feature] Faster batching#1015

Merged
jan-janssen merged 6 commits into
mainfrom
faster_batching
Jun 11, 2026
Merged

[Feature] Faster batching#1015
jan-janssen merged 6 commits into
mainfrom
faster_batching

Conversation

@jan-janssen

@jan-janssen jan-janssen commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Refactor
    • Redesigned task dependency handling to use a single dependency accumulator and a dedicated handler for detecting and resubmitting tasks when inputs become available; improved shutdown draining behavior.
  • New Features
    • Added a standalone readiness check for input futures and simplified task submission flow.
  • Tests
    • Updated unit tests to reflect the new readiness-check behavior and task dependency flow.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3a232ef0-5c2f-4483-bc81-3caad42a9f53

📥 Commits

Reviewing files that changed from the base of the PR and between 85ea719 and 8fe83b5.

📒 Files selected for processing (2)
  • src/executorlib/standalone/interactive/arguments.py
  • src/executorlib/task_scheduler/interactive/dependency.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/executorlib/standalone/interactive/arguments.py
  • src/executorlib/task_scheduler/interactive/dependency.py

📝 Walkthrough

Walkthrough

DependencyTaskScheduler replaces wait_lst with future_dependency_lst, centralizes deferred-task processing in _handle_future_dependencies, updates intake to append batched and non-ready tasks (storing input futures), and moves future-readiness checks into a new check_list_of_futures_is_done helper with tests updated accordingly.

Changes

Dependency Resolution Refactoring

Layer / File(s) Summary
Arguments helper and tests update
src/executorlib/standalone/interactive/arguments.py, tests/unit/standalone/interactive/test_arguments.py
get_future_objects_from_input returns only a list of futures; check_list_of_futures_is_done added to compute readiness. Tests updated to call the new helper rather than unpacking a tuple.
Scheduler imports, batched payload, and state init
src/executorlib/task_scheduler/interactive/dependency.py
Imports check_list_of_futures_is_done, includes future_lst in batched task dicts, and replaces wait_lst initialization with future_dependency_lst.
Shutdown drain and intake routing
src/executorlib/task_scheduler/interactive/dependency.py
Shutdown now repeatedly calls _handle_future_dependencies to drain the accumulator. Intake: batched tasks appended to future_dependency_lst; non-batched tasks compute readiness with check_list_of_futures_is_done and either enqueue or append (storing input futures).
Main loop handler invocation and helper impl
src/executorlib/task_scheduler/interactive/dependency.py
Main loop invokes _handle_future_dependencies when the accumulator is non-empty. _handle_future_dependencies replaces _update_waiting_task, iterates deferred tasks with a retained list, propagates exceptions, resubmits ready non-batched tasks, resolves batched tasks, and uses length comparison for stabilization.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • pyiron/executorlib#585: Related changes to future/argument helpers used by the scheduler and interactive standalone code.
  • pyiron/executorlib#1016: Modifies _execute_tasks_with_dependencies control flow in the same scheduler area.
  • pyiron/executorlib#911: Overlaps changes to the dependency-waiting loop and shutdown handling in the same file.

Poem

🐰 I gather futures in a tidy nest,
Deferred and batched, I give them rest.
A handler hops to check and run,
Resubmit, propagate — until it's done.
Hooray — no stale wait-list stress!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title '[Feature] Faster batching' is vague and does not clearly convey what specific changes improve batching performance or how the implementation achieves faster batching. Consider a more descriptive title that explains the core change, such as '[Feature] Use future dependency accumulator for faster task batching' or '[Feature] Refactor waiting queue to improve batching efficiency'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch faster_batching

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/executorlib/task_scheduler/interactive/dependency.py`:
- Around line 346-349: The loop iterating future_dependency_lst is accessing
task_wait_dict["future_lst"] unconditionally which raises KeyError for batched
tasks created by DependencyTaskScheduler.batched(); modify the loop to first
check task_wait_dict["fn"] != "batched" (or use task_wait_dict.get("future_lst")
and skip if missing) before calling get_exception_lst(future_lst=...), and only
then call task_wait_dict["future"].set_exception(exception_lst[0]) when
exceptions exist; reference the loop over future_dependency_lst, the
task_wait_dict keys ("fn", "future_lst", "future"), get_exception_lst, and
DependencyTaskScheduler.batched() when making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c8206b07-8076-408a-8f58-1db5240877fd

📥 Commits

Reviewing files that changed from the base of the PR and between 04f2983 and f98f9c4.

📒 Files selected for processing (1)
  • src/executorlib/task_scheduler/interactive/dependency.py

Comment thread src/executorlib/task_scheduler/interactive/dependency.py
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.24%. Comparing base (b62cede) to head (8fe83b5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1015      +/-   ##
==========================================
+ Coverage   94.22%   94.24%   +0.01%     
==========================================
  Files          39       39              
  Lines        2114     2119       +5     
==========================================
+ Hits         1992     1997       +5     
  Misses        122      122              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/executorlib/standalone/interactive/arguments.py (1)

14-15: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the docstring to match the new return type.

The docstring still describes the old return type (list, boolean), but the function now returns only a list of futures. The readiness check has been moved to check_list_of_futures_is_done.

📝 Proposed docstring fix
     Returns:
-        list, boolean: list of future objects and boolean flag if all future objects are already done
+        list: list of future objects found in the input arguments and keyword arguments
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/executorlib/standalone/interactive/arguments.py` around lines 14 - 15,
Update the function docstring's Returns section to reflect that it now returns
only a list of future objects (remove the boolean flag mention); specifically,
replace "list, boolean: list of future objects and boolean flag if all future
objects are already done" with a concise description like "list: list of future
objects" and note (if needed) that readiness is handled by
check_list_of_futures_is_done. Ensure this change is applied to the Returns
block in the docstring for the function in arguments.py so it matches the new
return type and references check_list_of_futures_is_done for readiness checks.
🧹 Nitpick comments (1)
src/executorlib/standalone/interactive/arguments.py (1)

35-35: ⚡ Quick win

Consider using all() for better readability and performance.

The current implementation builds a list and compares lengths, which is less idiomatic than using the built-in all() function. The all() approach is more readable and short-circuits on the first incomplete future.

♻️ Proposed refactor
-    return len([future for future in future_lst if future.done()]) == len(future_lst)
+    return all(future.done() for future in future_lst)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/executorlib/standalone/interactive/arguments.py` at line 35, Replace the
list-construction length comparison with Python's all() using a generator to
improve readability and short-circuiting: instead of building [future for future
in future_lst if future.done()] and comparing lengths, call all(future.done()
for future in future_lst) so the check over future_lst uses future.done()
directly and stops early on the first incomplete future.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/executorlib/standalone/interactive/arguments.py`:
- Around line 34-35: Add a concise docstring to the public helper function
check_list_of_futures_is_done explaining its purpose (returns True when all
futures in the given list are complete), documenting the parameter (future_lst:
list[Future]) and return value (bool), and explicitly noting the edge case that
an empty list returns True; place this docstring immediately below the def
check_list_of_futures_is_done(...) line so tools and readers can discover the
behavior.

---

Outside diff comments:
In `@src/executorlib/standalone/interactive/arguments.py`:
- Around line 14-15: Update the function docstring's Returns section to reflect
that it now returns only a list of future objects (remove the boolean flag
mention); specifically, replace "list, boolean: list of future objects and
boolean flag if all future objects are already done" with a concise description
like "list: list of future objects" and note (if needed) that readiness is
handled by check_list_of_futures_is_done. Ensure this change is applied to the
Returns block in the docstring for the function in arguments.py so it matches
the new return type and references check_list_of_futures_is_done for readiness
checks.

---

Nitpick comments:
In `@src/executorlib/standalone/interactive/arguments.py`:
- Line 35: Replace the list-construction length comparison with Python's all()
using a generator to improve readability and short-circuiting: instead of
building [future for future in future_lst if future.done()] and comparing
lengths, call all(future.done() for future in future_lst) so the check over
future_lst uses future.done() directly and stops early on the first incomplete
future.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e9ea483e-d360-4730-a76c-703759560aef

📥 Commits

Reviewing files that changed from the base of the PR and between 44fb96b and 85ea719.

📒 Files selected for processing (3)
  • src/executorlib/standalone/interactive/arguments.py
  • src/executorlib/task_scheduler/interactive/dependency.py
  • tests/unit/standalone/interactive/test_arguments.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/executorlib/task_scheduler/interactive/dependency.py

Comment thread src/executorlib/standalone/interactive/arguments.py
@jan-janssen jan-janssen merged commit ba290e1 into main Jun 11, 2026
91 of 94 checks passed
@jan-janssen jan-janssen deleted the faster_batching branch June 11, 2026 14:52
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.

2 participants