docs: add status message section to Actor lifecycle page#586
docs: add status message section to Actor lifecycle page#586
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
|
||
| [Status messages](/platform/actors/development/programming-interface/status-messages) are lightweight, human-readable progress indicators displayed with the Actor run in the Apify Console (separate from logs). Use them to communicate high-level phases or milestones, such as "Fetching list", "Processed 120/500 pages", or "Uploading results". | ||
|
|
||
| Update the status only when the user's understanding of progress changes - avoid frequent updates for every processed item. Detailed information should go to logs or storages (Dataset, Key-value store) instead. |
There was a problem hiding this comment.
nit: the example code is showing exactly this :)
|
|
||
| <CodeBlock language="js">{StatusMessageSource}</CodeBlock> | ||
|
|
||
| The SDK only sends an API request when the message text changes, so repeating the same message incurs no additional cost. |
There was a problem hiding this comment.
The SDK only sends an API request when the message text changes
I don't think this is true. We need to send the request every time, as somebody else might have updated the message in the meantime.
There was a problem hiding this comment.
Is this valid also for Python SDK? I based my prose on Python SDK section about Status Messages so it might also be wrong for Python SDK?
There was a problem hiding this comment.
You're right, in Python SDK, the set_status_message() calls self.apify_client.run(...).update(status_message=...) every time and the sentence "The SDK only sends an API request when the message text changes" is wrong.
PR fixing it -> apify/apify-sdk-python#859
|
|
||
| ## Status messages | ||
|
|
||
| [Status messages](/platform/actors/development/programming-interface/status-messages) are lightweight, human-readable progress indicators displayed with the Actor run in the Apify Console (separate from logs). Use them to communicate high-level phases or milestones, such as "Fetching list", "Processed 120/500 pages", or "Uploading results". |
There was a problem hiding this comment.
(separate from logs)
technically half-true, setting the status message with SDK actually logs the status message.
Lines 1095 to 1100 in 2c522d1
There was a problem hiding this comment.
Is this valid also for Python SDK? I based my prose on Python SDK section about Status Messages so it might also be wrong for Python SDK?
There was a problem hiding this comment.
It seems that Python logs the status message only when running locally, i.e., not on the platform. So it does make a little more sense for Python (it's not really that big of a deal for JS anyway).
There was a problem hiding this comment.
Yeah, I remember discussing this 1-2 years ago. And you are right. The status message should appear in the console with Actor runs, while locally it should be written to the logs (since there's no console to render it, hah).
B4nan
left a comment
There was a problem hiding this comment.
lets also make those changes in the last docs snapshot
https://github.com/apify/apify-sdk-js/tree/master/website/versioned_docs/version-3.4/02_concepts
- Remove the incorrect claim that the SDK deduplicates status message API calls (it doesn't — `set_status_message()` always calls the API) - Replace the misleading "(separate from logs)" note with accurate behavior: when running locally, the SDK logs the status message instead of sending it to the platform - Apply the same fix to the versioned docs snapshot - Context: flagged during review of apify/apify-sdk-js#586 by @barjin
I was going through apify-docs issues and noticed apify/apify-docs#400.
This PR adds similar section as is already in Python docs & creates a new codeblock demonstrating the functionality.