0

您如何找到 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

4

1 回答 1

1

如果您将 API 调用发送到GET 运行端点,则每次运行(参与者或任务)都有其状态。当你调用一个演员或任务时,你会得到这个运行信息及其状态。

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

于 2020-01-03T09:06:51.543 回答