Skip to main content

Status messages

Learn how to use custom status messages to inform users about the progress of an Actor.

Each Actor run has a status (the status field), which can be one of the following values:

READYinitialStarted but not allocated to any worker yet
RUNNINGtransitionalExecuting on a worker
SUCCEEDEDterminalFinished successfully
FAILEDterminalRun failed
TIMING-OUTtransitionalTiming out now
TIMED-OUTterminalTimed out
ABORTINGtransitionalBeing aborted by user
ABORTEDterminalAborted by user

Additionally, the Actor run has a status message (the statusMessage field), which contains a text for users informing them what the Actor is currently doing, and thus greatly improve their user experience.

Status message

When an Actor exits, the status message is either automatically set to some default text (e.g. "Actor finished with exit code 1"), or to a custom message - see exit method for details.

When the Actor is running, it should periodically update the status message as follows to keep users informed and happy. The function can be called as often as necessary, and the SDK only invokes API if the status changes. This is to simplify the usage.

import { Actor } from 'apify';

await Actor.init();

// ...
await Actor.setStatusMessage('Crawled 45 of 100 pages');

await Actor.exit();