Restore automatic video batch continuation and prepare stable Comfy loading
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { stableMemoryArgs } from '../scripts/comfy-memory-policy.mjs'
|
||||
|
||||
test('Windows uses the supported non-dynamic loader without changing workflow or precision flags', () => {
|
||||
const args = ['main.py', '--enable-dynamic-vram', '--fast-disk', '--enable-manager', '--fp16-vae']
|
||||
assert.deepEqual(stableMemoryArgs(args, { platform: 'win32', cliSource: '--disable-dynamic-vram', dynamicVram: 'false' }), ['main.py', '--enable-manager', '--fp16-vae', '--disable-dynamic-vram'])
|
||||
assert.deepEqual(stableMemoryArgs(args, { platform: 'win32', cliSource: '' }), args)
|
||||
assert.deepEqual(stableMemoryArgs(args, { platform: 'linux', cliSource: '--disable-dynamic-vram' }), args)
|
||||
assert.deepEqual(stableMemoryArgs(args, { platform: 'win32', cliSource: '--disable-dynamic-vram', dynamicVram: 'true' }), args)
|
||||
})
|
||||
@@ -18,7 +18,7 @@ const compiled = ts.transpileModule(source, {
|
||||
|
||||
// Execute the real queue module against temporary stores and a fake GPU.
|
||||
// No production library, network, Comfy process, or render is touched.
|
||||
function fixture({ rows = [], lives = [], queue = { running: 0, pending: 0 }, history = {} } = {}) {
|
||||
function fixture({ rows = [], lives = [], queue = { running: 0, pending: 0 }, history = {}, shotQueues = [] } = {}) {
|
||||
const root = mkdtempSync(join(tmpdir(), 'aigen-queue-test-'))
|
||||
const owner = 'test-owner'
|
||||
mkdirSync(join(root, 'users', owner), { recursive: true })
|
||||
@@ -39,7 +39,9 @@ function fixture({ rows = [], lives = [], queue = { running: 0, pending: 0 }, hi
|
||||
patchPendingJob: () => {}, deletePendingJob: () => {}
|
||||
},
|
||||
'~/server/utils/shotQueue': {
|
||||
getShotQueue: () => null, pendingSegmentCount: () => 0
|
||||
getShotQueue: (_owner, id) => shotQueues.find(q => q.id === id), pendingSegmentCount: queue => queue?.pendingCount || 0,
|
||||
isShotQueueCancelled: () => false, listShotQueues: () => shotQueues,
|
||||
setShotQueuePause: async (_owner, id, pause) => { const q = shotQueues.find(q => q.id === id); if (q) { q.stopAfterCurrent = pause; q.autoRun = !pause } }, pauseShotQueue: async () => {}
|
||||
},
|
||||
'~/server/utils/comfy': { fetchLiveQueue: async () => queue, fetchHistory: async () => {
|
||||
if (history instanceof Error) throw history
|
||||
@@ -55,6 +57,7 @@ function fixture({ rows = [], lives = [], queue = { running: 0, pending: 0 }, hi
|
||||
'~/utils/imageV2': { imageV2StackSpecials: () => ({}) },
|
||||
'~/utils/globalLocks': { allowIdentityRefs: () => false },
|
||||
'~/server/utils/generationLog': { updateGenerationLogByStudioJob: async () => {} },
|
||||
'~/server/utils/videoChain': { startQueueBurst: async (_owner, id, count) => { started.push({ id, count }); return { jobId: 'resumed-video' } } },
|
||||
'~/server/utils/musicChain': {
|
||||
startMusicJob: async () => {
|
||||
const live = liveJob(`started-${started.length}`, 'music')
|
||||
@@ -191,3 +194,20 @@ for (const history of [new Error('history timed out'), null]) {
|
||||
assert.equal(f.started.length, 0)
|
||||
})
|
||||
}
|
||||
|
||||
test('Resume a manually held video batch runs all remaining shots instead of one', async () => {
|
||||
const item = { ...row('paused-video', 'held', undefined), kind: 'video', shotQueueId: 'shots', pausedByUser: true, payload: { prompt: 'video', queueAutoRun: false, extensions: [] } }
|
||||
const shots = { id: 'shots', autoRun: false, stopAfterCurrent: true, pendingCount: 9, status: 'paused' }
|
||||
const f = fixture({ rows: [item], shotQueues: [shots] })
|
||||
await f.api.toggleStudioQueuePause('test-owner', { jobId: item.id, resume: true })
|
||||
assert.deepEqual(f.started, [{ id: 'shots', count: 'all' }])
|
||||
assert.equal(f.rows()[0].payload.queueAutoRun, true)
|
||||
assert.equal(shots.autoRun, true)
|
||||
})
|
||||
test('explicit bounded burst clears an earlier run-all policy', async () => {
|
||||
const item = { ...row('bounded', 'held', undefined), kind: 'video', shotQueueId: 'shots', resumeAutoRun: true, payload: { prompt: 'video', queueAutoRun: true, extensions: [] } }
|
||||
const f = fixture({ rows: [item], shotQueues: [{ id: 'shots', autoRun: false, pendingCount: 9 }] })
|
||||
await f.api.onStudioQueueBurstStarted('test-owner', 'shots', 'one-shot-live')
|
||||
assert.equal(f.rows()[0].resumeAutoRun, false)
|
||||
assert.equal(f.rows()[0].payload.queueAutoRun, false)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user