marvin.utilities.context
Module for defining context utilities.
ScopedContext
¶
ScopedContext
provides a context management mechanism using contextvars
.
This class allows setting and retrieving key-value pairs in a scoped context, which is preserved across asynchronous tasks and threads within the same context.
Attributes:
Name | Type | Description |
---|---|---|
_context_storage |
ContextVar
|
A context variable to store the context data. |
Example
Basic Usage of ScopedContext