Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1249 +/- ##
==========================================
+ Coverage 93.93% 93.95% +0.01%
==========================================
Files 54 54
Lines 3828 3836 +8
==========================================
+ Hits 3596 3604 +8
Misses 232 232
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:
|
Actor.child_runsrun_name
run_namerun_name
…s into `checksum`
run_namerun_name
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.
TLDR
run_nameare now recorded in the default KVS too, next to the named ones under__ACTOR_CHILD_RUNS.Actor.child_runs, and they are reused like named runs.abort_with_parentstill requiresrun_namehere, fix: improveabort_with_parenthandling of child runs #1250 lifts that.Implicit keys for child runs without a name
checksum.checksumis a SHA-256 hash of the Actor or task ID, the input and the run options.content_type,build,max_items,max_total_charge_usd,restart_on_error,memory_mbytes,timeout,force_permission_levelandwebhooks.Noneare left out, so a new option added later does not change existing hashes.token,wait,loggerandabort_with_parentare not hashed.What a call does
Actor.start,Actor.call,Actor.start_taskandActor.call_taskalike.run_name, or under the implicit key without one, and fetches the recorded run from the API. Then, by the state of the recorded run:READYorRUNNINGSUCCEEDEDABORTINGorTIMING-OUTABORTEDorTIMED-OUT, then resurrects it.ABORTEDorTIMED-OUTbuild,memory_mbytes,timeout,max_items,max_total_charge_usdandrestart_on_error.FAILEDActor.startandActor.start_taskthen return the run right away.Actor.callandActor.call_taskwait for it to finish, except for aSUCCEEDEDrun, which they return at once.READYtoTIMED-OUT), itschecksummust match the call. If it does not, the call raises aValueErrorand nothing starts. Only a named call can hit this, since the implicit key comes from the checksum.Changes in behavior
Compared to 4.2.x:
run_nameis recorded in the default KVS and shows up inActor.child_runsunder its implicit key. Before, it was not recorded at all.run_namereturns the first run, both within one attempt and after a migration or resurrection. Before, each call started a new run. To start a new run for an identical call, for example when polling, pass arun_namethat differs between the calls, such asf'check-{hour}'.Actor.callandActor.call_taskwithout arun_namestart the run and wait for it in the SDK, the same way a named call does. Before, they used the API'scallendpoint.run_namewith different options, for example anothermemory_mbytes, raises aValueError, the same as reusing it with a different Actor or input. The error message now reads "...was already used for a different Actor, task, input or run options."runNamefield and no longer storesstartedAtandhistory. AFAILEDor missing run is still replaced, but the replaced run is not kept in the record. Records written by 4.2.x still load.Record
{ "scrape-eu": { "runId": "HG7ML7M8z78YcAPEB", "status": "RUNNING", "runName": "scrape-eu", "checksum": "60c83d9047178e725469bb7cc6873813272404085a73db08d61b3383f45be044", "abortWithParent": false }, "55ca3ada8c31b113": { "runId": "Wk3Qf9nRt2LpXy8Ab", "status": "SUCCEEDED", "runName": null, "checksum": "55ca3ada8c31b113f47979aa2893029a5e5c4f8f41b4935b7fd0c4cef1d975ac", "abortWithParent": false } }runId: the current run under the key.status: the last status the SDK observed.runName: the name, ornullfor a run without one.checksum: the hash above, checked before a recorded run is reused.abortWithParent: whether the run is aborted with the parent. It is stored so that runs recorded before a migration can still be aborted.Open questions
This holds within one attempt and after a migration or resurrection, so a call made again after a migration gets its earlier run back.
Should there be a global switch (a
Configurationfield with anAPIFY_*env var) that turns off reusing child runs without a name?Every unique call without a name adds a record, and the whole
__ACTOR_CHILD_RUNSvalue is rewritten on each change. An Actor that fans out to thousands of children with different inputs writes a growing value thousands of times. Accept it, cap the number of records, or store one KVS key per run?tokenis not part of the hash, so an identical call with another token reuses the run started with the first one. If that token belongs to another account, the lookup gets a 404, the run counts as missing, and a new run replaces the record. Is that the behavior we want, or should the token (or its account) be part of the key?✍️ Drafted by Claude Code