const job = await api.run(wf, { autoDestroy: true });
job
.on('pending', id => console.log('[queue]', id))
.on('start', id => console.log('[start]', id))
.on('progress_pct', pct => process.stdout.write(`\rprogress ${pct}% `))
.on('preview', blob => console.log('\npreview frame bytes=', blob.size))
.on('failed', err => console.error('\nerror', err));
const result = await job.done(); // or simply: await job
I want to store the job execution results, regardless of whether the job succeeds or fails.
Since the service and ComfyUI are not on the same server, connection interruptions may occur.
After a disconnection, the job might have already completed successfully, failed, or still be running.
When reconnecting, I want to retrieve the job instance again.