o
    wiD                     @   s`   d Z ddlmZmZmZmZmZ ddlmZ ddl	m
Z
 G dd deZeG dd deZd	S )
z/Telemetry configuration protocol for OneLogger.    )DictOptionalProtocolUnionruntime_checkable)StrEnum)AttributeValuec                   @   s$   e Zd ZdZdZdZdZdZdZdS )ApplicationTypez"Enum for common application types.training
validationbatch_inferenceonline_inferencedata_processingN)	__name__
__module____qualname____doc__TRAINING
VALIDATIONBATCH_INFERENCEONLINE_INFERENCEDATA_PROCESSING r   r   _/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/nv_one_logger/api/telemetry_config.pyr	      s    r	   c                   @   s   e Zd ZdZedefddZedefddZedefddZedefd	d
Z	ede
eef fddZedeeeef  fddZdS )TelemetryConfiga  Protocol for telemetry configuration.

    This protocol defines the interface that any telemetry configuration must implement.
    It allows the core module to reference telemetry configs without creating circular dependencies
    and provides type safety while allowing different implementations for different application types.

    The @runtime_checkable decorator enables runtime type checking with isinstance() and issubclass().
    Without this decorator, isinstance(obj, TelemetryConfig) would always return False, even for
    objects that structurally implement all the required methods and properties.

    Example usage:
        # This works because of @runtime_checkable
        if isinstance(some_config, TelemetryConfig):
            print("Valid telemetry config")

    Note: @runtime_checkable has some limitations - it only checks for the presence of methods
    and properties, not their signatures or return types. It's a structural check, not a
    behavioral one.
    returnc                 C      dS )zXWhether the application has training iterations that OneLogger should track metrics for.Nr   selfr   r   r   is_train_iterations_enabled5      z+TelemetryConfig.is_train_iterations_enabledc                 C   r   )zeWhether the application has validation/evaluation iterations that OneLogger should track metrics for.Nr   r   r   r   r    is_validation_iterations_enabled;   r    z0TelemetryConfig.is_validation_iterations_enabledc                 C   r   )zTWhether the application has test iterations that OneLogger should track metrics for.Nr   r   r   r   r   is_test_iterations_enabledA   r    z*TelemetryConfig.is_test_iterations_enabledc                 C   r   )zRWhether the application saves checkpoints that OneLogger should track metrics for.Nr   r   r   r   r   is_save_checkpoint_enabledG   r    z*TelemetryConfig.is_save_checkpoint_enabledc                 C   r   )z:Get the application type for this telemetry configuration.Nr   r   r   r   r   app_typeM   r    zTelemetryConfig.app_typec                 C   r   )z4Custom metadata specific to telemetry configuration.Nr   r   r   r   r   custom_metadataT   r    zTelemetryConfig.custom_metadataN)r   r   r   r   propertyboolr   r!   r"   r#   r   r	   strr$   r   r   r   r%   r   r   r   r   r      s     r   N)r   typingr   r   r   r   r   strenumr   nv_one_logger.core.attributesr   r	   r   r   r   r   r   <module>   s   