o
    $is                  	   @   s   d dl mZmZ d dlmZ d dlmZmZ d dl	m
Z
mZ d dlmZmZ d dlmZ eeG dd deZed	d
e dddedee ddfddZed	d
e dee fddZdefddZdS )    )DictOptional)
Checkpoint)_warn_session_misuseget_session)V2_MIGRATION_GUIDE_MESSAGE_v2_migration_warnings_enabled)	_copy_doc_log_deprecation_warning)	PublicAPIc                   @   s   e Zd ZdS )r   N)__name__
__module____qualname__ r   r   b/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/ray/tune/trainable/trainable_fn_utils.pyr      s    r   stable)	stabilityN
checkpointmetricsr   returnc                C   s6   |rt |tst rtdt  t j| |d dS )a`  Report metrics and optionally save and register a checkpoint to Ray Tune.

    If a checkpoint is provided, it will be
    :ref:`persisted to storage <persistent-storage-guide>`.

    .. note::

        Each invocation of this method will automatically increment the underlying
        ``training_iteration`` number. The physical meaning of this "iteration" is
        defined by user depending on how often they call ``report``.
        It does not necessarily map to one epoch.

    Args:
        metrics: The metrics you want to report.
        checkpoint: The optional checkpoint you want to report.
    zThe `Checkpoint` class should be imported from `ray.tune` when passing it to `ray.tune.report` in a Tune function. Please update your imports. r   N)
isinstancer   r   r
   r   r   report)r   r   r   r   r   r      s   r   c                   C   s   t  jS )zCAccess the latest reported checkpoint to resume from if one exists.)r   loaded_checkpointr   r   r   r   get_checkpoint3   s   r   c                   C   s   t  ot  jd u S )N)r   
world_rankr   r   r   r   _in_tune_session;   s   r   )typingr   r   ray.train._checkpointr   TrainCheckpointray.train._internal.sessionr   r   ray.train.constantsr   r   ray.train.utilsr	   r
   ray.util.annotationsr   r   r   boolr   r   r   r   r   <module>   s    $