ó
    pyüi�8  ã                   ó  • S SK Jr  S SKJr  S SKJr  S SKJr  S SKJr  S SK	J
r
Jr  S SKJr   " S S	\\5      r\ " S
 S5      5       r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       rSSS.S\S\\   S \\\4   S-  S!\\\4   S-  S"\
S-  S#\\-  \-  S-  S$\\\4   S-  S%\\   S-  S&\\\4   4S' jjrg)(é    )Ú	dataclass)Údatetime)ÚEnum)ÚAny)Ú	constants)ÚSpaceHardwareÚVolume)Úparse_datetimec                   ó,   • \ rS rSrSrSrSrSrSrSr	Sr
g	)
ÚJobStageé   aH  
Enumeration of possible stage of a Job on the Hub.

Value can be compared to a string:
```py
assert JobStage.COMPLETED == "COMPLETED"
```
Possible values are: `COMPLETED`, `CANCELED`, `ERROR`, `DELETED`, `RUNNING`.
Taken from https://github.com/huggingface/moon-landing/blob/main/server/job_types/JobInfo.ts#L61 (private url).
Ú	COMPLETEDÚCANCELEDÚERRORÚDELETEDÚRUNNING© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r   r   Ú__static_attributes__r   ó    ÚV/home/mande/repo/quber/.venv/lib/python3.13/site-packages/huggingface_hub/_jobs_api.pyr   r      s"   † ñ	ð €IØ€HØ€EØ€GØƒGr   r   c                   ó0   • \ rS rSr% \\S'   \S-  \S'   Srg)Ú	JobStatusé,   ÚstageNÚmessager   )r   r   r   r   r   Ú__annotations__Ústrr   r   r   r   r   r   ,   s   ‡ àƒOØ�4‰ZÖr   r   c                   ó4   • \ rS rSr% \\S'   \\S'   \\S'   Srg)ÚJobOwneré2   ÚidÚnameÚtyper   N)r   r   r   r   r"   r!   r   r   r   r   r$   r$   2   s   ‡ àƒGØ
ƒIØ
†Ir   r$   c                   ó&  • \ rS rSr% Sr\\S'   \S-  \S'   \S-  \S'   \S-  \S'   \\   S-  \S'   \\   S-  \S	'   \	\\
4   S-  \S
'   \	\\
4   S-  \S'   \S-  \S'   \	\\4   S-  \S'   \\   S-  \S'   \\S'   \\S'   \\S'   \\S'   SS jrSrg)ÚJobInfoé9   aY	  
Contains information about a Job.

Args:
    id (`str`):
        Job ID.
    created_at (`datetime` or `None`):
        When the Job was created.
    docker_image (`str` or `None`):
        The Docker image from Docker Hub used for the Job.
        Can be None if space_id is present instead.
    space_id (`str` or `None`):
        The Docker image from Hugging Face Spaces used for the Job.
        Can be None if docker_image is present instead.
    command (`list[str]` or `None`):
        Command of the Job, e.g. `["python", "-c", "print('hello world')"]`
    arguments (`list[str]` or `None`):
        Arguments passed to the command
    environment (`dict[str]` or `None`):
        Environment variables of the Job as a dictionary.
    secrets (`dict[str]` or `None`):
        Secret environment variables of the Job (encrypted).
    flavor (`str` or `None`):
        Flavor for the hardware, as in Hugging Face Spaces. See [`SpaceHardware`] for possible values.
        E.g. `"cpu-basic"`.
    labels (`dict[str, str]` or `None`):
        Labels to attach to the job (key-value pairs).
    volumes (`list[Volume]` or `None`):
        Volumes mounted in the job container (buckets, models, datasets, spaces).
    status: (`JobStatus` or `None`):
        Status of the Job, e.g. `JobStatus(stage="RUNNING", message=None)`
        See [`JobStage`] for possible stage values.
    owner: (`JobOwner` or `None`):
        Owner of the Job, e.g. `JobOwner(id="5e9ecfc04957053f60648a3e", name="lhoestq", type="user")`

Example:

```python
>>> from huggingface_hub import run_job
>>> job = run_job(
...     image="python:3.12",
...     command=["python", "-c", "print('Hello from the cloud!')"]
... )
>>> job
JobInfo(id='687fb701029421ae5549d998', created_at=datetime.datetime(2025, 7, 22, 16, 6, 25, 79000, tzinfo=datetime.timezone.utc), docker_image='python:3.12', space_id=None, command=['python', '-c', "print('Hello from the cloud!')"], arguments=[], environment={}, secrets={}, flavor='cpu-basic', labels=None, status=JobStatus(stage='RUNNING', message=None), owner=JobOwner(id='5e9ecfc04957053f60648a3e', name='lhoestq', type='user'), endpoint='https://huggingface.co', url='https://huggingface.co/jobs/lhoestq/687fb701029421ae5549d998')
>>> job.id
'687fb701029421ae5549d998'
>>> job.url
'https://huggingface.co/jobs/lhoestq/687fb701029421ae5549d998'
>>> job.status.stage
'RUNNING'
```
r&   NÚ
created_atÚdocker_imageÚspace_idÚcommandÚ	argumentsÚenvironmentÚsecretsÚflavorÚlabelsÚvolumesÚstatusÚownerÚendpointÚurlc                 óP  • US   U l         UR                  S5      =(       d    UR                  S5      nU(       a  [        U5      OS U l        UR                  S5      =(       d    UR                  S5      U l        UR                  S5      =(       d    UR                  S5      U l        UR                  S0 5      n[        US   US	   US
   S9U l        UR                  S5      U l        UR                  S5      U l	        UR                  S5      U l
        UR                  S5      U l        UR                  S5      U l        UR                  S5      U l        UR                  S5      nU(       a  U Vs/ s H  n[        S0 UD6PM     snOS U l        UR                  S0 5      n[!        US   UR                  S5      S9U l        UR                  S[$        R&                  5      U l        U R(                   SU R                  R*                   SU R                    3U l        g s  snf )Nr&   Ú	createdAtr,   ÚdockerImager-   ÚspaceIdr.   r7   r'   r(   ©r&   r'   r(   r/   r0   r1   r2   r3   r4   r5   r6   r   r    )r   r    r8   z/jobs/Ú/r   )r&   Úgetr
   r,   r-   r.   r$   r7   r/   r0   r1   r2   r3   r4   r	   r5   r   r6   r   ÚENDPOINTr8   r'   r9   )ÚselfÚkwargsr,   r7   r5   Úvr6   s          r   Ú__init__ÚJobInfo.__init__ƒ   s¤  € Ø˜‘,ˆŒØ—Z‘Z Ó,×H°·
±
¸<Ó0Hˆ
Þ8Bœ.¨Ô4ÈˆŒØ"ŸJ™J }Ó5×S¸¿¹ÀNÓ9SˆÔØŸ
™
 9Ó-×G°·±¸JÓ1GˆŒØ—
‘
˜7 BÓ'ˆÜ  t¡°5¸±=ÀuÈVÁ}ÑUˆŒ
Ø—z‘z )Ó,ˆŒØŸ™ KÓ0ˆŒØ!Ÿ:™: mÓ4ˆÔØ—z‘z )Ó,ˆŒØ—j‘j Ó*ˆŒØ—j‘j Ó*ˆŒØ—*‘*˜YÓ'ˆÞ9@©WÓ5ªW¨œ™ œ©WÒ5ÀdˆŒØ—‘˜H bÓ)ˆÜ f¨W¡o¸v¿z¹zÈ)Ó?TÑUˆŒð Ÿ
™
 :¬y×/AÑ/AÓBˆŒØ—m‘m�_ F¨4¯:©:¯?©?Ð*;¸1¸T¿W¹W¸IÐFˆ�ùò 6s   Å4H#)r0   r/   r,   r-   r8   r1   r3   r&   r4   r7   r2   r.   r6   r9   r5   ©ÚreturnN)r   r   r   r   r   r"   r!   r   ÚlistÚdictr   r   r	   r   r$   rE   r   r   r   r   r*   r*   9   s»   ‡ ñ4ðl 	ƒGØ˜4‘ÓØ˜‘*ÓØ�D‰jÓØ�#‰Y˜ÑÓØ�C‰y˜4ÑÓØ�c˜3�h‘ $Ñ&Ó&Ø�#�s�(‰^˜dÑ"Ó"Ø˜DÑ Ó Ø��c�‰N˜TÑ!Ó!Ø�&‰\˜DÑ Ó ØÓØƒOð ƒMØ	ƒH÷Gr   r*   c                   ó  • \ rS rSr% \S-  \S'   \S-  \S'   \\   S-  \S'   \\   S-  \S'   \\\4   S-  \S'   \\\4   S-  \S'   \	S-  \S	'   \
S-  \S
'   \\   S-  \S'   \S-  \S'   \\\4   S-  \S'   \\   S-  \S'   SS jrSrg)ÚJobSpecé›   Nr-   r.   r/   r0   r1   r2   r3   ÚtimeoutÚtagsÚarchr4   r5   c                 óÔ  • UR                  S5      =(       d    UR                  S5      U l        UR                  S5      =(       d    UR                  S5      U l        UR                  S5      U l        UR                  S5      U l        UR                  S5      U l        UR                  S5      U l        UR                  S	5      U l        UR                  S
5      U l        UR                  S5      U l	        UR                  S5      U l
        UR                  S5      U l        UR                  S5      nU(       a"  U Vs/ s H  n[        S0 UD6PM     snU l        g S U l        g s  snf )Nr<   r-   r=   r.   r/   r0   r1   r2   r3   rN   rO   rP   r4   r5   r   )r@   r-   r.   r/   r0   r1   r2   r3   rN   rO   rP   r4   r	   r5   )rB   rC   r5   rD   s       r   rE   ÚJobSpec.__init__ª   s  € Ø"ŸJ™J }Ó5×S¸¿¹ÀNÓ9SˆÔØŸ
™
 9Ó-×G°·±¸JÓ1GˆŒØ—z‘z )Ó,ˆŒØŸ™ KÓ0ˆŒØ!Ÿ:™: mÓ4ˆÔØ—z‘z )Ó,ˆŒØ—j‘j Ó*ˆŒØ—z‘z )Ó,ˆŒØ—J‘J˜vÓ&ˆŒ	Ø—J‘J˜vÓ&ˆŒ	Ø—j‘j Ó*ˆŒØ—*‘*˜YÓ'ˆÞ9@©WÓ5ªW¨œ™ œ©WÑ5ˆ�Àdˆ�ùÒ5s   Ä?E%)rP   r0   r/   r-   r1   r3   r4   r2   r.   rO   rN   r5   rG   )r   r   r   r   r"   r!   rI   rJ   r   r   Úintr	   rE   r   r   r   r   rL   rL   ›   s°   ‡ à˜‘*ÓØ�D‰jÓØ�#‰Y˜ÑÓØ�C‰y˜4ÑÓØ�c˜3�h‘ $Ñ&Ó&Ø�#�s�(‰^˜dÑ"Ó"Ø˜DÑ Ó Ø�4‰ZÓØ
ˆs‰)�dÑ
ÓØ
�‰*ÓØ��c�‰N˜TÑ!Ó!Ø�&‰\˜DÑ Ó ÷Kr   rL   c                   ó4   • \ rS rSr% \\S'   \\S'   SS jrSrg)ÚLastJobInfoéº   r&   ÚatNc                 ó>   • US   U l         [        US   5      U l        g )Nr&   rW   )r&   r
   rW   ©rB   rC   s     r   rE   ÚLastJobInfo.__init__¿   s   € Ø˜‘,ˆŒÜ  ¨¡Ó.ˆ�r   )rW   r&   rG   )	r   r   r   r   r"   r!   r   rE   r   r   r   r   rU   rU   º   s   ‡ àƒGØƒL÷/r   rU   c                   ó@   • \ rS rSr% \S-  \S'   \S-  \S'   SS jrSrg)ÚScheduledJobStatuséÄ   NÚlast_jobÚnext_job_run_atc                 ó*  • UR                  S5      =(       d    UR                  S5      nU(       a  [        S0 UD6OS U l        UR                  S5      =(       d    UR                  S5      nU(       a  [        [	        U5      5      U l        g S U l        g )NÚlastJobr^   ÚnextJobRunAtr_   r   )r@   rU   r^   r
   r"   r_   )rB   rC   r^   r_   s       r   rE   ÚScheduledJobStatus.__init__É   sj   € Ø—:‘:˜iÓ(×B¨F¯J©J°zÓ,BˆÞ3;œÑ/ hÒ/ÀˆŒØ Ÿ*™* ^Ó4×U¸¿
¹
ÐCTÓ8UˆÞGVœ~¬c°/Ó.BÓCˆÕÐ\`ˆÕr   ©r^   r_   rG   )	r   r   r   r   rU   r!   r   rE   r   r   r   r   r\   r\   Ä   s   ‡ à˜DÑ Ó Ø ‘_Ó$÷ar   r\   c                   óŒ   • \ rS rSr% Sr\\S'   \S-  \S'   \\S'   \S-  \S'   \	S-  \S'   \	S-  \S	'   \
\S
'   \\S'   SS jrSrg)ÚScheduledJobInfoéÐ   a9  
Contains information about a Job.

Args:
    id (`str`):
        Scheduled Job ID.
    created_at (`datetime` or `None`):
        When the scheduled Job was created.
    tags (`list[str]` or `None`):
        The tags of the scheduled Job.
    schedule (`str` or `None`):
        One of "@annually", "@yearly", "@monthly", "@weekly", "@daily", "@hourly", or a
        CRON schedule expression (e.g., '0 9 * * 1' for 9 AM every Monday).
    suspend (`bool` or `None`):
        Whether the scheduled job is suspended (paused).
    concurrency (`bool` or `None`):
        Whether multiple instances of this Job can run concurrently.
    status (`ScheduledJobStatus` or `None`):
        Status of the scheduled Job.
    owner: (`JobOwner` or `None`):
        Owner of the scheduled Job, e.g. `JobOwner(id="5e9ecfc04957053f60648a3e", name="lhoestq", type="user")`
    job_spec: (`JobSpec` or `None`):
        Specifications of the Job.

Example:

```python
>>> from huggingface_hub import run_job
>>> scheduled_job = create_scheduled_job(
...     image="python:3.12",
...     command=["python", "-c", "print('Hello from the cloud!')"],
...     schedule="@hourly",
... )
>>> scheduled_job.id
'687fb701029421ae5549d999'
>>> scheduled_job.status.next_job_run_at
datetime.datetime(2025, 7, 22, 17, 6, 25, 79000, tzinfo=datetime.timezone.utc)
```
r&   Nr,   Újob_specÚscheduleÚsuspendÚconcurrencyr6   r7   c                 óÄ  • US   U l         UR                  S5      =(       d    UR                  S5      nU(       a  [        U5      OS U l        [	        S0 UR                  S5      =(       d    UR                  S0 5      D6U l        UR                  S5      U l        UR                  S5      U l        UR                  S5      U l        UR                  S	0 5      n[        UR                  S
5      =(       d    UR                  S5      UR                  S5      =(       d    UR                  S5      S9U l
        UR                  S0 5      n[        US   US   US   S9U l        g )Nr&   r;   r,   rh   ÚjobSpecri   rj   rk   r6   r^   ra   r_   rb   rd   r7   r'   r(   r>   r   )r&   r@   r
   r,   rL   rh   ri   rj   rk   r\   r6   r$   r7   )rB   rC   r,   r6   r7   s        r   rE   ÚScheduledJobInfo.__init__  s  € Ø˜‘,ˆŒØ—Z‘Z Ó,×H°·
±
¸<Ó0Hˆ
Þ8Bœ.¨Ô4ÈˆŒÜÑX 6§:¡:¨jÓ#9×#V¸V¿Z¹ZÈ	ÐSUÓ=VÑXˆŒØŸ
™
 :Ó.ˆŒØ—z‘z )Ó,ˆŒØ!Ÿ:™: mÓ4ˆÔØ—‘˜H bÓ)ˆÜ(Ø—Z‘Z 
Ó+×D¨v¯z©z¸)Ó/DØ"ŸJ™JÐ'8Ó9×W¸V¿Z¹ZÈÓ=Wñ
ˆŒð —
‘
˜7 BÓ'ˆÜ  t¡°5¸±=ÀuÈVÁ}ÑUˆ�
r   )rk   r,   r&   rh   r7   ri   r6   rj   rG   )r   r   r   r   r   r"   r!   r   rL   Úboolr\   r$   rE   r   r   r   r   rf   rf   Ð   sN   ‡ ñ&ðP 	ƒGØ˜4‘ÓØÓØ�D‰jÓØ�D‰[ÓØ˜‘ÓØÓØƒO÷Vr   rf   c                   óV   • \ rS rSr% Sr\\S'   \\S'   \\S'   \\S'   \\S'   SS	 jrS
rg)ÚJobAcceleratori  aÉ  
Contains information about a Job accelerator (GPU).

Args:
    type (`str`):
        Type of accelerator, e.g. `"gpu"`.
    model (`str`):
        Model of accelerator, e.g. `"T4"`, `"A10G"`, `"A100"`, `"L4"`, `"L40S"`.
    quantity (`str`):
        Number of accelerators, e.g. `"1"`, `"2"`, `"4"`, `"8"`.
    vram (`str`):
        Total VRAM, e.g. `"16 GB"`, `"24 GB"`.
    manufacturer (`str`):
        Manufacturer of the accelerator, e.g. `"Nvidia"`.
r(   ÚmodelÚquantityÚvramÚmanufacturerNc                 óh   • US   U l         US   U l        US   U l        US   U l        US   U l        g )Nr(   rr   rs   rt   ru   )r(   rr   rs   rt   ru   rY   s     r   rE   ÚJobAccelerator.__init__,  s<   € Ø˜6‘NˆŒ	Ø˜G‘_ˆŒ
Ø˜zÑ*ˆŒØ˜6‘NˆŒ	Ø" >Ñ2ˆÕr   )ru   rr   rs   r(   rt   rG   )	r   r   r   r   r   r"   r!   rE   r   r   r   r   rq   rq     s(   ‡ ñð  ƒIØƒJØƒMØ
ƒIØÓ÷3r   rq   c                   óz   • \ rS rSr% Sr\\S'   \\S'   \\S'   \\S'   \S-  \S'   \\S	'   \	\S
'   \\S'   SS jr
Srg)ÚJobHardwarei4  a)  
Contains information about available Job hardware.

Args:
    name (`str`):
        Machine identifier, e.g. `"cpu-basic"`, `"a10g-large"`.
    pretty_name (`str`):
        Human-readable name, e.g. `"CPU Basic"`, `"Nvidia A10G - large"`.
    cpu (`str`):
        CPU specification, e.g. `"2 vCPU"`, `"12 vCPU"`.
    ram (`str`):
        RAM specification, e.g. `"16 GB"`, `"46 GB"`.
    accelerator (`JobAccelerator` or `None`):
        GPU/accelerator details if available.
    unit_cost_micro_usd (`int`):
        Cost in micro-dollars per unit, e.g. `167` (= $0.000167).
    unit_cost_usd (`float`):
        Cost in USD per unit, e.g. `0.000167`.
    unit_label (`str`):
        Cost unit period, e.g. `"minute"`.

Example:

```python
>>> from huggingface_hub import list_jobs_hardware
>>> hardware_list = list_jobs_hardware()
>>> hardware_list[0]
JobHardware(name='cpu-basic', pretty_name='CPU Basic', cpu='2 vCPU', ram='16 GB', accelerator=None, unit_cost_micro_usd=167, unit_cost_usd=0.000167, unit_label='minute')
>>> hardware_list[0].name
'cpu-basic'
```
r'   Úpretty_nameÚcpuÚramNÚacceleratorÚunit_cost_micro_usdÚunit_cost_usdÚ
unit_labelc                 óä   • US   U l         US   U l        US   U l        US   U l        UR	                  S5      nU(       a  [        S	0 UD6OS U l        US   U l        US   U l        US   U l	        g )
Nr'   Ú
prettyNamer{   r|   r}   ÚunitCostMicroUSDÚunitCostUSDÚ	unitLabelr   )
r'   rz   r{   r|   r@   rq   r}   r~   r   r€   )rB   rC   r}   s      r   rE   ÚJobHardware.__init__`  sy   € Ø˜6‘NˆŒ	Ø! ,Ñ/ˆÔØ˜%‘=ˆŒØ˜%‘=ˆŒØ—j‘j Ó/ˆÞ<Gœ>Ñ8¨KÒ8ÈTˆÔØ#)Ð*<Ñ#=ˆÔ Ø# MÑ2ˆÔØ  Ñ-ˆ�r   )r}   r{   r'   rz   r|   r~   r   r€   rG   )r   r   r   r   r   r"   r!   rq   rS   ÚfloatrE   r   r   r   r   ry   ry   4  s@   ‡ ñðB ƒIØÓØ	ƒHØ	ƒHØ $Ñ&Ó&ØÓØÓØƒO÷	.r   ry   N)r4   r5   Úimager/   Úenvr2   r3   rN   r4   r5   rH   c                 ó  • U/ U=(       d    0 U=(       d    [         R                  S.nU(       a  X8S'   U(       aV  SSSSS.n	[        U[        5      (       a,  US   U	;   a#  [	        [        US S 5      X•S      -  5      US	'   O[	        U5      US	'   U(       a  XhS
'   U(       a#  U V
s/ s H  oªR                  5       PM     sn
US'   S H-  nU R                  U5      (       d  M  U [        U5      S  US'     U$    XS'   U$ s  sn
f )N)r/   r0   r1   r3   r2   é   é<   i  i€Q )ÚsÚmÚhÚdéÿÿÿÿÚtimeoutSecondsr4   r5   )zhttps://huggingface.co/spaces/zhttps://hf.co/spaces/zhuggingface.co/spaces/zhf.co/spaces/r=   r<   )	r   Ú	CPU_BASICÚ
isinstancer"   rS   r‡   Úto_dictÚ
startswithÚlen)rˆ   r/   r‰   r2   r3   rN   r4   r5   rh   Útime_units_factorsÚvolÚprefixs               r   Ú_create_job_specr›   l  s  € ð ØØ—y˜bØ×3œM×3Ñ3ñ	 €Hö Ø%�ÑæØ#$¨2°D¸yÑIÐÜ�gœs×#Ñ#¨°©Ð7IÓ(IÜ),¬U°7¸3¸B°<Ó-@ÐCUÐ^`ÑVaÑCbÑ-bÓ)cˆHÐ%Ò&ä),¨W«ˆHÐ%Ñ&æØ#�ÑæÙ8?Ó@º°Ÿ{™{ž}¹Ñ@ˆ�Ñóˆð ×Ñ˜F×#Ó#Ø"'¬¨F«¨Ð"6ˆH�YÑØð €Oñð #(�ÑØ€Oùò As   Â&C>)Údataclassesr   r   Úenumr   Útypingr   Úhuggingface_hubr   Úhuggingface_hub._space_apir   r	   Úhuggingface_hub.utils._datetimer
   r"   r   r   r$   r*   rL   rU   r\   rf   rq   ry   rI   rJ   rS   r‡   r›   r   r   r   Ú<module>r¢      sÔ  ðõ "Ý Ý Ý å %ß <Ý :ôˆs�Dô ð( ÷ð ó ðð
 ÷ð ó ðð ÷^Gð ^Gó ð^GðB ÷Kð Kó ðKð< ÷/ð /ó ð/ð ÷að aó ðað ÷@Vð @Vó ð@VðF ÷3ð 3ó ð3ð> ÷4.ð 4.ó ð4.ð~ %)Ø#'ò.àð.ð �#‰Yð.ð 
ˆc�3ˆh‰˜$Ñ	ð	.ð
 �#�s�(‰^˜dÑ"ð.ð ˜DÑ ð.ð �5‰[˜3Ñ Ñ%ð.ð ��c�‰N˜TÑ!ð.ð �&‰\˜DÑ ð.ð 
ˆ#ˆsˆ(�^ö.r   