Repository navigation
feat: stream the run log in Actor.call_task - #1275
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1275 +/- ##
==========================================
- Coverage 93.91% 93.85% -0.06%
==========================================
Files 54 54
Lines 3893 3906 +13
==========================================
+ Hits 3656 3666 +10
- Misses 237 240 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Looking at this made me realize we will need some update to the client to properly support memoized child run redirects after migration/reboot/ressurect. I think client could be updated something like this:
This would allow each memoized child run to also remember timestamp of last redirected log and after migration it would just continue. Currently it either starts from scratch or it misses portion of the log that happened during the reboot/resurrect/migration period. |
Pijukatel
left a comment
There was a problem hiding this comment.
I think this can be merged and later improved in follow ups when client is updated as mentioned.
- `TaskClient.call` takes the same `logger` as `ActorClient.call`. The default `'default'` redirects the run's log and status messages, and `call` returns ~6 s after the run finishes. Pass `logger=None` to opt out. - If setting up log redirection fails (for example the token can't read the Actor), `call` logs a warning and still waits for and returns the run. - Merge apify/apify-sdk-python#1275 before releasing this, because `Actor.call_task` calls `task.call()` without `logger`. - JS counterpart: apify/apify-client-js#1237 --------- Co-authored-by: Claude <noreply@anthropic.com>
Actor.call_taskgets theloggerargument thatActor.callalready has. By default it redirects the log and the status messages of the task run to the log of the parent Actor.logger=Noneturns it off, and a custom logger receives the redirected lines.TaskClient.callcannot redirect the log, soActor.call_taskstarts the task withTaskClient.startand waits for the run through the run client. The start request keepstimeout='no_timeout', as inTaskClient.call.Actor.call.Actor.call.Changes for existing Actors:
'default', the same as forActor.call. So an Actor that calls a task gets the log lines of the task run in its own log.Actor.call_taskreturns about 6 seconds after the run finishes orwaitruns out, because the status message redirect of the API client waits that long for the last message.Actor.callhas the same delay. Passlogger=Noneto avoid it.The JS SDK does not redirect the log of a task run. A
loggerargument onTaskClient.callin both API clients would be the better place for this, and the SDK would then only pass it on.The PR is independent of the child runs stack (#1270 and the PRs on top of it). Both change
Actor.call_task, so the one that merges second needs a rebase.✍️ Drafted by Claude Code