如何找到 apify 任务的完成状态 运行

How to find the completion status of apify task run

如何找到 apify 任务的完成状态(成功、失败或中止)运行?

const crawler = new PhantomCrawler({
        input,
        requestQueue,
        dataset,
    });

    await crawler.run();

或者如果您有

"actorId": ${JSON.stringify(process.env.APIFY_ACTOR_ID || null)},
"taskId": ${JSON.stringify(process.env.APIFY_ACTOR_TASK_ID || null)},
"runId": ${JSON.stringify(process.env.APIFY_ACTOR_RUN_ID || null)},

我在 SDK 中看不到任何参考或 API

https://sdk.apify.com/docs/api/apify

https://docs.apify.com/api/v2#/reference/actors/actor-object/run-task

每个 运行(参与者或任务)都有其 status which you can get if you send the API call the GET run 端点。当您调用参与者或任务时,您会得到此 运行 信息及其状态。

里面的代码不需要知道自己的状态,因为如果代码可以要求它,任务或参与者当然处于"RUNNING"状态。