Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /topoteretes_cognee /cognee /modules /pipelines /models /PipelineContext.py
| from dataclasses import dataclass, field | |
| from typing import Any, Dict, List, Optional, Set | |
| class PipelineContext: | |
| """Typed runtime context for pipeline tasks. | |
| Tasks that need runtime values accept this as an explicit parameter:: | |
| async def add_data_points(data_points, ctx: PipelineContext = None): | |
| if ctx: | |
| user = ctx.user | |
| dataset = ctx.dataset | |
| custom_val = ctx.extras.get("my_key") | |
| The pipeline machinery passes ``ctx`` to any task whose signature | |
| includes a parameter named ``ctx`` (matched by name, not by type annotation). | |
| Custom pipelines can store additional state in ``extras``. | |
| """ | |
| user: Any = None | |
| data_item: Any = None | |
| dataset: Any = None | |
| pipeline_run_id: Any = None | |
| pipeline_name: Optional[str] = None | |
| extras: Dict[str, Any] = field(default_factory=dict) | |
| # Internal: persisted across tasks so _stamp_provenance skips | |
| # DataPoints that were already walked in earlier pipeline stages. | |
| _provenance_visited: Set[int] = field(default_factory=set, repr=False) | |
| # Lazily-created relational provenance buffer. Keeping this None for | |
| # pipelines without document chunks makes the feature zero-cost there. | |
| provenance_buffer: Any = field(default=None, repr=False) | |
| # Ordered list of unique task names in the order they were first seen. | |
| # Used to derive DataPoint.topological_rank (1-based index into this list) | |
| # so the visualization can lay nodes out in pipeline order. A task that | |
| # runs N times because an upstream task streams N results still gets the | |
| # same rank — rank is "position in pipeline", not "invocation count". | |
| task_sequence: List[str] = field(default_factory=list) | |
Xet Storage Details
- Size:
- 1.76 kB
- Xet hash:
- fff546da7cad9278c7abdf1d0c16dc42b075f1130ed8885dd71c8b66f97597cf
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.