flow.record.context¶
Module Contents¶
Classes¶
Context for the application, holding metrics like amount of processed records. |
Functions¶
Retrieve the application context, creating it if it does not exist. |
|
Create a fresh application context for the duration of the with block. |
|
Return True if |
Attributes¶
- flow.record.context.APP_CONTEXT: contextvars.ContextVar[AppContext]¶
- flow.record.context.get_app_context() AppContext¶
Retrieve the application context, creating it if it does not exist.
- Returns:
The application context.
- flow.record.context.fresh_app_context() collections.abc.Generator[AppContext, None, None]¶
Create a fresh application context for the duration of the with block.
- class flow.record.context.AppContext¶
Context for the application, holding metrics like amount of processed records.
- read: int = 0¶
- matched: int = 0¶
- unmatched: int = 0¶
- source_count: int = 0¶
- source_total: int = 0¶
- flow.record.context.match_record_with_context(record: flow.record.Record, selector: flow.record.selector.Selector | None, context: AppContext) bool¶
Return True if
recordmatches theselector, also keeps track of relevant metrics incontext. If selector is None, it will always return True.When calling this function, it also increases the
context.readproperty.- Parameters:
record – The record to match against the selector.
selector – The selector to use for matching.
context – The context in which the record is being matched.
- Returns:
True if record matches the selector, or if selector is None