Repository navigation
Studio: keep fine-tuning job pages complete when a batch starts - #16823
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
… atomically A started job's alias mapping was recorded only inside _save_alias, on a worker thread after an await, and its queue entry was removed only after that. A job listing in between showed the job under its run id next to its queued id. Record the mapping and retire the queue entry before any await, then persist. Drop the list handler's redundant live-id set, and cover the persistence window with a test.
|
Pushed 044abf1 on top of the branch:
A randomized race (real drainer and routes, concurrent |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Same-second jobs now list by job id (unslothai#16832), so the cursor tests and the queue order test expect that order instead of queue order.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…restarts (#16835) Follow-up to #16720, #16832 and #16823. When several fine-tuning jobs are created within the same second (a script submitting jobs in a loop), `GET /v1/fine_tuning/jobs` broke the `created_at` tie by the random public job id. So `jobs.list(limit=1)` could return an older job instead of the one just submitted, and the order among those jobs had nothing to do with submission order. An earlier revision of this branch fixed that with an in-process counter. That counter was lost when Studio restarted, so a client paging with `after=` across a restart could skip a job (three same-second jobs, page 1 before a restart, page 2 after: `ftjob_qa` never returned). Jobs now get a nanosecond creation stamp when they are queued (kept strictly increasing, since Windows clocks can tick only every ~16 ms). It is saved with the job id mapping in the alias table, in a new nullable `created_ns` column, and loaded back on start. Same-second jobs are ordered by that stamp, then by public id, so a job keeps its place from queued to running to history, and across restarts. Older alias tables gain the column the first time they are opened. Jobs the API starts directly, without queueing, get a stamp too: it is saved under their usual public id, and their `created_at` still comes from the run. Rows without a stamp (runs started from the Studio UI, jobs from older builds) keep the public id order. Older builds name their columns explicitly when they read and write this table, so a downgrade still works. Verification: - `test_a_job_batched_past_keeps_its_place_when_it_starts_between_pages` now also runs across a simulated restart and asserts submission order when jobs share a second. On main, the 3 same-second cells fail and the 3 others pass. Here, all 6 pass. - New `test_an_alias_table_from_an_older_build_loads_and_gains_the_ns_column`: an alias table from an older build loads, gains the column, and saves new stamps. - New `test_jobs_created_within_one_clock_tick_list_newest_submitted_first`: with a frozen clock, jobs still list newest submitted first (fails without the strictly increasing stamp). - New `test_a_job_started_directly_lists_ahead_of_an_older_same_second_job`: a queued job is cancelled and a replacement starts directly in the same second. The replacement lists first, before and after a restart. - Three tests computed their expected order from the random job id tie break. They now expect newest submitted first. - `test_openai_fine_tuning.py`: 125 passed. `test_training_api_snippet_contract.py` + `tests/multi_account` (fine-tuning/training selection): 129 passed.
When a Multi-LoRA batch started while a fine-tuning list request was in flight, a client paging with
after=set to one of that batch's job IDs could get back an empty page withhas_morefalse, or a page that silently skipped another job of the same batch. Those jobs had left the queue but were not yet in the live status or the run history, so the cursor matched nothing, or matched and jumped straight to older history.The list now remembers the queue as it was when the request began. A job that started during the request still matches its cursor and is listed once, as its run when it already has one and as it was queued otherwise.
Fixes #16719