o
    -wiC                     @  sh  d Z ddlmZ ddlZddlZddlZddlZddlmZ ddl	m
Z
 ddlmZ e dd Zejd	d
i iddejejddejdddejddddejddddejddddejdddddejd ddd!dejd"d#d$dd%ejd&dd'dd%ejd(ddd)dejd*ddd+dejd,dd-d.											d>d?d<d=ZdS )@zwBeta versions of wandb CLI commands.

These commands are experimental and may change or be removed in future versions.
    )annotationsN)WandbCoreNotAvailableError)_sync)get_core_pathc               
   C  sl   ddl } | jjdd zt  W dS  ty5 } z| jd|  tj|ddd W Y d}~dS d}~ww )	z9Beta versions of wandb CLI commands. Requires wandb-core.r   N
wandb_beta)process_contextz using `wandb beta`. failed with redT)fgerr)	wandb.env_sentryconfigure_scoper   r   	exceptionclicksecho)wandbe r   K/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/wandb/cli/beta.pybeta   s   r   syncdefault_mapzUpload a training run to W&B)namecontext_settingshelp	wandb_dir   T)exists)nargstypez--idrun_idzThe run you want to upload to.)r   z	--projectz-pz"The project you want to upload to.z--entityz-ezThe entity to scope to.z--skip-consoleFzSkip console logs)is_flagdefaultr   z--appendz
Append runz	--includez-iz,Glob to include. Can be used multiple times.)r   multiplez	--excludez,Glob to exclude. Can be used multiple times.z--mark-synced/--no-mark-syncedzMark runs as syncedz--skip-synced/--no-skip-syncedzSkip synced runsz	--dry-runz-Perform a dry run without uploading anything.)r!   r   
str | Noneprojectentityskip_consoleboolappendincludeexcludeskip_syncedmark_synceddry_runreturnNonec                 C  st  dd l }ddlm} t }|rN|D ];}tt||}|D ],}| s&qdd |dD }t	|dkr@t
d| d qt	|dkrK|| qqn|d	d
 t|dD  |D ]}tt||}|D ]}| suqn||v r~|| qnq`|	rt }|D ]'}dd |dD }t	|dkrt
d| d qt	|dkr|| q||8 }|rt	|dkrtjddd td |std d S td |D ]
}td|  q|rd S t
  |jjtt	|| d8}g }|D ] }dd |dD d }|jt|||||||
d}|| q|j|D ]}q#W d    d S 1 s3w   Y  d S )Nr   )	cpu_countc                 S     g | ]}|  r|qS r   is_file.0pr   r   r   
<listcomp>h       zsync_beta.<locals>.<listcomp>z*.wandbr   z(Multiple wandb files found in directory z
, skippingc                 S  s   h | ]}|j qS r   )parentr5   r   r   r   	<setcomp>p   s    zsync_beta.<locals>.<setcomp>z
**/*.wandbc                 S  r2   r   r3   r5   r   r   r   r8   ~   r9   z*.wandb.syncedz/Multiple wandb.synced files found in directory z$id can only be set for a single run.T)r
   zNo runs to sync.zFound runs:z  )max_workersc                 S  r2   r   r3   r5   r   r   r   r8      r9   )r    r%   r&   r'   r)   r-   )concurrent.futuresmultiprocessingr1   setlistpathlibPathglobis_dirlenr   termwarnaddupdateremover   echosysexitsetupfuturesProcessPoolExecutorminsubmitr   r)   as_completed)ctxr   r    r%   r&   r'   r)   r*   r+   r,   r-   r.   
concurrentr1   pathspatternmatching_dirsdwandb_filessynced_pathspathwandb_synced_filesexecutorrN   
wandb_filefuture_r   r   r   	sync_beta&   s   5

 






$ra   )NNNNFFNNTTF)r    r$   r%   r$   r&   r$   r'   r(   r)   r(   r*   r$   r+   r$   r,   r(   r-   r(   r.   r(   r/   r0   )__doc__
__future__r   rA   rK   r   r   wandb.errorsr   wandb.sdk.wandb_syncr   
wandb.utilr   groupr   commandpass_contextargumentrB   optionra   r   r   r   r   <module>   s|    
*