Skip to content

[Bug] Pass max_cores to TaskSchedulerBase in OneProcessTaskScheduler - #1127

Open
chenyangsu wants to merge 1 commit into
pyiron:mainfrom
chenyangsu:fix/onetoone-max-cores
Open

chenyangsu wants to merge 1 commit into
pyiron:mainfrom
chenyangsu:fix/onetoone-max-cores

Conversation

@chenyangsu

@chenyangsu chenyangsu commented Nov 27, 2026 •

Copy link
Copy Markdown

With SingleNodeExecutor(max_cores=2, disable_dependencies=True) or OneProcessTaskScheduler(max_cores=2), submitting a task with resource_dict={"cores": 4} does not raise ValueError as DependencyTaskScheduler does. OneProcessTaskScheduler.__init__ passes executor_kwargs.get("max_cores") (None) to TaskSchedulerBase.__init__, leaving _max_cores unset so _wait_for_free_slots loops indefinitely.

Pass max_cores=max_cores directly to super().__init__ and add unit tests covering both rejection and acceptance at the max_cores limit. Happy to also validate cores * threads_per_core against max_cores in TaskSchedulerBase.submit if you prefer.

Testing: pytest tests/unit/task_scheduler/interactive/test_onetoone.py (3 passed) plus 39 unit tests (42 passed); ruff check, ruff format --check, and mypy on onetoone.py clean.

Summary by CodeRabbit

  • Bug Fixes
    • Core limits are now consistently enforced when submitting tasks. Requests that exceed the configured maximum are rejected, including when dependencies are disabled, while requests at the limit remain accepted. This helps prevent tasks from being scheduled with more cores than the available configuration permits.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

OneProcessTaskScheduler now passes its constructor’s max_cores value to TaskSchedulerBase. Tests check that requests above the limit raise ValueError, and that a request equal to the limit returns an unfinished future.

Changes: Core limit handling

Layer / File(s) Summary
Pass and verify the core limit
src/executorlib/task_scheduler/interactive/onetoone.py, tests/unit/task_scheduler/interactive/test_onetoone.py
OneProcessTaskScheduler passes its constructor’s max_cores value to TaskSchedulerBase. Tests check core-limit handling in OneProcessTaskScheduler and SingleNodeExecutor with dependencies disabled.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: Minimal · up to 59014

This change makes the one-process scheduler reject task requests that exceed the configured core limit, as the dependency scheduler already does. Tests cover requests above and at the limit. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the actual change: OneProcessTaskScheduler now passes max_cores to TaskSchedulerBase. The raw summary confirms this single change in onetoone.py, with added unit tests for the max_core…
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.
Full details: Title check

Explanation

The title names the actual change: OneProcessTaskScheduler now passes max_cores to TaskSchedulerBase. The raw summary confirms this single change in onetoone.py, with added unit tests for the max_cores limit. The title uses the bug-fix tag and identifies the affected class, so a teammate scanning history can find the primary change.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 47d0ccef-04c9-4497-9257-2cb7e4103247
Commits

Reviewing files that changed from the base of the PR and between 1b665d7 and 5901483.

Files selected for processing: 2

  • src/executorlib/task_scheduler/interactive/onetoone.py
  • tests/unit/task_scheduler/interactive/test_onetoone.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.20%. Comparing base (1b665d7) to head (5901483).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1127      +/-   ##
==========================================
+ Coverage   94.16%   94.20%   +0.04%     
==========================================
  Files          39       39              
  Lines        2210     2210              
==========================================
+ Hits         2081     2082       +1     
+ Misses        129      128       -1     

☔ 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.

This branch has not been deployed

No deployments
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.

1 participant