o
    2wit                     @   st   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mZ eedZd	efd
dZdS )zo
The info commands gets the information on a Sheep or XP and can be used
to retrieve the job status, logs etc.
    )partialN   )DecoratedMain)Shepherd)
simple_logfatalzInfo:mainc                 C   s  t |}| jd ur#t| jdkrtd || j}|d u r"td n|| j}td| td|jj	 |jr>td|j | j
r^||j}dt| d}|rZ|t|d	 7 }t| | jry|jd u rktd
 n| rttd n|j  | jr|jd u rtd |j std|j d tt|jdtjd | jr|j std|j d tddddd|jg d S d S )Nr   z1If a job id is provided, you shouldn't pass argv.z!Could not find any matching sheepzFound sheepz	Folder iszMain log iszMetrics[z]: z!Could not cancel non existing jobzJob is not runningz(No log, sheep hasn't been scheduled yet.zLog z does not existri   tailz-n200z-f)r   job_idlenargvr   get_sheep_from_job_idget_sheep_from_argvlogxpfoldermetricsget_xp_historyjsondumpscanceljobis_doneexistsshutilcopyfileobjopensysstdoutr   osexecvp)argsr   shepherdsheepr   out r(   F/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/dora/info.pyinfo_action   sH   








r*   )__doc__	functoolsr   r   r"   r   r    r   r   shepr   r   r   r   r*   r(   r(   r(   r)   <module>   s   
