Skip to content

fix local queue processing after enqueue - #2880

Merged
bghira merged 1 commit into
agent/local-gpu-incomplete-queue-preferencesfrom
agent/local-queue-process-after-enqueue
Jul 23, 2026
Merged

fix local queue processing after enqueue#2880
bghira merged 1 commit into
agent/local-gpu-incomplete-queue-preferencesfrom
agent/local-queue-process-after-enqueue

Conversation

@bghira

@bghira bghira commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Ports the queue-start portion of whitejt2/SimpleTuner@afc7319 as a focused follow-up to #2877.

After #2877, an incomplete queued GPU preference is no longer persisted as a hard pin. However, the submit path can still return a queued result and wait for a later release/callback to process the pending job. This change kicks the local GPU allocator immediately after non-approval local jobs are queued, so jobs that became startable during queue normalization can start without waiting for unrelated queue activity.

Approval-held jobs intentionally do not process pending jobs.

Validation

  • .venv/bin/python -m unittest tests.test_training_service_gpu tests.test_local_gpu_allocator -v

Notes

The original fork commit also changed checkpoint replacement behavior, validation adapter deletion, and one-based GPU normalization. Those pieces were not included here: checkpoint destination deletion needs a separate data-loss review, validation cleanup is partially superseded by current main, and the current WebUI submits detected device.index values rather than one-based IDs.

Stack

@bghira
bghira marked this pull request as ready for review July 23, 2026 14:14
@bghira
bghira requested a review from Copilot July 23, 2026 14:14

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 ensures locally-queued training jobs can start immediately after being enqueued (when queue normalization makes them startable), by kicking the local GPU allocator right after enqueue for non-approval jobs. It also adds unit coverage to verify the allocator kick happens for normal queued jobs but not for approval-held jobs.

Changes:

  • Invoke pending-local-job processing immediately after enqueue for non-approval local jobs.
  • Add _process_pending_local_jobs() helper to trigger the local allocator.
  • Add unit tests asserting pending-job processing is triggered (or intentionally not triggered) after queueing.

Reviewed changes

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

File Description
simpletuner/simpletuner_sdk/server/services/training_service.py Calls into a new helper after enqueue to kick local pending-job processing (skipped for approval-held jobs).
tests/test_training_service_gpu.py Adds tests covering the new “kick allocator after enqueue” behavior for queued vs approval-held jobs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1555 to +1573
def _process_pending_local_jobs() -> None:
"""Kick the local GPU allocator after a local job is queued."""
import asyncio

from .local_gpu_allocator import get_gpu_allocator

async def _async_process():
started = await get_gpu_allocator().process_pending_jobs()
if started:
logger.info("Started %d pending local job(s): %s", len(started), started)

try:
asyncio.get_running_loop()
import concurrent.futures

with concurrent.futures.ThreadPoolExecutor() as pool:
pool.submit(lambda: asyncio.run(_async_process()))
except RuntimeError:
asyncio.run(_async_process())
@bghira
bghira force-pushed the agent/local-queue-process-after-enqueue branch from c86b419 to 258954e Compare July 23, 2026 14:26
@bghira
bghira merged commit 237d7c5 into agent/local-gpu-incomplete-queue-preferences Jul 23, 2026
@bghira
bghira deleted the agent/local-queue-process-after-enqueue branch July 23, 2026 14:26
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