fleche.metadata
Attributes
Classes
Abstract base class for defining metadata types. |
|
Metadata type for capturing runtime information. |
|
Metadata type for storing arbitrary tags. |
Module Contents
- type fleche.metadata.JSONValue = str | int | float | bool | None | list['JSONValue'] | dict[str, 'JSONValue'][source]
- class fleche.metadata.MetaData[source]
Bases:
abc.ABCAbstract base class for defining metadata types.
Implementations must return only JSON-serializable values from pre() and post(). That means scalars (str, int, float, bool, None), lists of those, or dicts with str keys and JSON-serializable values.
- pre(call: fleche.call.Call) dict[str, JSONValue][source]
Hook for collecting metadata before the function execution.
- post(pre: dict[str, JSONValue], call: fleche.call.Call) dict[str, JSONValue][source]
Hook for collecting metadata after the function execution.
The return value of the function is available on the call.result attribute.
- class fleche.metadata.Runtime[source]
Bases:
MetaDataMetadata type for capturing runtime information.
- Keys:
timestart (float): The timestamp when the execution started. timestop (float): The timestamp when the execution stopped. walltime (float): The total execution time in seconds.
Notes
Values are JSON-serializable.
- pre(call: fleche.call.Call) dict[str, Any][source]
Records the start time before function execution.
- post(pre: dict[str, Any], call: fleche.call.Call) dict[str, Any][source]
Records the stop time and calculates the wall time after function execution.
- class fleche.metadata.Tags[source]
Bases:
MetaDataMetadata type for storing arbitrary tags.
For each key in the
tagsdictionary, a new metadata column is created.- Keys:
tags (dict): A dictionary of user-defined tags.
Notes
Tag values must be JSON-serializable.
- pre(call: fleche.call.Call) dict[str, Any][source]
Hook for collecting metadata before the function execution.