Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1149 +/- ##
===========================================
+ Coverage 53.03% 93.12% +40.09%
===========================================
Files 53 54 +1
Lines 3560 3665 +105
===========================================
+ Hits 1888 3413 +1525
+ Misses 1672 252 -1420
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:
|
82366a3 to
8e76335
Compare
|
TODO:
Both need master merged into the stack first. ✍️ Drafted by Claude Code |
| run_client = client.run(record.run_id) | ||
| run = await run_client.get() |
There was a problem hiding this comment.
_wait_for_child_run waits on client.run(...) through wait_for_finish(), which tolerates 404s for a few seconds after a run starts. Here we use a bare get(), and a 404 from it starts a new run. Is that on purpose?
| self._load_lock = asyncio.Lock() | ||
| self._write_lock = asyncio.Lock() |
There was a problem hiding this comment.
Can't we use only one for both operations? 🙂
| self._records: dict[str, ChildRunRecord] | None = None | ||
| self._load_lock = asyncio.Lock() | ||
| self._write_lock = asyncio.Lock() | ||
| self._name_locks: defaultdict[str, asyncio.Lock] = defaultdict(asyncio.Lock) |
There was a problem hiding this comment.
We can use WeakValueDictionary here
Actor.start,Actor.callandActor.call_taskaccept an optionalrun_name. The SDK writes the name, the Actor or task ID and the run ID to the default key-value store (APIFY_CHILD_RUNS) right after the child starts. After a migration or resurrection of the parent, the same call finds the recorded run and reuses it:READY/RUNNING: reattaches to itSUCCEEDED: returns it as isABORTED/TIMED-OUT: resurrects it (anABORTING/TIMING-OUTrun is waited for first)FAILED, or the run no longer exists: starts a new run and keeps the old ID inpreviousRunIdsA named
callon a reattached or resurrected run streams only new log lines. Reusing a name for a different Actor or task raisesValueError, and concurrent calls under one name in the same process share a single run.A hard kill between the platform starting the child and the registry write can still orphan the child. Closing that gap needs an idempotency key on the run-start endpoint.
Closes: #1127
✍️ Drafted by Claude Code