commit e280fd19492a91e5d1cf8612838764cdcb44a6e4
parent f3796b3c4ad879c278a888deda02076690a17b0c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 19 Oct 2026 11:56:11 -0400
workers: run while paused — one manual transcription on a worker the pause alone switched off
`whilePaused: true` on transcribe-file (`pnpm ops transcribe`) and transcribe-one
lets that one job's acquire lease a worker whose pause snapshot is `enabled`
(the pool is paused, the worker is disabled only by the pause). Never one
drained, degraded or disabled by hand; the snapshot is only read, so the worker
stays paused when the lease releases and resumeAll restores it as before.
Lane and batch acquires never pass the flag and stay held.
The video page's Transcribe row offers "Transcribe now (workers paused)" while
the pool is paused.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
12 files changed, 304 insertions(+), 10 deletions(-)
diff --git a/common/controller/transcribeFile.test.ts b/common/controller/transcribeFile.test.ts
@@ -552,3 +552,41 @@ test("a short file goes ahead of parked transcriptions — the lane's and a manu
// before it got it after, in their own order (manual before the lane).
assert.deepEqual(order, ["batch after the file", "lane after the file"]);
});
+
+// --- run while paused (release 36, lane A) -------------------------------------
+
+test("whilePaused is a boolean, kept only when true", () => {
+ const parsed = (b: Record<string, unknown>) => parseTranscribeFileBody({ path: MEDIA, ...b });
+ assert.match((parsed({ whilePaused: 1 }) as { error: string }).error, /"whilePaused" must be true or false/);
+ const on = parsed({ whilePaused: true });
+ assert.ok(on.ok && on.value.whilePaused === true);
+ const off = parsed({ whilePaused: false });
+ assert.ok(off.ok && !("whilePaused" in off.value));
+});
+
+test("a named worker the pause alone switched off is not refused when the request runs whilePaused", async () => {
+ const workerStates = new Map([
+ ["gpu", { state: "disabled", degraded: false }],
+ ["cpu", { state: "disabled", degraded: false }],
+ ]);
+ const pauseHeldIds = new Set(["gpu"]);
+ assert.equal(await check({ workerId: "gpu", whilePaused: true }, { workerStates, pauseHeldIds }), null);
+ assert.match((await check({ workerId: "gpu" }, { workerStates, pauseHeldIds }))!, /"gpu" is disabled/);
+ // cpu was switched off by hand: never a pause-held worker.
+ assert.match((await check({ workerId: "cpu", whilePaused: true }, { workerStates, pauseHeldIds }))!, /"cpu" is disabled/);
+});
+
+test("a paused pool runs a whilePaused file job on a pause-held worker and stays paused", async () => {
+ const pool = getWorkerPool();
+ pool.pauseAll();
+ try {
+ const run = await runJob({ path: MEDIA, workerId: "gpu", whilePaused: true });
+ assert.equal(run.status, "done", run.log);
+ assert.equal(run.result.worker.id, "gpu");
+ assert.match(run.log, /The workers are paused: this one transcription may run on a worker the pause holds/);
+ assert.ok(pool.isPaused(), "the pause stays on");
+ assert.equal(pool.summary().find((w) => w.id === "gpu")?.state, "disabled");
+ } finally {
+ pool.resumeAll();
+ }
+});
diff --git a/common/controller/transcribeFile.ts b/common/controller/transcribeFile.ts
@@ -76,6 +76,7 @@ export const TRANSCRIBE_FILE_BODY_KEYS = [
"workerId",
"out",
"words",
+ "whilePaused",
] as const;
const AUDIO_NAME = "audio.wav";
@@ -113,6 +114,10 @@ export type TranscribeFileRequest = {
// True returns the engine's word timestamps as well as the cues. Only an
// engine that keeps them (parakeet) answers with any; the rest give none.
words?: boolean;
+ // True runs it during a pause-all on a worker the pause alone switched off
+ // (release 36, lane A; the pool's acquire `whilePaused`). Outside a pause it
+ // changes nothing.
+ whilePaused?: boolean;
};
// One word as the engine timed it, on the source file's clock (seconds).
@@ -196,6 +201,10 @@ export function parseTranscribeFileBody(
if (words !== undefined && typeof words !== "boolean") {
return { ok: false, error: '"words" must be true or false' };
}
+ const whilePaused = body.whilePaused;
+ if (whilePaused !== undefined && typeof whilePaused !== "boolean") {
+ return { ok: false, error: '"whilePaused" must be true or false' };
+ }
return {
ok: true,
value: {
@@ -205,6 +214,7 @@ export function parseTranscribeFileBody(
...(typeof workerId === "string" ? { workerId: workerId.trim() } : {}),
...(typeof out === "string" ? { out: path.resolve(out) } : {}),
...(words === true ? { words: true } : {}),
+ ...(whilePaused === true ? { whilePaused: true } : {}),
},
};
}
@@ -301,6 +311,9 @@ export type TranscribeFileContext = {
// The pool's runtime view (id → state). A named worker switched off on the
// Workers page is refused rather than waited for: the wait would be forever.
workerStates?: ReadonlyMap<string, { state: string; degraded: boolean }>;
+ // The workers the pause-all ALONE switched off (the pool's pauseHeldIds): a
+ // named one is not refused when the request runs `whilePaused`.
+ pauseHeldIds?: ReadonlySet<string>;
};
export async function checkTranscribeFileRequest(
@@ -369,7 +382,8 @@ export async function checkTranscribeFileRequest(
};
}
const runtime = ctx.workerStates?.get(req.workerId);
- if (runtime && (runtime.state !== "enabled" || runtime.degraded)) {
+ const heldByPause = req.whilePaused === true && ctx.pauseHeldIds?.has(req.workerId) === true;
+ if (runtime && !heldByPause && (runtime.state !== "enabled" || runtime.degraded)) {
return {
ok: false,
error: `worker "${req.workerId}" is ${
@@ -522,6 +536,7 @@ export async function runTranscribeFile(
},
skipInlineDiarization: true,
...(req.words ? { words: true } : {}),
+ ...(req.whilePaused ? { whilePaused: true } : {}),
});
const finished = Date.now();
const worker = used.worker;
@@ -573,6 +588,7 @@ export async function enqueueTranscribeFile(
workers: settings.workers,
locations: settings.storage?.locations ?? [],
workerStates,
+ pauseHeldIds: new Set(pool.pauseHeldIds()),
});
if (!checked.ok) return checked;
const req = checked.value;
diff --git a/common/controller/transcribeOne.ts b/common/controller/transcribeOne.ts
@@ -589,6 +589,10 @@ export type TranscribeWithWorkerOptions = {
words?: boolean;
// See TranscribeOneOptions.salvage.
salvage?: boolean;
+ // RUN WHILE PAUSED (release 36, lane A): during a pause-all, this one manual
+ // transcription may take a worker the pause alone switched off (the pool's
+ // acquire `whilePaused`). Never passed by a lane or batch.
+ whilePaused?: boolean;
};
// Acquire a worker from the global pool and transcribe one video through it,
@@ -607,6 +611,9 @@ export async function transcribeWithWorker(
opts.signal && opts.drainSignal
? AbortSignal.any([opts.signal, opts.drainSignal])
: (opts.signal ?? opts.drainSignal);
+ if (opts.whilePaused && pool.isPaused()) {
+ log("The workers are paused: this one transcription may run on a worker the pause holds (whilePaused); the pause stays on.");
+ }
let lastErr: unknown;
for (let attempt = 0; attempt < MAX_WORKER_ATTEMPTS; attempt++) {
if (opts.signal?.aborted || opts.drainSignal?.aborted) throw abortError();
@@ -616,6 +623,7 @@ export async function transcribeWithWorker(
background: opts.background,
...(opts.tier ? { tier: opts.tier } : {}),
...(opts.only ? { only: opts.only } : {}),
+ ...(opts.whilePaused ? { whilePaused: true } : {}),
});
} catch (err) {
// An `only` no configured worker passes is refused at once — that is
diff --git a/common/jobs/workerPool.ts b/common/jobs/workerPool.ts
@@ -104,6 +104,9 @@ type Waiter = {
// A further restriction on WHICH worker may serve this waiter (acquire's
// opts.only). Matched alongside `requires`, never instead of it.
only?: WorkerFilter;
+ // acquire's opts.whilePaused: during a pause-all this waiter may also be
+ // served by a worker the pause alone switched off (see pauseHeld).
+ whilePaused?: boolean;
};
// Narrows an acquire to particular workers — by id, by kind — on top of the
@@ -324,13 +327,43 @@ export class WorkerPool {
return this.pausedSnapshot !== null;
}
+ // RUN WHILE PAUSED (release 36, lane A): a worker the pause-all ALONE
+ // switched off — the pool is paused, the worker is disabled, and the state
+ // the pause recorded for it is `enabled`. Such a worker may serve ONE manual
+ // acquire that asked with `whilePaused` (the video page's "Transcribe now
+ // (workers paused)", the find-clips job). Never a worker drained, degraded
+ // or turned off by hand: those record `disabled` in the snapshot (the
+ // runtime controls' syncSnapshot), or a degrade mark the eligibility check
+ // refuses on its own. The snapshot is only READ here: the lease leaves the
+ // worker `disabled`, so when it releases the worker is still paused, and
+ // resumeAll restores it exactly as before.
+ private pauseHeld(id: string, entry: PoolEntry): boolean {
+ return (
+ this.pausedSnapshot !== null &&
+ entry.state === "disabled" &&
+ this.pausedSnapshot.get(id) === "enabled"
+ );
+ }
+
+ // The ids of every worker pauseHeld would lease to a whilePaused acquire
+ // right now (busy or not) — what a refusal of a named worker asks, and what
+ // the page asks before it offers "Transcribe now (workers paused)".
+ pauseHeldIds(): string[] {
+ this.ensureInit();
+ return Array.from(this.entries.entries())
+ .filter(([id, e]) => this.pauseHeld(id, e) && !e.degraded)
+ .map(([id]) => id);
+ }
+
private eligible(
entry: PoolEntry,
requires?: readonly string[],
only?: WorkerFilter,
+ whilePaused?: boolean,
): boolean {
return (
- entry.state === "enabled" &&
+ (entry.state === "enabled" ||
+ (whilePaused === true && this.pauseHeld(entry.config.id, entry))) &&
!entry.degraded &&
!entry.busy &&
workerMatches(entry.config, requires) &&
@@ -343,10 +376,11 @@ export class WorkerPool {
private pickFree(
requires?: readonly string[],
only?: WorkerFilter,
+ whilePaused?: boolean,
): PoolEntry | null {
let best: PoolEntry | null = null;
for (const entry of this.entries.values()) {
- if (!this.eligible(entry, requires, only)) continue;
+ if (!this.eligible(entry, requires, only, whilePaused)) continue;
if (!best || entry.config.priority < best.config.priority) best = entry;
}
return best;
@@ -381,7 +415,7 @@ export class WorkerPool {
let granted = false;
for (let i = 0; i < this.waiters.length; i++) {
const waiter = this.waiters[i];
- const entry = this.pickFree(waiter.requires, waiter.only);
+ const entry = this.pickFree(waiter.requires, waiter.only, waiter.whilePaused);
if (!entry) continue;
this.waiters.splice(i, 1);
waiter.onAbort?.();
@@ -423,6 +457,9 @@ export class WorkerPool {
// caller should treat the work as unrunnable rather than wedge.
// opts.only narrows the lease further, to the workers the filter accepts (see
// WorkerFilter); a filter no configured worker passes rejects the same way.
+ // opts.whilePaused lets a MANUAL acquire run during a pause-all on a worker
+ // the pause alone switched off (see pauseHeld); outside a pause it changes
+ // nothing. Background (lane) acquires never pass it.
acquire(
signal?: AbortSignal,
opts?: {
@@ -430,6 +467,7 @@ export class WorkerPool {
background?: boolean;
requires?: readonly string[];
only?: WorkerFilter;
+ whilePaused?: boolean;
},
): Promise<Lease> {
this.ensureInit();
@@ -459,14 +497,22 @@ export class WorkerPool {
);
}
}
- const entry = this.pickFree(requires, only);
+ const whilePaused = opts?.whilePaused === true;
+ const entry = this.pickFree(requires, only, whilePaused);
if (entry && this.waiters.length === 0) {
return Promise.resolve(this.grant(entry));
}
const tier: SchedulerTier =
opts?.tier ?? (opts?.background ? "background" : "foreground");
return new Promise<Lease>((resolve, reject) => {
- const waiter: Waiter = { resolve, reject, tier, requires, only };
+ const waiter: Waiter = {
+ resolve,
+ reject,
+ tier,
+ requires,
+ only,
+ ...(whilePaused ? { whilePaused: true } : {}),
+ };
if (signal) {
const onAbort = () => {
const idx = this.waiters.indexOf(waiter);
diff --git a/common/jobs/workerPool.whilePaused.test.ts b/common/jobs/workerPool.whilePaused.test.ts
@@ -0,0 +1,141 @@
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import type { Worker } from "../lib/workers";
+import { WorkerPool, type Lease } from "./workerPool";
+
+// RUN WHILE PAUSED (release 36, lane A): a manual acquire with `whilePaused`
+// may take a worker the pause-all alone switched off — never one drained,
+// degraded or disabled by hand — and the pause's snapshot is never touched.
+//
+// Each test builds a fresh pool seeded with reconfigure(…, {applyEnabled}),
+// as workerPool.test.ts does, so settings.json is never read.
+
+function worker(id: string, priority = 0, enabled = true): Worker {
+ return { id, name: id, kind: "local", enabled, priority };
+}
+
+function snapshotOf(pool: WorkerPool): string {
+ const snap = (pool as unknown as { pausedSnapshot: Map<string, string> | null }).pausedSnapshot;
+ return JSON.stringify(snap ? [...snap.entries()] : null);
+}
+
+function stateOf(pool: WorkerPool, id: string) {
+ const w = pool.summary().find((s) => s.id === id);
+ assert.ok(w, id);
+ return { state: w.state, busy: w.busy, degraded: w.degraded };
+}
+
+// Settles a promise race: the lease if it resolved within a tick, else null.
+async function settledWithin<T>(p: Promise<T>, ms = 20): Promise<T | null> {
+ return Promise.race([p, new Promise<null>((r) => setTimeout(() => r(null), ms))]);
+}
+
+test("a paused pool + whilePaused leases a pause-disabled worker; the snapshot is untouched", async () => {
+ const pool = new WorkerPool();
+ pool.reconfigure([worker("gpu", 0), worker("cpu", 1)], { applyEnabled: true });
+ pool.pauseAll();
+ const before = snapshotOf(pool);
+ assert.deepEqual(pool.pauseHeldIds().sort(), ["cpu", "gpu"]);
+
+ const lease = (await settledWithin(pool.acquire(undefined, { whilePaused: true }))) as Lease | null;
+ assert.ok(lease, "granted at once");
+ assert.equal(lease.worker.id, "gpu", "the highest-priority pause-held worker");
+ // Still disabled by the pause while it runs: it never left the paused set.
+ assert.deepEqual(stateOf(pool, "gpu"), { state: "disabled", busy: true, degraded: false });
+ assert.equal(snapshotOf(pool), before);
+
+ lease.release();
+ assert.deepEqual(stateOf(pool, "gpu"), { state: "disabled", busy: false, degraded: false });
+ assert.equal(snapshotOf(pool), before, "byte-equal after the job");
+ assert.ok(pool.isPaused());
+
+ // And the pause lifts exactly as it would have.
+ pool.resumeAll();
+ assert.equal(stateOf(pool, "gpu").state, "enabled");
+ assert.equal(stateOf(pool, "cpu").state, "enabled");
+});
+
+test("a worker disabled by hand before the pause is never leased while paused", async () => {
+ const pool = new WorkerPool();
+ pool.reconfigure([worker("gpu", 0), worker("cpu", 1)], { applyEnabled: true });
+ pool.disableWorker("gpu"); // by hand, before the pause
+ pool.pauseAll();
+ assert.deepEqual(pool.pauseHeldIds(), ["cpu"]);
+ const lease = (await settledWithin(pool.acquire(undefined, { whilePaused: true }))) as Lease | null;
+ assert.ok(lease);
+ assert.equal(lease.worker.id, "cpu");
+ lease.release();
+});
+
+test("hand-disabled, drained or degraded workers are never leased, even with the flag", async () => {
+ const pool = new WorkerPool();
+ pool.reconfigure([worker("a", 0), worker("b", 1), worker("c", 2), worker("off", 3, false)], {
+ applyEnabled: true,
+ });
+ pool.pauseAll();
+ pool.disableWorker("a"); // by hand DURING the pause: the snapshot says disabled
+ pool.drainWorker("b"); // drained during the pause
+ pool.markDegraded("c");
+ const before = snapshotOf(pool);
+ assert.deepEqual(pool.pauseHeldIds(), [], "'off' was disabled in settings, not by the pause");
+
+ const ac = new AbortController();
+ const p = pool.acquire(ac.signal, { whilePaused: true });
+ assert.equal(await settledWithin(p), null, "parks: nothing it may take");
+ ac.abort();
+ await assert.rejects(p, { name: "AbortError" });
+ assert.equal(snapshotOf(pool), before);
+});
+
+test("without the flag a paused pool holds the acquire, as today", async () => {
+ const pool = new WorkerPool();
+ pool.reconfigure([worker("gpu", 0)], { applyEnabled: true });
+ pool.pauseAll();
+ const before = snapshotOf(pool);
+ const held = pool.acquire();
+ const heldBg = pool.acquire(undefined, { background: true });
+ assert.equal(await settledWithin(held), null);
+ assert.equal(await settledWithin(heldBg), null);
+
+ // A whilePaused acquire arriving later is served — the held ones stay parked.
+ const lease = (await settledWithin(pool.acquire(undefined, { whilePaused: true }))) as Lease | null;
+ assert.ok(lease, "the flagged acquire runs past the held ones");
+ lease.release();
+ assert.equal(await settledWithin(held), null, "still held after the flagged job ended");
+ assert.equal(await settledWithin(heldBg), null);
+ assert.equal(snapshotOf(pool), before);
+
+ // Resume releases the held ones in tier order.
+ pool.resumeAll();
+ const l1 = (await held) as Lease;
+ l1.release();
+ const l2 = (await heldBg) as Lease;
+ l2.release();
+});
+
+test("a parked whilePaused waiter takes the pause-held worker when its lease frees", async () => {
+ const pool = new WorkerPool();
+ pool.reconfigure([worker("gpu", 0)], { applyEnabled: true });
+ pool.pauseAll();
+ const first = (await pool.acquire(undefined, { whilePaused: true })) as Lease;
+ const second = pool.acquire(undefined, { whilePaused: true });
+ const bg = pool.acquire(undefined, { background: true });
+ assert.equal(await settledWithin(second), null, "one slot");
+ first.release();
+ const l2 = (await settledWithin(second)) as Lease | null;
+ assert.ok(l2, "the flagged waiter, not the background one");
+ l2.release();
+ assert.equal(await settledWithin(bg), null, "the lane stays held");
+ pool.resumeAll();
+ ((await bg) as Lease).release();
+});
+
+test("outside a pause the flag changes nothing", async () => {
+ const pool = new WorkerPool();
+ pool.reconfigure([worker("gpu", 0), worker("cpu", 1)], { applyEnabled: true });
+ pool.disableWorker("gpu");
+ assert.deepEqual(pool.pauseHeldIds(), []);
+ const lease = (await pool.acquire(undefined, { whilePaused: true })) as Lease;
+ assert.equal(lease.worker.id, "cpu", "a hand-disabled worker stays off");
+ lease.release();
+});
diff --git a/editor/app/api/ops/transcribe-one/route.ts b/editor/app/api/ops/transcribe-one/route.ts
@@ -28,13 +28,18 @@ export const dynamic = "force-dynamic";
// disk, the download reads the media URL the record stores, the way the
// platform's player does (the managed path: the audio check, the outcome
// sidecar). Absent = the channel's `storedUrlDownloads`. Not with "file".
+// "whilePaused" (release 36, lane A): true lets this one transcription run
+// during a pause-all on a worker the pause alone switched off (never one
+// drained, degraded or disabled by hand); the pause stays on. Absent or false
+// = held by the pause, as before.
export async function POST(request: Request) {
- return ops(request, ["slug", "id", "file", "salvage", "storedUrl"], async (body) => {
+ return ops(request, ["slug", "id", "file", "salvage", "storedUrl", "whilePaused"], async (body) => {
const slug = reqSlug(body, "slug");
const id = reqVideoId(body, "id");
const file = optString(body, "file");
const salvage = optBool(body, "salvage");
const storedUrl = optStoredUrlMode(body);
+ const whilePaused = optBool(body, "whilePaused") === true;
if (storedUrl !== undefined && file !== undefined) {
return opsFail(`"storedUrl" is for a download; with "file" nothing is downloaded`);
}
@@ -45,8 +50,8 @@ export async function POST(request: Request) {
}
return jobResponse(
file !== undefined
- ? await transcribeOneAction(slug, id, file, undefined, salvage)
- : await whisperVideoAction(slug, id, undefined, salvage, storedUrl),
+ ? await transcribeOneAction(slug, id, file, undefined, salvage, whilePaused)
+ : await whisperVideoAction(slug, id, undefined, salvage, storedUrl, whilePaused),
);
});
}
diff --git a/editor/app/api/ops/transcribe/route.ts b/editor/app/api/ops/transcribe/route.ts
@@ -7,7 +7,7 @@ import { jobResponse, ops } from "../_lib";
export const dynamic = "force-dynamic";
-// POST { path, start?, end?, workerId?, out? } -> { ok: true, jobId }
+// POST { path, start?, end?, workerId?, out?, words?, whilePaused? } -> { ok: true, jobId }
//
// Transcribe ONE local file — or the window [start, end) seconds of it — on a
// local transcription worker, as a job on /jobs: the engine, model and
@@ -26,6 +26,8 @@ export const dynamic = "force-dynamic";
// — a relative or unreadable `path`, `end` not after `start`, an unknown or
// non-local `workerId`, a named worker switched off, an `out` inside the corpus
// (resolved through symlinks) or in a directory that does not exist.
+// `whilePaused: true` (release 36, lane A) runs it during a pause-all on a
+// worker the pause alone switched off; the pause stays on.
export async function POST(request: Request) {
return ops(request, TRANSCRIBE_FILE_BODY_KEYS, async (body) =>
jobResponse(await enqueueTranscribeFile(body, { paths: getPaths() })),
diff --git a/editor/app/channels/[slug]/videos/[id]/components/VideoPanel.tsx b/editor/app/channels/[slug]/videos/[id]/components/VideoPanel.tsx
@@ -108,6 +108,9 @@ type Props = {
// The umtool front door, when UMTOOL_URL is set on the editor. One link:
// "open in umtool" scaffolds a report video from this exact video.
umtoolUrl?: string | null;
+ // The transcription pool is paused (getWorkerPool().isPaused(), read by the
+ // page): the Transcribe rows offer "Transcribe now (workers paused)".
+ workersPaused?: boolean;
};
export function VideoPanel({
@@ -135,6 +138,7 @@ export function VideoPanel({
umtoolUrl = null,
storedMediaHost = null,
channelStoredUrl,
+ workersPaused = false,
}: Props) {
const audioFiles = files.filter((f) => isAudioFile(f.name));
const transcodeSources = files.filter((f) => isTranscodeSource(f.name));
@@ -357,6 +361,7 @@ export function VideoPanel({
hasTranscript={hasTranscript && !autoSubsOnly}
replaceAutoSubs={autoSubsOnly}
fullAudio={fullAudioOwed}
+ workersPaused={workersPaused}
/>
))}
</div>
diff --git a/editor/app/channels/[slug]/videos/[id]/components/cards/PerFileTranscribeRow.tsx b/editor/app/channels/[slug]/videos/[id]/components/cards/PerFileTranscribeRow.tsx
@@ -19,6 +19,7 @@ export function PerFileTranscribeRow({
hasTranscript,
replaceAutoSubs = false,
fullAudio = null,
+ workersPaused = false,
}: {
slug: string;
videoId: string;
@@ -32,6 +33,10 @@ export function PerFileTranscribeRow({
// (lib/fullAudioFirst.ts). Transcribe makes them first; Salvage now makes
// the partial transcript from this file at once.
fullAudio?: FullAudioState | null;
+ // The transcription pool is paused (the pool's live state, read by the page).
+ // Release 36 lane A: "Transcribe now (workers paused)" runs this one file on
+ // a worker the pause alone switched off; the pause stays on.
+ workersPaused?: boolean;
}) {
const [transcribeQueue, setTranscribeQueue] = useState("");
// `hasTranscript` is SERVER-derived (VideoPanel, the Transcribe card) and this row's own run
@@ -103,6 +108,19 @@ export function PerFileTranscribeRow({
}
/>
)}
+ {workersPaused && !hasTranscript && (
+ <StreamActionLog
+ key="transcribe-paused-run"
+ trigger={() => {
+ setRanHere(true);
+ return transcribeOneAction(slug, videoId, file.name, transcribeQueue, undefined, true);
+ }}
+ cancelAction={cancelJobAction}
+ buttonLabel="Transcribe now (workers paused)"
+ runningLabel="Transcribing…"
+ label={`Transcribe ${file.name} while paused`}
+ />
+ )}
{fullAudio && !hasTranscript && (
<StreamActionLog
key="salvage-run"
diff --git a/editor/app/channels/[slug]/videos/[id]/page.tsx b/editor/app/channels/[slug]/videos/[id]/page.tsx
@@ -37,6 +37,7 @@ import {
queueKeyForUrl,
} from "yt-dlp-transcript-common/lib/platform";
import { getRegistry } from "yt-dlp-transcript-common/jobs/registry";
+import { getWorkerPool } from "yt-dlp-transcript-common/jobs/workerPool";
import { getSettings } from "yt-dlp-transcript-common/lib/settings";
import { resolveSourceVideoQuality } from "yt-dlp-transcript-common/ytdlp/downloadFormat";
import { liveJobRows } from "../../../../jobs/active/buildActiveJobs";
@@ -417,6 +418,7 @@ export default async function VideoDetailPage({
coverage={coverage}
storedMediaHost={storedMediaHost}
channelStoredUrl={config.storedUrlDownloads}
+ workersPaused={getWorkerPool().isPaused()}
/>
<TagsPanel view={tagsView} />
diff --git a/editor/app/channels/[slug]/videos/[id]/videoActions.ts b/editor/app/channels/[slug]/videos/[id]/videoActions.ts
@@ -207,6 +207,9 @@ export async function transcribeOneAction(
// true forces it, false forbids it, undefined leaves it automatic (a
// corrupt-full-source video is salvaged).
salvage?: boolean,
+ // Release 36 lane A: during a pause-all, run on a worker the pause alone
+ // switched off ("Transcribe now (workers paused)"; the pool's whilePaused).
+ whilePaused?: boolean,
): Promise<StreamActionResult> {
const r = await loadConfigOrError(slug);
if (!r.ok) return r;
@@ -231,6 +234,7 @@ export async function transcribeOneAction(
onLog,
signal,
...(salvage !== undefined ? { salvage } : {}),
+ ...(whilePaused ? { whilePaused: true } : {}),
});
safeRevalidate([`/channels/${slug}/videos/${videoId}`]);
},
@@ -554,6 +558,8 @@ export async function whisperVideoAction(
// outcome sidecar, the corrupt-source refetch — instead of the plain
// one-video download.
storedUrl?: StoredUrlMode,
+ // See transcribeOneAction's `whilePaused`.
+ whilePaused?: boolean,
): Promise<StreamActionResult> {
const r = await loadConfigOrError(slug);
if (!r.ok) return r;
@@ -664,6 +670,7 @@ export async function whisperVideoAction(
onLog,
signal,
...(salvage !== undefined ? { salvage } : {}),
+ ...(whilePaused ? { whilePaused: true } : {}),
});
safeRevalidate([
`/channels/${slug}/videos/${videoId}`,
diff --git a/scripts/archilyzer-ops.mjs b/scripts/archilyzer-ops.mjs
@@ -968,6 +968,9 @@ export function usage() {
' reads it — no page request with "only", the page first with "fallback" —',
' through the audio check; one new file per platform per 20 min. Absent =',
' the channel\'s storedUrlDownloads.',
+ ' "whilePaused": true runs this one transcription during a pause-all on a',
+ ' worker the pause alone switched off; the pause stays on (the video page\'s',
+ ' "Transcribe now (workers paused)").',
"",
'delete-file deletes one file of one video, as its Files list does:',
' {"slug", "id", "file"}. A tiered media file goes with its bytes on the',
@@ -1291,6 +1294,9 @@ export function usage() {
" cues: [{start, end, text}], text, ...}, cue times on the file's own clock.",
' "words": true adds words: [{w, start, end, conf?}] on the same clock -- from',
" parakeet, which keeps its word timestamps; [] from an engine that does not.",
+ ' "whilePaused": true runs it during a pause-all on a worker the pause alone',
+ " switched off (never one drained, degraded or disabled by hand); the pause",
+ " stays on.",
" With --wait it is printed on stdout (the response and the log go to",
" stderr), so `pnpm ops transcribe ... --wait | jq -r .text` works.",
"",