Ë
    /æjZj  ã            %       ó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 d dlm	Z	 d dl
mZ d dlmZ d dlmZ d d	lmZ  G d
„ dee«      Z G d„ dee«      Zej*                  ej,                  ej.                  ej0                  fZdZdZe G d„ d«      «       Ze G d„ d«      «       Ze G d„ d«      «       Ze G d„ d«      «       Ze G d„ d«      «       Z e G d„ d«      «       Z!e G d„ d«      «       Z"e G d„ d«      «       Z#e G d „ d!«      «       Z$e G d"„ d#«      «       Z%e G d$„ d%«      «       Z&e G d&„ d'«      «       Z'd(ee	z  d)efd*„Z(d+ed)efd,„Z)d-e*e   d)efd.„Z+dd/œd0ed1e*e   d2e*e   dz  d)efd3„Z,dd/œd4ed5e*e   d2e*e   dz  d)efd6„Z-d7e*e.   dz  d8e*e.   dz  d)e/ee*e.   f   fd9„Z0dddddd:ddddd;œ
d0ed1e*e   d<e/eef   dz  d=e/eef   dz  d>eez  dz  d?e.e1z  ez  dz  d+edz  d@e/eef   dz  dAe*e   dz  d7e*e.   dz  d8e*e.   dz  dBe2dCedz  dDe*e   dz  dEedz  dFe.dz  d)e/eef   f"dG„Z3y)Hé    N)Ú	dataclass)Údatetime)ÚEnum)ÚPath)ÚAny)Ú	constants)ÚVolume)Úparse_datetimec                   óx   — e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy)ÚJobHardwarea  
    Enumeration of hardware flavors available to run Jobs on the Hub.

    Value can be compared to a string:
    ```py
    assert JobHardware.CPU_BASIC == "cpu-basic"
    ```

    Both enums are kept in sync with the Hub API by `utils/check_hardware_flavors.py`.
    z	cpu-basiczcpu-upgradezcpu-performancezcpu-xlzt4-smallz	t4-mediumÚl4x1Úl4x4Úl40sx1Úl40sx4Úl40sx8z
a10g-smallz
a10g-largeza10g-largex2za10g-largex4z
a100-largeÚa100x4Úa100x8Úh200Úh200x2Úh200x4Úh200x8zrtx-pro-6000zrtx-pro-6000x2zrtx-pro-6000x4zrtx-pro-6000x8N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	CPU_BASICÚCPU_UPGRADEÚCPU_PERFORMANCEÚCPU_XLÚT4_SMALLÚ	T4_MEDIUMÚL4X1ÚL4X4ÚL40SX1ÚL40SX4ÚL40SX8Ú
A10G_SMALLÚ
A10G_LARGEÚA10G_LARGEX2ÚA10G_LARGEX4Ú
A100_LARGEÚA100X4ÚA100X8ÚH200ÚH200X2ÚH200X4ÚH200X8ÚRTX_PRO_6000ÚRTX_PRO_6000X2ÚRTX_PRO_6000X4ÚRTX_PRO_6000X8© ó    ú\/root/repos/pocs/video-evals/.venv/lib/python3.12/site-packages/huggingface_hub/_jobs_api.pyr   r      s�   „ ñ	ð €IØ€KØ'€OØ€Fð €HØ€IØ€DØ€DØ€FØ€FØ€FØ€JØ€JØ!€LØ!€LØ€JØ€FØ€FØ€DØ€FØ€FØ€FØ!€LØ%€NØ%€NØ%�Nr7   r   c                   ó(   — e Zd ZdZdZdZdZdZdZdZ	y)	ÚJobStageav  
    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`, `SCHEDULING`, `RUNNING`.
    Taken from https://github.com/huggingface/moon-landing/blob/main/server/job_types/JobInfo.ts#L61 (private url).
    Ú	COMPLETEDÚCANCELEDÚERRORÚDELETEDÚ
SCHEDULINGÚRUNNINGN)
r   r   r   r   r;   r<   r=   r>   r?   r@   r6   r7   r8   r:   r:   G   s'   „ ñ	ð €IØ€HØ€EØ€GØ€JØ�Gr7   r:   z(ghcr.io/astral-sh/uv:python3.12-bookworm)zhttps://huggingface.co/spaces/zhttps://hf.co/spaces/zhuggingface.co/spaces/zhf.co/spaces/c                   óN   — e Zd ZU eed<   edz  ed<   ee   dz  ed<   edz  ed<   y)Ú	JobStatusÚstageNÚmessageÚexpose_urlsÚssh_url)r   r   r   r:   Ú__annotations__ÚstrÚlistr6   r7   r8   rB   rB   k   s*   … àƒOØ�4‰ZÓØ�c‘˜TÑ!Ó!Ø�4‰ZÔr7   rB   c                   ó,   — e Zd ZU eed<   eed<   eed<   y)ÚJobOwnerÚidÚnameÚtypeN)r   r   r   rH   rG   r6   r7   r8   rK   rK   s   s   … àƒGØ
ƒIØ
„Ir7   rK   c                   ó4   — e Zd ZU dZeed<   ee   ed<   dd„Zy)Ú
JobNetworka  
    Network group a Job joined.

    Args:
        group (`str`):
            Name of the network group, as passed to `network_group=`.
        aliases (`list[str]`):
            Aliases the Job claims in the group, as passed to `network_aliases=`. Empty when none.
    ÚgroupÚaliasesNc                 óL   — |d   | _         |j                  d«      xs g | _        y )NrQ   rR   )rQ   ÚgetrR   ©ÚselfÚkwargss     r8   Ú__init__zJobNetwork.__init__‰   s"   € Ø˜G‘_ˆŒ
Ø—z‘z )Ó,Ò2°ˆ�r7   ©ÚreturnN)r   r   r   r   rH   rG   rI   rX   r6   r7   r8   rP   rP   z   s   … ñð ƒJØ�#‰YÓô3r7   rP   c                   óJ   — e Zd ZU dZedz  ed<   edz  ed<   edz  ed<   dd„Zy)ÚJobDurationsau  
    Timing breakdown for a Job, computed server-side.

    Args:
        scheduling_secs (`int` or `None`):
            Seconds the job spent in the scheduling stage before starting to run.
            `None` if the job never reached the running stage.
        running_secs (`int` or `None`):
            Seconds the job has been or was running. Recomputed on each request
            while the job is in progress. `None` if the job never started running.
        total_secs (`int` or `None`):
            Total seconds elapsed since the job was created. Recomputed on each
            request while the job is in progress.
    NÚscheduling_secsÚrunning_secsÚ
total_secsc                 óè   — |j                  d|j                  d«      «      | _        |j                  d|j                  d«      «      | _        |j                  d|j                  d«      «      | _        y )NÚschedulingSecsr]   ÚrunningSecsr^   Ú	totalSecsr_   )rT   r]   r^   r_   rU   s     r8   rX   zJobDurations.__init__£   sW   € Ø%Ÿz™zÐ*:¸F¿J¹JÐGXÓ<YÓZˆÔØ"ŸJ™J }°f·j±jÀÓ6PÓQˆÔØ Ÿ*™* [°&·*±*¸\Ó2JÓKˆ�r7   rY   )r   r   r   r   ÚintrG   rX   r6   r7   r8   r\   r\   Ž   s-   … ñð ˜4‘ZÓØ˜‘*ÓØ�d‘
ÓôLr7   r\   c                   ó:   — e Zd ZU dZeed<   eed<   dZedz  ed<   y)ÚJobInitiatoraJ  
    Contains information about what triggered a Job.

    Args:
        type (`str`): Initiator kind, for example `"user"`, `"org"`, `"scheduled-job"`, or `"duplicated-job"`.
        id (`str`): Identifier of the initiator.
        name (`str` or `None`): Human-readable name when available, usually for user/org initiators.
    rN   rL   NrM   )r   r   r   r   rH   rG   rM   r6   r7   r8   rf   rf   ©   s!   … ñð ƒIØƒGØ€Dˆ#�‰*Ôr7   rf   c                   ó¨  — e Zd ZU dZeed<   edz  ed<   edz  ed<   edz  ed<   edz  ed<   edz  ed<   ee   dz  ed	<   ee   dz  ed
<   eee	f   dz  ed<   eee	f   dz  ed<   e
dz  ed<   eeef   dz  ed<   ee   dz  ed<   eed<   edz  ed<   eed<   edz  ed<   edz  ed<   edz  ed<   ee   dz  ed<   ee   dz  ed<   eed<   eed<   dd„Zy)ÚJobInfoa'  
    Contains information about a Job.

    Args:
        id (`str`):
            Job ID.
        created_at (`datetime` or `None`):
            When the Job was created.
        started_at (`datetime` or `None`):
            When the Job started running. None while the Job is still scheduling.
        finished_at (`datetime` or `None`):
            When the Job finished. None while the Job is still scheduling or running.
        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. See [`JobHardware`] 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.
        durations (`JobDurations` or `None`):
            Timing breakdown of the Job. Present for all job states including SCHEDULING.
        owner: (`JobOwner` or `None`):
            Owner of the Job, e.g. `JobOwner(id="5e9ecfc04957053f60648a3e", name="lhoestq", type="user")`
        initiator (`JobInitiator` or `None`):
            What triggered the Job, e.g. `JobInitiator(type="scheduled-job", id="...")` for a cron-triggered run.
        expose_urls (`list[str]` or `None`):
            Public URLs through which the Job's exposed ports are reachable (one per exposed port),
            e.g. `["https://687fb701029421ae5549d998--8000.hf.jobs"]`. `None` when no port is exposed.
            Accessing a URL requires an HF token with read access to the Job's namespace, unless the port is public.
        ssh_url (`str` or `None`):
            SSH endpoint of the Job, e.g. `"ssh://687fb701029421ae5549d998@ssh.hf.jobs"`. Only present when the Job
            was started with `ssh=True`. Connecting requires write access to the Job's namespace and an SSH public
            key registered on the Hub (https://huggingface.co/settings/keys).
        network (`JobNetwork` or `None`):
            Network group the Job joined and the aliases it claims, e.g. `JobNetwork(group="train", aliases=["master"])`.
            `None` when the Job was started without `network_group=`.
        retry (`int` or `None`):
            Number of retries configured for the Job (`attempts - 1`).
        expose (`list[int]` or `None`):
            All ports exposed through the Jobs proxy, public ones included.
        expose_public (`list[int]` or `None`):
            Exposed ports reachable without authentication.

    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), started_at=datetime.datetime(2025, 7, 22, 16, 6, 31, 79000, tzinfo=datetime.timezone.utc), finished_at=None, 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), durations=JobDurations(scheduling_secs=6, running_secs=2, total_secs=8), owner=JobOwner(id='5e9ecfc04957053f60648a3e', name='lhoestq', type='user'), initiator=JobInitiator(type='user', id='5e9ecfc04957053f60648a3e', name='lhoestq'), 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'
    ```
    rL   NÚ
created_atÚ
started_atÚfinished_atÚdocker_imageÚspace_idÚcommandÚ	argumentsÚenvironmentÚsecretsÚflavorÚlabelsÚvolumesÚstatusÚ	durationsÚownerÚ	initiatorÚnetworkÚretryÚexposeÚexpose_publicÚendpointÚurlc                 ó   — |d   | _         |j                  d«      xs |j                  d«      }|rt        |«      nd | _        |j                  d«      xs |j                  d«      }|rt        |«      nd | _        |j                  d«      xs |j                  d«      }|rt        |«      nd | _        |j                  d«      xs |j                  d	«      | _        |j                  d
«      xs |j                  d«      | _        |j                  di «      }t        |d   |d   |d   ¬«      | _	        |j                  d«      | _
        |j                  d«      | _        |j                  d«      | _        |j                  d«      | _        |j                  d«      | _        |j                  d«      | _        |j                  d«      }|r|D �cg c]  }t!        d(i |¤Ž‘Œ c}nd | _        |j                  di «      }t%        |d   |j                  d«      |j                  d«      |j                  d«      ¬«      | _        |j                  d«      }	|	rt)        d(i |	¤Žnd | _        |j                  d«      }
|
r#t-        |
d   |
d   |
j                  d«      ¬«      nd | _        |j                  d «      }|rt1        d(i |¤Žnd | _        |j                  d!«      | _        |j                  d"«      xs i }|j                  d#«      | _        |j                  d$«      | _        |j                  d%t:        j<                  «      | _        | j>                  › d&| j                  j@                  › d'| j                   › �| _!        y c c}w ))NrL   Ú	createdAtri   Ú	startedAtrj   Ú
finishedAtrk   ÚdockerImagerl   ÚspaceIdrm   rw   rM   rN   ©rL   rM   rN   rn   ro   rp   rq   rr   rs   rt   ru   rC   rD   Ú
exposeUrlsÚsshUrl)rC   rD   rE   rF   rv   rx   )rN   rL   rM   ry   rz   r{   ÚportsÚportsPublicr}   z/jobs/ú/r6   )"rL   rT   r
   ri   rj   rk   rl   rm   rK   rw   rn   ro   rp   rq   rr   rs   r	   rt   rB   ru   r\   rv   rf   rx   rP   ry   rz   r{   r|   r   ÚENDPOINTr}   rM   r~   )rV   rW   ri   rj   rk   rw   rt   Úvru   rv   rx   ry   r{   s                r8   rX   zJobInfo.__init__$  sØ  € Ø˜‘,ˆŒØ—Z‘Z Ó,ÒH°·
±
¸<Ó0Hˆ
Ù8Bœ.¨Ô4ÈˆŒØ—Z‘Z Ó,ÒH°·
±
¸<Ó0Hˆ
Ù8Bœ.¨Ô4ÈˆŒØ—j‘j Ó.ÒK°&·*±*¸]Ó2KˆÙ:Eœ>¨+Ô6È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¨œ™ ›Ó5ÀdˆŒØ—‘˜H bÓ)ˆÜØ˜‘/Ø—J‘J˜yÓ)ØŸ
™
 <Ó0Ø—J‘J˜xÓ(ô	
ˆŒð —J‘J˜{Ó+ˆ	Ù6?œÑ2¨	Ò2ÀTˆŒØ—J‘J˜{Ó+ˆ	ádmŒL˜i¨Ñ/°I¸d±OÈ)Ï-É-ÐX^ÓJ_Õ`Ðswð 	Œð —*‘*˜YÓ'ˆÙ07”zÑ, GÒ,¸TˆŒØ—Z‘Z Ó(ˆŒ
Ø—‘˜HÓ%Ò+¨ˆØ—j‘j Ó)ˆŒØ#ŸZ™Z¨Ó6ˆÔð Ÿ
™
 :¬y×/AÑ/AÓBˆŒØ—m‘m�_ F¨4¯:©:¯?©?Ð*;¸1¸T¿W¹W¸IÐFˆ�ùò/ 6s   ÇM;rY   )r   r   r   r   rH   rG   r   rI   Údictr   r   r	   rB   r\   rK   rf   rP   rd   rX   r6   r7   r8   rh   rh   ¹   s  … ñMð^ 	ƒGØ˜4‘ÓØ˜4‘ÓØ˜D‘Ó Ø˜‘*ÓØ�D‰jÓØ�#‰Y˜ÑÓØ�C‰y˜4ÑÓØ�c˜3�h‘ $Ñ&Ó&Ø�#�s�(‰^˜dÑ"Ó"Ø˜$ÑÓØ��c�‰N˜TÑ!Ó!Ø�&‰\˜DÑ Ó ØÓØ˜dÑ"Ó"ØƒOØ˜dÑ"Ó"Ø˜$ÑÓØ�‰:ÓØ�‰I˜ÑÓØ˜‘9˜tÑ#Ó#ð ƒMØ	ƒHô*Gr7   rh   c                   óH  — e Zd ZU edz  ed<   edz  ed<   ee   dz  ed<   ee   dz  ed<   eeef   dz  ed<   eeef   dz  ed<   edz  ed<   e	dz  ed	<   ee   dz  ed
<   edz  ed<   eeef   dz  ed<   ee
   dz  ed<   e	dz  ed<   ee	   dz  ed<   ee	   dz  ed<   dd„Zy)ÚJobSpecNrl   rm   rn   ro   rp   rq   rr   ÚtimeoutÚtagsÚarchrs   rt   rz   r{   r|   c                 óR  — |j                  d«      xs |j                  d«      | _        |j                  d«      xs |j                  d«      | _        |j                  d«      | _        |j                  d«      | _        |j                  d«      | _        |j                  d«      | _        |j                  d	«      | _        |j                  d
«      | _        |j                  d«      | _	        |j                  d«      | _
        |j                  d«      | _        |j                  d«      }|r|D �cg c]  }t        di |¤Ž‘Œ c}nd | _        |j                  d«      | _        |j                  d«      xs i }|j                  d«      | _        |j                  d«      | _        y c c}w )Nrƒ   rl   r„   rm   rn   ro   rp   rq   rr   r�   r‘   r’   rs   rt   rz   r{   rˆ   r‰   r6   )rT   rl   rm   rn   ro   rp   rq   rr   r�   r‘   r’   rs   r	   rt   rz   r{   r|   )rV   rW   rt   rŒ   r{   s        r8   rX   zJobSpec.__init__c  sC  € Ø"Ÿ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¨œ™ ›Ó5ÀdˆŒØ—Z‘Z Ó(ˆŒ
Ø—‘˜HÓ%Ò+¨ˆØ—j‘j Ó)ˆŒØ#ŸZ™Z¨Ó6ˆÕùò	 6s   Ä0F$rY   )r   r   r   rH   rG   rI   r�   r   r   rd   r	   rX   r6   r7   r8   r�   r�   Q  s×   … à˜‘*ÓØ�D‰jÓØ�#‰Y˜ÑÓØ�C‰y˜4ÑÓØ�c˜3�h‘ $Ñ&Ó&Ø�#�s�(‰^˜dÑ"Ó"Ø˜$ÑÓØ�4‰ZÓØ
ˆs‰)�dÑ
ÓØ
�‰*ÓØ��c�‰N˜TÑ!Ó!Ø�&‰\˜DÑ Ó Ø�‰:ÓØ�‰I˜ÑÓØ˜‘9˜tÑ#Ó#ô7r7   r�   c                   ó*   — e Zd ZU eed<   eed<   dd„Zy)ÚLastJobInforL   ÚatNc                 ó>   — |d   | _         t        |d   «      | _        y )NrL   r–   )rL   r
   r–   rU   s     r8   rX   zLastJobInfo.__init__|  s   € Ø˜‘,ˆŒÜ  ¨¡Ó.ˆ�r7   rY   )r   r   r   rH   rG   r   rX   r6   r7   r8   r•   r•   w  s   … àƒGØƒLô/r7   r•   c                   ó6   — e Zd ZU edz  ed<   edz  ed<   dd„Zy)ÚScheduledJobStatusNÚlast_jobÚnext_job_run_atc                 ó  — |j                  d«      xs |j                  d«      }|rt        di |¤Žnd | _        |j                  d«      xs |j                  d«      }|rt        t	        |«      «      | _        y d | _        y )NÚlastJobrš   ÚnextJobRunAtr›   r6   )rT   r•   rš   r
   rH   r›   )rV   rW   rš   r›   s       r8   rX   zScheduledJobStatus.__init__†  sj   € Ø—:‘:˜iÓ(ÒB¨F¯J©J°zÓ,BˆÙ3;œÑ/ hÒ/ÀˆŒØ Ÿ*™* ^Ó4ÒU¸¿
¹
ÐCTÓ8UˆÙGVœ~¬c°/Ó.BÓCˆÕÐ\`ˆÕr7   rY   )r   r   r   r•   rG   r   rX   r6   r7   r8   r™   r™   �  s   … à˜DÑ Ó Ø ‘_Ó$ôar7   r™   c                   ó‚   — e Zd ZU dZeed<   edz  ed<   eed<   edz  ed<   edz  ed<   edz  ed<   e	ed	<   e
ed
<   dd„Zy)ÚScheduledJobInfoaÅ  
    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)
    ```
    rL   Nri   Újob_specÚscheduleÚsuspendÚconcurrencyru   rw   c                 óž  — |d   | _         |j                  d«      xs |j                  d«      }|rt        |«      nd | _        t	        di |j                  d«      xs |j                  di «      ¤Ž| _        |j                  d«      | _        |j                  d«      | _        |j                  d«      | _        |j                  d	i «      }t        |j                  d
«      xs |j                  d«      |j                  d«      xs |j                  d«      ¬«      | _
        |j                  di «      }t        |d   |d   |d   ¬«      | _        y )NrL   r€   ri   r¡   ÚjobSpecr¢   r£   r¤   ru   rš   r�   r›   rž   )rš   r›   rw   rM   rN   r…   r6   )rL   rT   r
   ri   r�   r¡   r¢   r£   r¤   r™   ru   rK   rw   )rV   rW   ri   ru   rw   s        r8   rX   z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ˆ�
r7   rY   )r   r   r   r   rH   rG   r   r�   Úboolr™   rK   rX   r6   r7   r8   r    r    �  sN   … ñ&ðP 	ƒGØ˜4‘ÓØÓØ�D‰jÓØ�D‰[ÓØ˜‘ÓØÓØƒOôVr7   r    c                   óL   — e Zd ZU dZeed<   eed<   eed<   eed<   eed<   d	d„Zy)
ÚJobAcceleratoraý  
    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"`.
    rN   ÚmodelÚquantityÚvramÚmanufacturerNc                 óh   — |d   | _         |d   | _        |d   | _        |d   | _        |d   | _        y )NrN   rª   r«   r¬   r­   )rN   rª   r«   r¬   r­   rU   s     r8   rX   zJobAccelerator.__init__é  s<   € Ø˜6‘NˆŒ	Ø˜G‘_ˆŒ
Ø˜zÑ*ˆŒØ˜6‘NˆŒ	Ø" >Ñ2ˆÕr7   rY   )r   r   r   r   rH   rG   rX   r6   r7   r8   r©   r©   Ñ  s(   … ñð  ƒIØƒJØƒMØ
ƒIØÓô3r7   r©   c                   óz   — e Zd ZU dZeed<   eed<   eed<   eed<   eed<   edz  ed<   eed	<   eed
<   eed<   dd„Z	y)ÚJobHardwareInfoa$  
    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"`.
        ephemeral_storage (`str`):
            Ephemeral storage specification, e.g. `"20 GB"`, `"100 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]
    JobHardwareInfo(name='cpu-basic', pretty_name='CPU Basic', cpu='2 vCPU', ram='16 GB', ephemeral_storage='20 GB', accelerator=None, unit_cost_micro_usd=167, unit_cost_usd=0.000167, unit_label='minute')
    >>> hardware_list[0].name
    'cpu-basic'
    ```
    rM   Úpretty_nameÚcpuÚramÚephemeral_storageNÚacceleratorÚunit_cost_micro_usdÚunit_cost_usdÚ
unit_labelc                 ó  — |d   | _         |d   | _        |d   | _        |d   | _        |j	                  dd«      | _        |j	                  d«      }|rt        di |¤Žnd | _        |d   | _        |d	   | _	        |d
   | _
        y )NrM   Ú
prettyNamer²   r³   ÚephemeralStoragezN/Arµ   ÚunitCostMicroUSDÚunitCostUSDÚ	unitLabelr6   )rM   r±   r²   r³   rT   r´   r©   rµ   r¶   r·   r¸   )rV   rW   rµ   s      r8   rX   zJobHardwareInfo.__init__   s�   € Ø˜6‘NˆŒ	Ø! ,Ñ/ˆÔØ˜%‘=ˆŒØ˜%‘=ˆŒØ!'§¡Ð,>ÀÓ!FˆÔØ—j‘j Ó/ˆÙ<Gœ>Ñ8¨KÒ8ÈTˆÔØ#)Ð*<Ñ#=ˆÔ Ø# MÑ2ˆÔØ  Ñ-ˆ�r7   rY   )
r   r   r   r   rH   rG   r©   rd   ÚfloatrX   r6   r7   r8   r°   r°   ñ  sF   … ñ!ðF ƒIØÓØ	ƒHØ	ƒHØÓØ $Ñ&Ó&ØÓØÓØƒOô
.r7   r°   ÚsourcerZ   c                 ó4  — t        | «      j                  «       j                  «       }t        j                  t        j                  «       › d|› �j                  «       «      j                  «       dd }|j                  j                  dd«      xs d}|› d|› �S )a—  Derive a stable remote folder name for a local directory synced as a Job volume.

    The name is `{dirname}-{hash}` where the hash fingerprints the absolute path and the machine's
    hostname: re-syncing the same directory from the same machine reuses the same remote folder
    (so only changed files are re-uploaded), while same-named directories from different paths or
    machines don't collide.
    ú:Né   ú Ú_Úrootú-)r   Ú
expanduserÚresolveÚhashlibÚsha256ÚplatformÚnodeÚencodeÚ	hexdigestrM   Úreplace)rÀ   ÚresolvedÚdigestÚdirnames       r8   Ú_derive_job_volume_namerÔ   -  s†   € ô �F‹|×&Ñ&Ó(×0Ñ0Ó2€HÜ�^‰^œxŸ}™}›Ð/¨q°°
Ð;×BÑBÓDÓE×OÑOÓQÐRTÐSTÐU€FØ�m‰m×#Ñ# C¨Ó-Ò7°€GØˆY�a˜�xÐ Ð r7   rM   c                 ó0   — t        j                  dd| «      S )zþSanitize a string so it is a valid Job `name` label.

    Job names must match `^[a-zA-Z0-9._-]*$` and are also stored as tags, which only allow
    alphanumerics, `-` and `_`. Every other character (including `/`, `:` and `.`) is replaced with `-`.
    z[^a-zA-Z0-9_-]rÇ   )ÚreÚsub)rM   s    r8   Ú_sanitize_job_namerØ   ;  s   € ô �6‰6Ð# S¨$Ó/Ð/r7   Úpartsc                 óˆ   — t        j                  dj                  | «      j                  «       «      j	                  «       dd S )z·Short, stable hash of a Job invocation (image/script + command line).

    Appended to auto-generated names so reruns of the same command share a name while different ones don't.
    ú NrÃ   )rÊ   rË   ÚjoinrÎ   rÏ   )rÙ   s    r8   Ú_short_invocation_hashrÝ   D  s5   € ô
 �>‰>˜&Ÿ+™+ eÓ,×3Ñ3Ó5Ó6×@Ñ@ÓBÀ2ÀAÐFÐFr7   )Úconfig_partsÚimagern   rÞ   c                ó  — t         D ]0  }| j                  |«      sŒt        | t        |«      d xs | «      } n1 t        | j	                  d«      j                  d«      d   xs | «      }|› dt        | g|¢|xs g ¢«      › �S )aQ  Derive a default Job name from a Docker image or Space reference and its command.

    A short hash of the full command line is appended to group reruns of the same command.
    e.g. python:3.12 + [foo, --truc]             -> python-3-12-1a2b3c4d
         hf.co/spaces/lhoestq/duckdb             -> lhoestq-duckdb-<hash>
         pytorch/pytorch:2.6.0-cuda12.4-...      -> pytorch-2-6-0-cuda12-4-...-<hash>

    `config_parts` adds the rest of the resolved launch configuration (flavor, env, ...) to the hash.
    The CLI passes it so that the name reflects the values actually submitted.
    NrŠ   éÿÿÿÿrÇ   )Ú_SPACE_IMAGE_PREFIXESÚ
startswithrØ   ÚlenÚrstripÚsplitrÝ   )rß   rn   rÞ   ÚprefixÚbases        r8   Ú_default_job_name_from_imageré   L  s•   € ô (ò MˆØ×Ñ˜FÕ#Ü% e¬C°«K¨MÐ&:Ò&C¸eÓDˆDÙðMô
 " %§,¡,¨sÓ"3×"9Ñ"9¸#Ó">¸rÑ"BÒ"KÀeÓLˆØˆV�1Ô+¨UÐ,T°WÐ,TÀÒ@RÐPRÐ,TÓUÐVÐWÐWr7   ÚscriptÚscript_argsc                ó$  — | j                  dd«      d   j                  dd«      d   j                  d«      j                  d«      d   }|j                  d«      r|dt        d«        }t	        |xs | «      }|› d	t        | g|¢|xs g ¢«      › �S )
a„  Derive a default Job name from a UV script path, URL, or command and its arguments.

    A short hash of the full command line is appended to group reruns of the same command.
    e.g. my_script.py + [--epochs, 3]  -> my_script-1a2b3c4d
         https://.../sft.py?raw=1      -> sft-<hash>
         lighteval                     -> lighteval-<hash>

    `config_parts` adds the rest of the resolved launch configuration (image, flavor, env, ...) to the
    hash. The CLI passes it so that the name reflects the values actually submitted, including those
    coming from a script's `[tool.hf-jobs]` header rather than from the command line.
    Ú?é   r   ú#rŠ   rá   z.pyNrÇ   )ræ   rå   Úendswithrä   rØ   rÝ   )rê   rë   rÞ   rM   rè   s        r8   Ú_default_job_name_from_scriptrñ   `  s�   € ð �<‰<˜˜QÓ Ñ"×(Ñ(¨¨aÓ0°Ñ3×:Ñ:¸3Ó?×EÑEÀcÓJÈ2ÑN€DØ‡}�}�UÔØ�M”s˜5“z�kÐ"ˆÜ˜dšn fÓ-€DØˆV�1Ô+¨VÐ,Y°kÐ,YÀ\ÒEWÐUWÐ,YÓZÐ[Ð\Ð\r7   r{   r|   c                 ó˜   — t        t        j                  |xs g «      «      }t        t        j                  g | xs g ¢|¢«      «      |dœS )N)rˆ   r‰   )rI   r�   Úfromkeys)r{   r|   Úports_publics      r8   Ú_build_expose_payloadrõ   u  sC   € äœŸ™ mÒ&9°rÓ:Ó;€LÜœ$Ÿ-™-Ð(H¨6ª<°RÐ(H¸<Ð(HÓIÓJÐ[gÑhÐhr7   F)
rM   rs   rt   r{   r|   ÚsshÚnetwork_groupÚnetwork_aliasesÚresource_group_idÚattemptsÚenvrq   rr   r�   rs   rt   rö   r÷   rø   rù   rú   c                 óŽ  — |r|st        d«      ‚|�|�d|v rt        d«      ‚i |xs i ¥d|i¥}|g |xs i |xs t        j                  dœ}|r||d<   |rPdddd	d
œ}t        |t        «      r+|d   |v r$t        t        |d d «      ||d      z  «      |d<   nt        |«      |d<   |�||d<   |r||d<   |r!|D �cg c]  }|j                  «       ‘Œ c}|d<   |	s|
rt        |	|
«      |d<   |rddi|d<   |rd|i}|r||d<   ||d<   |r||d<   t        D ]'  }| j                  |«      sŒ| t        |«      d  |d<    |S  | |d<   |S c c}w )Nz+`network_aliases` requires `network_group`.rM   z>`name` and the `name` key in `labels` cannot both be provided.)rn   ro   rp   rr   rq   rî   é<   i  i€Q )ÚsÚmÚhÚdrá   ÚtimeoutSecondsrú   rs   rt   r{   ÚenabledTrö   rQ   rR   ry   ÚresourceGroupIdr„   rƒ   )Ú
ValueErrorr   r   Ú
isinstancerH   rd   r¿   Úto_dictrõ   râ   rã   rä   )rß   rn   rû   rq   rr   r�   rM   rs   rt   r{   r|   rö   r÷   rø   rù   rú   r¡   Útime_units_factorsÚvolry   rç   s                        r8   Ú_create_job_specr
  {  sÇ  € ñ& ™}ÜÐFÓGÐGØÐØÐ &¨FÑ"2ÜÐ]Ó^Ð^Ø1�V’\˜rÐ1 F¨DÑ1ˆð ØØ’y˜bØÒ1œK×1Ñ1ñ	 €Hñ Ø%ˆ�ÑáØ#$¨2°D¸yÑIÐÜ�gœsÔ#¨°©Ð7IÑ(IÜ),¬U°7¸3¸B°<Ó-@ÐCUÐV]Ð^`ÑVaÑCbÑ-bÓ)cˆHÐ%Ò&ä),¨W«ˆHÐ%Ñ&ØÐØ'ˆ�ÑáØ#ˆ�ÑáØ8?Ö@°˜sŸ{™{�}Ò@ˆ�Ñá‘Ü2°6¸=ÓIˆ�Ñá
Ø$ dÐ+ˆ�‰áØ#*¨MÐ":ˆÙØ!0ˆG�IÑØ%ˆ�ÑáØ&7ˆÐ"Ñ#ä'ò (ˆØ×Ñ˜FÕ#Ø"'¬¨F«¨Ð"6ˆH�YÑØð €Oð(ð
 #(ˆ�ÑØ€Oùò/ As   Â9E)4rÊ   rÌ   rÖ   Údataclassesr   r   Úenumr   Úpathlibr   Útypingr   Úhuggingface_hubr   Úhuggingface_hub._space_apir	   Úhuggingface_hub.utils._datetimer
   rH   r   r:   r;   r<   r=   r>   ÚTERMINAL_JOB_STAGESÚDEFAULT_UV_IMAGErâ   rB   rK   rP   r\   rf   rh   r�   r•   r™   r    r©   r°   rÔ   rØ   rI   rÝ   ré   rñ   rd   r�   rõ   r¿   r§   r
  r6   r7   r8   ú<module>r     s   ðó Û Û 	Ý !Ý Ý Ý Ý å %Ý -Ý :ô(&�#�tô (&ôVˆs�Dô ð,  ×)Ñ)¨8×+<Ñ+<¸h¿n¹nÈh×N^ÑN^Ð_Ð ð >Ð ðÐ ð ÷ð ó ðð ÷ð ó ðð ÷3ð 3ó ð3ð& ÷Lð Ló ðLð4 ÷ð ó ðð ÷TGð TGó ðTGðn ÷"7ð "7ó ð"7ðJ ÷/ð /ó ð/ð ÷að aó ðað ÷@Vð @Vó ð@VðF ÷3ð 3ó ð3ð> ÷8.ð 8.ó ð8.ðv! C¨$¡Jð !°3ó !ð0˜Sð 0 Só 0ðG $ s¡)ð G°ó Gð fjò X¨ð X°d¸3±ið XÐRVÐWZÑR[Ð^bÑRbð XÐnqó Xð* NRò]Øð]Ø" 3™ið]Ø:>¸s¹)ÀdÑ:Jð]àó]ð*i $ s¡)¨dÑ"2ð iÀ4ÈÁ9ÈtÑCSð iÐX\Ð]`ÐbfÐgjÑbkÐ]kÑXló ið Ø$(Ø#'Ø#Ø&*ØØ $Ø(,Ø$(Øò#IàðIð �#‰YðIð 
ˆc�3ˆh‰˜$Ñ	ð	Ið
 �#�s�(‰^˜dÑ"ðIð ˜#Ñ Ñ$ðIð �5‰[˜3Ñ Ñ%ðIð �‰*ðIð ��c�‰N˜TÑ!ðIð �&‰\˜DÑ ðIð �‰I˜ÑðIð ˜‘9˜tÑ#ðIð 
ðIð ˜‘:ðIð ˜#‘Y Ñ%ðIð  ˜T‘zð!Ið" �D‰jð#Ið$ 
ˆ#ˆsˆ(�^ô%Ir7   