Nodes/ComfyUI-nkxx/2. Sora2 异步查询状态 (Grsai)
ComfyUI Node

2. Sora2 异步查询状态 (Grsai)

'is my video done yet?' — the report card

By nkxx188·Created 11 months ago·Updated 6 months ago· 14
2. Sora2 异步查询状态 (Grsai)
    • report
    api_key

    Middle child of the Sora2 async pipeline, and it does one thing well: look at every task in the pack's local database, ask the Grsai API what's happening, update the statuses, and print a report. You run it after Sora2SubmitAndRecordTask_Grsai (or the batch version) and before Sora2GetNextVideo_Grsai. It's the "刷新" button for your video queue.

    Inputs: just an optional api_key (blank = pack-wide Grsai key). No prompts, no sliders, no way to break it.

    Output: report, a STRING with a header ("--- 任务队列总览 ---"), one line per task (task ID prefix, status, progress for running jobs, PID once succeeded, and the first 25 chars of the prompt), and a footer with your remaining credit balance. Statuses come through as pending, running N%, succeeded, failed, downloaded, or download_failed.

    Mechanically it's a poller with a memory: it reads data/sora2_task_history.json, hits /v1/draw/result for every task that isn't in a terminal state, and writes the fresh status back into the database. When a task flips to succeeded it also stores the video URL and PID in the record - that's what makes step 3 possible without you ever copying a link by hand. Tasks already marked downloaded/failed are skipped, so re-running it is cheap and idempotent.

    The IS_CHANGED forced re-execution means every graph run is a fresh poll - the intended rhythm is: queue this node, wait, queue it again until you see succeeded/待下载, then run step 3. Some people wire it into a loop; most people just hit Queue a few times.

    Install is pack-wide:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jieg9341-lab/ComfyUI-nkxx
    

    Restart (first boot auto-installs requests, pandas, yt-dlp, etc.). Grsai key from nkxx.grsai.ai - without it the node returns "API Key 不能为空" instead of a report.

    Grounded gotchas:

    • It doesn't download anything. If your status says succeeded and no video ever appears, that's expected - step 3 does the download. This node only refreshes and reports.
    • Failed tasks show their failure_reason in the record, but the summary line just says failed; dig into the database file (data/sora2_task_history.json) if you need the why.
    • The report sorts newest-first, so the task you care about is usually near the top - but the line only shows the task ID prefix plus prompt snippet, so a wall of near-identical prompts can be confusing. The pid (once present) helps tell them apart.
    • Every poll of a still-running task is a tiny API call; polling 50 in a batch is 50 calls. Harmless on credits, but if you see rate-limit-ish errors, slow down your queue cadence.
    CategoryNkxx/Grsai/视频 (异步)

    Inputs (1)

    NameTypeDefaultDescription
    api_keyoptSTRING

    Outputs (1)

    NameTypeDescription
    reportSTRING