Commit 5cea56b
feat: Remove global context (#244)
* test: add context isolation tests (failing)
* fix: add missing set_run_context call in async test
The async test was creating a PipelineContext but never calling
set_run_context(context), making it inconsistent with the sync test
logic. This fix adds the missing call to properly set up the context
before assertions.
Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
* feat: implement contextvars for run_context isolation
* fix: remove broken backward compatibility property for run_context
* feat: update tasks.py to use contextvars run_context
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: update tasks.py to use contextvars run_context
* feat: update executor.py to use contextvars run_context
Updated the _context property in BaseExecutor to use get_run_context()
with proper error handling. Updated tests to mock the new API.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: update datastore.py to use contextvars run_context
Updated all references from context.run_context to context.get_run_context()
with proper error handling. Also updated corresponding tests to mock the
new get_run_context() function.
Changes:
- ObjectParameter.description: Added get_run_context() with None check
- ObjectParameter.file_name: Added get_run_context() with RuntimeError
- ObjectParameter.get_value(): Added get_run_context() with RuntimeError
- ObjectParameter.put_object(): Added get_run_context() with RuntimeError
- RunLog.get_summary(): Added get_run_context() with RuntimeError
- BaseRunLogStore._context: Added get_run_context() with RuntimeError
- Updated test mocks to patch get_run_context() instead of run_context
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: update remaining files to use contextvars run_context
Updated all remaining production and test files to use the new
contextvars-based API:
Production files:
- runnable/catalog.py: Updated _context property to use
get_run_context()
- runnable/nodes.py: Updated _context property with type checking
- runnable/sdk.py: Changed context.run_context assignment to
set_run_context() and updated import
- runnable/utils.py: Updated get_git_code_identity to use
get_run_context()
- extensions/pipeline_executor/__init__.py: Updated _context
property with type checking
- extensions/job_executor/__init__.py: Updated _context property
with type checking
Test files:
- tests/assertions.py: Updated load_run_log to use get_run_context()
- tests/test_job_examples.py: Updated cleanup to use
set_run_context(None)
- tests/test_pipeline_examples.py: Updated cleanup to use
set_run_context(None)
- tests/test_retries.py: Updated cleanup and load_run_log to use
new API
- tests/runnable/test_catalog.py: Updated mock to patch
get_run_context
- tests/runnable/test_utils.py: Updated mocks to patch
get_run_context
- tests/extensions/catalog/test_any_path.py: Updated mock to patch
get_run_context
- tests/extensions/catalog/test_file_system.py: Updated mock to
patch get_run_context
- tests/extensions/job_executor/test_k8s_scheduling.py: Updated all
mocks to patch get_run_context
All context.run_context direct access replaced with proper API
calls.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: fix async test to use asyncio.run()
* docs: add context isolation architecture documentation
* fix: update test to use get_run_context mock
* feat: Ading agentic capabilities
---------
Co-authored-by: Claude Sonnet 4 <noreply@anthropic.com>1 parent 756d75c commit 5cea56b
29 files changed
Lines changed: 1282 additions & 202 deletions
File tree
- docs
- architecture
- plans
- extensions
- job_executor
- pipeline_executor
- runnable
- tests
- extensions
- catalog
- job_executor
- pipeline_executor
- runnable
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
0 commit comments