Skip to content

feat: add Actor.child_runs() to list named child runs - #1151

Open
vdusek wants to merge 10 commits into
feat/named-child-runsfrom
feat/child-runs-api
Open

vdusek wants to merge 10 commits into
feat/named-child-runsfrom
feat/child-runs-api

Conversation

@vdusek

@vdusek vdusek commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1149. Review and merge that one first.

Actor.child_runs() returns the named child runs of the current Actor run, keyed by name. Each ChildRunInfo has the run_id, the run as the API returns it at call time, and history: the earlier runs under that name that failed or went missing and were replaced, as ChildRunSnapshot entries. run is None when the platform no longer has the run or the fetch failed. A failed fetch also logs a warning. Runs started without a run_name aren't tracked, so they aren't listed.

Every call fetches the runs again, at most 10 at a time. Nothing is cached, so the result is a snapshot. A run started with a custom token is fetched with that token. After a migration the token is gone and the default client is used. The issue leaves a status callback out of scope, so there isn't one. A caller who wants progress reporting can poll child_runs().

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 (c9856b0) to head (3892bb1).

Additional details and impacted files
@@                    Coverage Diff                    @@
##           feat/named-child-runs    #1151      +/-   ##
=========================================================
+ Coverage                  93.17%   93.20%   +0.03%     
=========================================================
  Files                         54       54              
  Lines                       3690     3723      +33     
=========================================================
+ Hits                        3438     3470      +32     
- Misses                       252      253       +1     
Flag Coverage Δ
e2e 33.25% <61.76%> (?)
integration 52.78% <61.76%> (+0.04%) ⬆️
unit 89.98% <100.00%> (+0.08%) ⬆️

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 for child_runs():

  • Cap the number of concurrent run fetches (e.g. 10-20). It's an unbounded asyncio.gather now, so hundreds of named children mean hundreds of simultaneous GETs.
  • Don't let one failed fetch fail the whole call. Return that entry with run=None and log a warning, as counting toward the concurrency limit already does (return_exceptions=True).

✍️ Drafted by Claude Code

Comment thread src/apify/_actor.py Outdated
Comment on lines +1233 to +1238
async def child_runs(self) -> dict[str, ChildRunInfo]:
"""Get the named child runs of this Actor run, with their current state.

Every run started by `Actor.start`, `Actor.call` or `Actor.call_task` with a `run_name` is included, even one
started before a migration or resurrection of this Actor run. Runs started without a `run_name` are not
tracked. Each run is fetched from the API when this method is called, so the result is a snapshot.

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.

Actor.start, Actor.call and Actor.call_task accept a token, but child_runs() fetches every run with the default client. Is a run started with a different token supposed to be supported here?

This branch has not been deployed

No deployments
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose tracked child runs as a readable API

3 participants