Skip to content

Abort child runs when the parent is gracefully aborted #1128

Description

@vdusek

When a parent Actor is aborted, its child runs keep going and bill against the account until they
finish on their own. There is no way to take them down with the parent.

Depends on #1127. The abort needs to know which children to abort, and after a migration only a
persisted registry still knows.

Proposal

Opt-in, off by default:

run = await Actor.start('apify/web-scraper', run_input, name='scrape-eu', abort_with_parent=True)

On Event.ABORTING the SDK aborts every tracked child run that is still active. It stays off by
default because aborting a child throws away its work, which is the caller's call to make.

This is best-effort by nature. It covers a graceful abort, where the parent is given time to run its
listeners. A hard abort, a run timeout or an OOM kill orphans the children regardless, and the fix
for that case is a parent/child link on the platform side.

Prior art

apify-orchestrator, as abortAllRunsOnGracefulAbort:

✍️ Drafted by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request.t-toolingIssues with this label are in the ownership of the tooling team.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions