Commits
Click on a commit to change the comparison rangeFix TASK_SOURCE cache policy for remote execution with cloudpickle
This PR fixes an issue where the `TASK_SOURCE` cache policy fails when
used with remote execution decorators like `@ecs` that use cloudpickle
to ship code to remote environments.
The problem: `inspect.getsource()` fails on cloudpickled functions
because the original source file doesn't exist on the remote machine.
The previous fallback to hashing `__code__.co_code` (bytecode) led to
inconsistent cache keys because bytecode varies across Python versions
and the code object contains unstable attributes like `co_locals` that
change between serialization/deserialization cycles.
The solution: Store the function's source code on the `Task` object
during initialization so it survives cloudpickle serialization. The
`TaskSource.compute_key()` method now checks for this stored source
code first before falling back to `inspect.getsource()`. This ensures
stable, deterministic cache keys regardless of execution environment.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>10 hours ago
by desertaxle Clean up8 hours ago
by desertaxle