Skip to content

feat: add Actor.child_runs with clients for named child runs - #1151

Merged
vdusek merged 38 commits into
masterfrom
feat/child-runs-api
Oct 9, 2026
Merged

vdusek merged 38 commits into
masterfrom
feat/child-runs-api

Conversation

@vdusek

@vdusek vdusek commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Actor.child_runs is a sync property that maps each run name to a RunClientAsync for the current run under that name. It has the same shape as Actor.childRuns in the JS SDK (apify/apify-sdk-js#759). The client covers the run and its storages:

run = await Actor.child_runs['scrape-eu'].wait_for_finish()

The SDK reads the registry from the default key-value store when the Actor initializes, so runs recorded before a migration or resurrection are included and reading the property makes no API calls. That adds one record read to every init. A malformed record fails the init and leaves the Actor uninitialized. Runs started without a run_name aren't tracked. Runs that were replaced under a name stay in the history of the __ACTOR_CHILD_RUNS record and aren't exposed.

A run started or reattached with a custom token gets a client with that token. A run recorded before a migration and not reattached since gets the default client, because the token isn't stored.

It also fixes a duplicate max_items deprecation warning from #1149: a named start that resurrects its recorded run no longer warns a second time from inside the SDK.

Docs are in #1160.

Closes: #1129

✍️ Drafted by Claude Code

@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Sep 30, 2026
@vdusek vdusek self-assigned this Sep 30, 2026
@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.20%. Comparing base (95dbc7c) to head (ccaec55).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1151      +/-   ##
==========================================
+ Coverage   93.16%   93.20%   +0.03%     
==========================================
  Files          54       54              
  Lines        3702     3721      +19     
==========================================
+ Hits         3449     3468      +19     
  Misses        253      253              
Flag Coverage Δ
e2e 32.94% <24.24%> (+0.01%) ⬆️
integration 52.70% <48.48%> (+0.13%) ⬆️
unit 89.97% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek added this pull request to stack #1152 September 30, 2026 07:49
@vdusek vdusek linked an issue Sep 30, 2026 that may be closed by this pull request
@vdusek

vdusek commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

TODO:

  • Cap the number of concurrent run fetches (c80f9c1).
  • Don't let one failed fetch fail the whole call. Return that entry with run=None and log a warning (3892bb1).

Both are moot since 7d9cbab: Actor.child_runs is now a sync property that returns run clients, the same as Actor.childRuns in JS, and it doesn't fetch anything.

✍️ Drafted by Claude Code

Comment thread src/apify/_actor.py Outdated

@Mantisus Mantisus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One moment. Otherwise LGTM

Comment thread src/apify/_child_runs.py Outdated

@apify-approval-mirror apify-approval-mirror Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mirroring approval from @Mantisus.

@apify-approval-mirror apify-approval-mirror Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mirroring approval from @Mantisus.

@vdusek
vdusek requested a review from Pijukatel October 9, 2026 12:14
@vdusek vdusek changed the title feat: add Actor.child_runs() to list named child runs feat: add Actor.child_runs with clients for named child runs Oct 9, 2026
@vdusek
vdusek removed the request for review from barjin October 9, 2026 14:11
Base automatically changed from feat/named-child-runs to master October 9, 2026 14:11
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Oct 9, 2026
@vdusek
vdusek merged commit d382995 into master Oct 9, 2026
29 checks passed
@vdusek
vdusek deleted the feat/child-runs-api branch October 9, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose tracked child runs as a readable API

4 participants