Repository navigation
Conversation
…rm closes the stream `RunClient.get_streamed_log()`, `StreamedLog`, and their async counterparts take a `since` datetime and redirect only the log lines logged at that time or later. The `from_start` argument is deprecated in favour of it: `from_start=True` maps to `since=None` and `from_start=False` to `since=datetime.now(tz=UTC)`. It emits a `DeprecationWarning` and will be removed in v4, which the new v4 upgrading guide describes. The platform closes a log stream that has carried no data for several minutes, even when the run is still going (apify/apify-core#26653). A streamed log created by `get_streamed_log()` now checks the run status when its stream ends, reopens the stream if the run has not finished, and skips the replayed lines up to the last redirected one. A stream that broke off with an error gets one more reopen after the run finishes, so the last lines are not lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ocuAHA5qh4VqF6Ps7XR5p
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1253 +/- ##
==========================================
- Coverage 95.68% 91.37% -4.31%
==========================================
Files 65 65
Lines 6770 6901 +131
==========================================
- Hits 6478 6306 -172
- Misses 292 595 +303
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:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Client-side workaround for apify/apify-core#26653: the platform closes a log stream that has carried no data for about 330 s, even when the run is still going, so log redirection of a quiet run stops for good.
sinceargument.RunClient.get_streamed_log(),StreamedLog, and their async counterparts takesince: datetime | Noneand redirect only the lines logged at that time or later. A naive datetime is treated as UTC, like elsewhere in the client.from_startdeprecated. It still works and emits aDeprecationWarningthat points at the caller.from_start=Truemaps tosince=None, andfrom_start=Falsetosince=datetime.now(tz=UTC). Passing both raisesValueError. The pattern follows theactor_standby_*deprecation.get_streamed_log()now passes the run client to the streamed log. When a stream ends, the client checks the run status:sinceand the resume behaviour, the examples usesince, and a new Upgrading to v4 guide covers removingfrom_start.StreamedLogbuilt directly, withoutrun_client, behaves as before: no status checks and no reopens.Notes for review
since/lastLinesparameter on the API would remove the replay; that is a separate apify-core change.no_timeoutin Impit) on a running run now reopens the stream instead of ending the redirection. The two timeout tests were updated for that.test_actor_call_redirect_logs_to_custom_logger_asyncfailed once in the first parallel run and passed in 14 reruns since. A likely cause, not confirmed: the reopen status checks share the mock's status counter with the status message watcher. Worth watching in CI.docs/04_upgrading/and will show in the docs sidebar before v4 exists.Testing
uv run poe check-code: lint, type check, docstring check, and 2990 unit tests pass.from_startdeprecation mapping and warning locationsinceandfrom_startsinceread as UTCGenerated by Claude Code