* feat(history): normalize bounded execution evidence (#209) * fix(history): bound lifecycle kind checks before hashing (#209) * feat(history): persist execution attempts with restore fencing (#209) * test(api): bootstrap standalone backup restore fixtures (#209) * feat(history): isolate bounded asynchronous ledger writes (#209) * feat(history): observe actual queue attempts without altering execution (#209) * fix(database): honor package-scoped configuration (#211) * test(history): exercise real cached and headless executions (#209) * fix(history): reject unsupported uniqueness and isolate package fixtures (#209) * test(history): support Python 3.10 package fixture cleanup (#209)
44 lines
2.2 KiB
JavaScript
44 lines
2.2 KiB
JavaScript
import { writeFile } from 'node:fs/promises';
|
|
import { join, resolve } from 'node:path';
|
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
import { launchComfyHost as launchSharedHost } from '@comfyassets/toolkit/testing/host';
|
|
import runtime from './comfyui-runtime.json' with { type: 'json' };
|
|
|
|
export { launchSharedHost };
|
|
|
|
const repositoryRoot = fileURLToPath(new URL('../../', import.meta.url));
|
|
|
|
export async function preparePromptManagerPlugin({ installed, stateDirectory }) {
|
|
const configPath = join(installed, 'config.json');
|
|
await writeFile(configPath, JSON.stringify({
|
|
database: { default_path: join(stateDirectory, 'prompts.db') },
|
|
gallery: { monitoring: { enabled: false, directories: [join(stateDirectory, 'output')] } },
|
|
web_ui: { result_timeout: 0 },
|
|
}), { mode: 0o600 });
|
|
return { PROMPT_MANAGER_CONFIG_PATH: configPath, PROMPT_MANAGER_EXTRA_GALLERY_ROOTS: '' };
|
|
}
|
|
|
|
export function launchComfyHost({ checkout, repository = repositoryRoot,
|
|
python = process.env.PM_TEST_PYTHON || 'python', port = 8189, pins = runtime,
|
|
logPath = join(repositoryRoot, 'tools/vendor/test-results/comfyui-host.log'), forwardOutput = true }) {
|
|
return launchSharedHost({ checkout, repository, python, port, pins, logPath, forwardOutput,
|
|
pluginName: 'promptmanager',
|
|
preparePlugin: preparePromptManagerPlugin,
|
|
});
|
|
}
|
|
|
|
if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
|
|
try {
|
|
const host = await launchComfyHost({ checkout: process.env.PM_COMFY_ROOT,
|
|
port: Number(process.env.PM_COMFY_PORT || 8189) });
|
|
const stop = () => { host.stop().catch(error => { console.error(error.message); process.exitCode = 1; }); };
|
|
process.once('SIGINT', stop);
|
|
process.once('SIGTERM', stop);
|
|
const result = await host.finished;
|
|
process.removeListener('SIGINT', stop);
|
|
process.removeListener('SIGTERM', stop);
|
|
if (result.code) console.error(`ComfyUI host exited with status ${result.code}; see tools/vendor/test-results/comfyui-host.log`);
|
|
process.exitCode = result.code;
|
|
} catch (error) { console.error(error.message); process.exitCode = 1; }
|
|
}
|