Skip to content

[AOT] Add resilient parallel job scheduler - #1038

Open
zhiding512 wants to merge 11 commits into
mainfrom
zhimding/jobs_parallel_0819
Open

[AOT] Add resilient parallel job scheduler#1038
zhiding512 wants to merge 11 commits into
mainfrom
zhimding/jobs_parallel_0819

Conversation

@zhiding512

Copy link
Copy Markdown
Collaborator

Summary

  • add a reusable fork-based AOT scheduler with worker, memory, timeout, and retry controls
  • prevent OOM retry storms through declared memory-cap dependencies, adaptive concurrency backoff, and FIFO retries
  • preserve structured failure diagnostics and cover scheduler behavior with backend-agnostic unit tests

Test plan

  • python -m pytest --confcutdir=tests/unit tests/unit/test_parallel_jobs.py -q (24 passed)
  • Black formatting on changed Python files
  • Ruff formatting and lint checks on changed Python files

Made with Cursor

zhiding512 and others added 4 commits August 19, 2026 05:28
Centralize fork-based AOT job orchestration and environment controls so downstream integrations no longer maintain their own process pools.

Co-authored-by: Cursor <cursoragent@cursor.com>
Rename the helper for clearer call sites, keep the package version unchanged, and strengthen failure and environment-control coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
Make memory limiting fail safe, back off after possible OOM kills, and preserve structured failure causes so large AOT builds remain diagnosable.

Co-authored-by: Cursor <cursoragent@cursor.com>
Align automatic worker semantics, queue retries fairly behind pending jobs, and route precise scheduler diagnostics through the FlyDSL logger.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings August 20, 2026 00:51

Copilot AI 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.

Pull request overview

This PR introduces a reusable, fork-based parallel job scheduler for AOT compilation, adds environment-variable configuration for worker/memory/timeout/retry behavior, and documents the new knobs and failure semantics.

Changes:

  • Added flydsl.utils.parallel.run_parallel_jobs implementing a forked worker pool with per-job timeouts, retry logic, adaptive concurrency backoff on possible OOM exits, and structured JSON failure results.
  • Added backend-agnostic unit tests covering ordering, bounded concurrency, retry FIFO behavior, timeout killing, and failure categorization.
  • Added AOT env options (FLYDSL_AOT_*), documented them in tests/README.md, and added psutil as a dependency to support automatic memory-based worker limiting.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
python/flydsl/utils/parallel.py New fork-based parallel scheduler with file-based result transport, retries/timeouts, and structured failure reporting.
python/flydsl/utils/env.py Adds AOT environment manager/options and introduces OptFloat via refactoring numeric env parsing.
tests/unit/test_parallel_jobs.py New unit tests validating scheduler behavior across success, crash/signal/timeout, retries, and logging.
tests/README.md Documents new AOT environment variables and scheduler failure/result semantics.
requirements.txt Adds psutil dependency used for automatic memory-based worker limiting.
MANIFEST.in Ensures requirements.txt is included in source distributions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +277 to +283
workers = OptInt(
0,
description=(
"Maximum concurrent worker processes; unset, empty, or non-positive values use the CPU and "
"available-memory based automatic limit"
),
)
zhiding512 and others added 7 commits August 20, 2026 01:02
Avoid adding a package-wide runtime dependency while retaining explicit guidance for automatic AOT memory limiting.

Co-authored-by: Cursor <cursoragent@cursor.com>
Trust atomically committed results, bound exception diagnostics, and make OOM/timeout backoff generation-aware with additive recovery.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep same-wave OOM siblings retryable, recover from all healthy completions, leave timeouts concurrency-neutral, and allow AOT to continue without psutil.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep retries concurrency-neutral, use explicit success accounting, and fall back to a conservative four-worker limit when memory information is unavailable.

Co-authored-by: Cursor <cursoragent@cursor.com>
Localize malformed worker payloads, validate summaries before logging, clarify fork constraints, and add exact boundary and retry-exhaustion tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Remove lower-priority and overlapping cases while retaining the 19 tests that protect correctness, failure isolation, and memory safety.

Co-authored-by: Cursor <cursoragent@cursor.com>
Make the typed environment option return its default for empty numeric values so scheduler semantics match the documented contract directly.

Co-authored-by: Cursor <cursoragent@cursor.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.

2 participants