ó
    Ú°›j/9  ã            -       ó2  • S 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  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  SES\\   S\4S jjrSES\S\\   S\4S jjrSES\\   S\4S jjrSFS\S\S\\   4S jjrSES\\   S\4S jjrSES\S\\   4S jjr                      SGS\S\\   S\\   S\S\S\S\\   S\\   S \S!\S"\\   S#\S$\S%\S&\\   S'\S(\\   S)\\   S*\\   S+\\   S,\\   S\4,S- jjr S\4S. jr!S\S \4S/ jr"S\4S0 jr#        SHS\S\S1\S"\S!\S'\S&\S(\S2\S3\4S4 jjr$S\4S5 jr%           SIS\S)\S6\S*\S7\S8\S9\S:\S;\S<\S+\S \4S= jjr&S>\S)\4S? jr'S\S@\SA\4SB jr(S3\S@\SA\4SC jr)S3\4SD jr*g)Jz%
Runpod | API Wrapper | CTL Commands
é    )ÚOptionalé   )Úrun_graphql_query)Úcontainer_register_auth)Ú	endpoints)Úpods)Ú	templates)Úuser)ÚgpusNÚapi_keyÚreturnc                 óF   • [        [        R                  U S9nUS   S   nU$ )zr
Get the current user with optional API key override.

Args:
    api_key: Optional API key to use for this query.
©r   ÚdataÚmyself)r   Úuser_queriesÚ
QUERY_USER©r   Úraw_responseÚcleaned_returns      ÚT/home/mande/repo/quber/.venv/lib/python3.13/site-packages/runpod/api/ctl_commands.pyÚget_userr      s+   € ô %¤\×%<Ñ%<ÀgÑN€LØ! &Ñ)¨(Ñ3€NØÐó    Úpubkeyc                 óR   • [        [        R                  " U 5      US9nUS   S   nU$ )z|
Update the current user

Args:
    pubkey: the public key of the user
    api_key: Optional API key to use for this query.
r   r   ÚupdateUserSettings)r   Úuser_mutationsÚgenerate_user_mutation)r   r   r   r   s       r   Úupdate_user_settingsr   !   s7   € ô %Ü×-Ò-¨fÓ5Øñ€Lð " &Ñ)Ð*>Ñ?€NØÐr   c                 óF   • [        [        R                  U S9nUS   S   nU$ )zO
Get all GPU types

Args:
    api_key: Optional API key to use for this query.
r   r   ÚgpuTypes)r   r   ÚQUERY_GPU_TYPESr   s      r   Úget_gpusr#   1   s+   € ô %¤T×%9Ñ%9À7ÑK€LØ! &Ñ)¨*Ñ5€NØÐr   Úgpu_idÚgpu_quantityc                 óŒ   • [        [        R                  " X5      US9nUS   S   n[        U5      S:  a  [	        S5      eUS   $ )z¬
Get a specific GPU type

Args:
    gpu_id: the id of the gpu
    gpu_quantity: how many of the gpu should be returned
    api_key: Optional API key to use for this query.
r   r   r!   r   zSNo GPU found with the specified ID, run runpod.get_gpus() to get a list of all GPUsr   )r   r   Úgenerate_gpu_queryÚlenÚ
ValueError)r$   r%   r   r   r   s        r   Úget_gpur*   =   s\   € ô %Ü×Ò Ó5Øñ€Lð
 " &Ñ)¨*Ñ5€Nä
ˆ>Ó˜QÓÜð>ó
ð 	
ð
 ˜!ÑÐr   c                 óL   • [        [        R                  U S9nUS   S   S   nU$ )zJ
Get all pods

Args:
    api_key: Optional API key to use for this query.
r   r   r   r   )r   Úpod_queriesÚ	QUERY_POD)r   Ú
raw_returnr   s      r   Úget_podsr/   V   s0   € ô #¤;×#8Ñ#8À'ÑJ€JØ Ñ'¨Ñ1°&Ñ9€NØÐr   Úpod_idc                 óN   • [        [        R                  " U 5      US9nUS   S   $ )zn
Get a specific pod

Args:
    pod_id: the id of the pod
    api_key: Optional API key to use for this query.
r   r   Úpod)r   r,   Úgenerate_pod_query)r0   r   r   s      r   Úget_podr4   b   s1   € ô %Ü×&Ò& vÓ.Øñ€Lð ˜Ñ Ñ&Ð&r   ÚnameÚ
image_nameÚgpu_type_idÚ
cloud_typeÚsupport_public_ipÚ	start_sshÚdata_center_idÚcountry_codeÚ	gpu_countÚvolume_in_gbÚcontainer_disk_in_gbÚmin_vcpu_countÚmin_memory_in_gbÚdocker_argsÚportsÚvolume_mount_pathÚenvÚtemplate_idÚnetwork_volume_idÚallowed_cuda_versionsÚinstance_idc                 ó„  • U(       d  U(       d  [        S5      eUb  [        U5        US;  a  [        S5      eU(       a)  Uc&  [        5       nUS    H  nUS   U:X  d  M  US   n  O   U
c  Uc  Sn
[        [        R
                  " U UUUUUUUUb  UOSU	U
UUUUUUUUUUUU5      5      nUb
  US	   S
   nU$ US	   S   nU$ )aÇ  
Create a pod

:param name: the name of the pod
:param image_name: the name of the docker image to be used by the pod
:param gpu_type_id: the gpu type wanted by the pod (retrievable by get_gpus). If None, creates a CPU-only pod
:param cloud_type: if secure cloud, community cloud or all is wanted
:param data_center_id: the id of the data center
:param country_code: the code for country to start the pod in
:param gpu_count: how many gpus should be attached to the pod (ignored for CPU-only pods)
:param volume_in_gb: how big should the pod volume be
:param ports: the ports to open in the pod, example format - "8888/http,666/tcp"
:param volume_mount_path: where to mount the volume?
:param env: the environment variables to inject into the pod,
            for example {EXAMPLE_VAR:"example_value", EXAMPLE_VAR2:"example_value 2"}, will
            inject EXAMPLE_VAR and EXAMPLE_VAR2 into the pod with the mentioned values
:param template_id: the id of the template to use for the pod
:param min_download: minimum download speed in Mbps
:param min_upload: minimum upload speed in Mbps
:param instance_id: the id of a specific instance to deploy to (for CPU pods)
:example:

>>> # Create GPU pod
>>> pod_id = runpod.create_pod("test", "runpod/stack", "NVIDIA GeForce RTX 3070")
>>> # Create CPU pod
>>> pod_id = runpod.create_pod("test", "runpod/stack")
>>> # Create CPU pod on specific instance
>>> pod_id = runpod.create_pod("test", "runpod/stack", instance_id="cpu3c-2-4")
z1Either image_name or template_id must be providedN)ÚALLÚ	COMMUNITYÚSECUREz2cloud_type must be one of ALL, COMMUNITY or SECUREÚnetworkVolumesÚidÚdataCenterIdé
   r   ÚpodFindAndDeployOnDemandÚdeployCpuPod)r)   r*   r   r   Úpod_mutationsÚ generate_pod_deployment_mutation)r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   Úmin_downloadÚ
min_uploadrI   Ú	user_infoÚnetwork_volumer   Úcleaned_responses                              r   Ú
create_podr[   q   s#  € öp žkÜÐLÓMÐMàÑÜ�ÔØÐ7Ó7ÜÐMÓNÐNæ˜^Ñ3Ü“Jˆ	Ø'Ð(8Ô9ˆNØ˜dÑ#Ð'8Õ8Ø!/°Ñ!?�Ùñ :ð
 Ñ#¨Ñ(;Ø!Ðä$Ü×6Ò6ØØØØØØØØØ$Ñ0‰I°dØØ ØØØØØØØØØ!ØØØó/	
ó€Lð8 ÑØ'¨Ñ/Ð0JÑKÐð Ðð (¨Ñ/°Ñ?ÐØÐr   c                 óT   • [        [        R                  " U 5      5      nUS   S   nU$ )z¨
Stop a pod

:param pod_id: the id of the pod

:example:

>>> pod_id = runpod.create_pod("test", "runpod/stack", "NVIDIA GeForce RTX 3070")
>>> runpod.stop_pod(pod_id)
r   ÚpodStop)r   rT   Úgenerate_pod_stop_mutation)r0   r   rZ   s      r   Ústop_podr_   Þ   s/   € ô %¤]×%MÒ%MÈfÓ%UÓV€Là# FÑ+¨IÑ6ÐØÐr   c                 óT   • [        [        R                  " X5      5      nUS   S   nU$ )a  
Resume a pod

:param pod_id: the id of the pod
:param gpu_count: the number of GPUs to attach to the pod

:example:

>>> pod_id = runpod.create_pod("test", "runpod/stack", "NVIDIA GeForce RTX 3070")
>>> runpod.stop_pod(pod_id)
>>> runpod.resume_pod(pod_id)
r   Ú	podResume)r   rT   Úgenerate_pod_resume_mutation)r0   r=   r   rZ   s       r   Ú
resume_podrc   ï   s4   € ô %Ü×2Ò2°6ÓEó€Lð $ FÑ+¨KÑ8ÐØÐr   c                 óB   • [        [        R                  " U 5      5        g)z²
Terminate a pod

:param pod_id: the id of the pod

:example:

>>> pod_id = runpod.create_pod("test", "runpod/stack", "NVIDIA GeForce RTX 3070")
>>> runpod.terminate_pod(pod_id)
N)r   rT   Úgenerate_pod_terminate_mutation)r0   s    r   Úterminate_podrf     s   € ô ”m×CÒCÀFÓKÕLr   Údocker_start_cmdÚis_serverlessÚregistry_auth_idc
                 ó^   • [        [        R                  " U UUUUUUUUU	S9
5      n
U
S   S   $ )a  
Create a template

:param name: the name of the template
:param image_name: the name of the docker image to be used by the template
:param docker_start_cmd: the command to start the docker container with
:param container_disk_in_gb: how big should the container disk be
:param volume_in_gb: how big should the volume be
:param ports: the ports to open in the pod, example format - "8888/http,666/tcp"
:param volume_mount_path: where to mount the volume?
:param env: the environment variables to inject into the pod,
            for example {EXAMPLE_VAR:"example_value", EXAMPLE_VAR2:"example_value 2"}, will
            inject EXAMPLE_VAR and EXAMPLE_VAR2 into the pod with the mentioned values
:param is_serverless: is the template serverless?
:param registry_auth_id: the id of the registry auth

:example:

>>> template_id = runpod.create_template("test", "runpod/stack", "python3 main.py")
)
r5   r6   rg   r?   r>   rD   rC   rE   rh   ri   r   ÚsaveTemplate)r   Útemplate_mutationsÚgenerate_pod_template)r5   r6   rg   r?   r>   rD   rC   rE   rh   ri   r   s              r   Úcreate_templatern     sM   € ô@ %Ü×0Ò0ØØ!Ø-Ø!5Ø%Ø/ØØØ'Ø-ñ	
ó€Lð ˜Ñ Ñ/Ð/r   c                  óN   • [        [        R                  5      n U S   S   S   nU$ )z
Get all endpoints
r   r   r   )r   Úendpoint_queriesÚQUERY_ENDPOINT)r.   r   s     r   Úget_endpointsrr   D  s/   € ô #Ô#3×#BÑ#BÓC€JØ Ñ'¨Ñ1°+Ñ>€NØÐr   Úgpu_idsÚ	locationsÚidle_timeoutÚscaler_typeÚscaler_valueÚworkers_minÚworkers_maxc                 óh   • [        [        R                  " U UUUUUUUUU	U
UU5      5      nUS   S   $ )aY  
Create an endpoint

:param name: the name of the endpoint
:param template_id: the id of the template to use for the endpoint
:param gpu_ids: the ids of the GPUs to use for the endpoint
:param network_volume_id: the id of the network volume to use for the endpoint
:param locations: the locations to use for the endpoint
:param idle_timeout: the idle timeout for the endpoint
:param scaler_type: the scaler type for the endpoint
:param scaler_value: the scaler value for the endpoint
:param workers_min: the minimum number of workers for the endpoint
:param workers_max: the maximum number of workers for the endpoint
:param allowed_cuda_versions: Comma-separated list of allowed CUDA versions (e.g., ["12.4", "12.5"]).
:param gpu_count: the number of GPUs to use for the endpoint

:example:

>>> endpoint_id = runpod.create_endpoint("test", "template_id")
r   ÚsaveEndpoint)r   Úendpoint_mutationsÚgenerate_endpoint_mutation)r5   rF   rs   rG   rt   ru   rv   rw   rx   ry   Ú	flashbootrH   r=   r   s                 r   Úcreate_endpointr   M  sV   € ôF %Ü×5Ò5ØØØØØØØØØØØØ!Øó	
ó€Lð$ ˜Ñ Ñ/Ð/r   Úendpoint_idc                 óP   • [        [        R                  " X5      5      nUS   S   $ )zá
Update an endpoint template

:param endpoint_id: the id of the endpoint
:param template_id: the id of the template to use for the endpoint

:example:

>>> endpoint_id = runpod.update_endpoint_template("test", "template_id")
r   ÚupdateEndpointTemplate)r   r|   Ú!update_endpoint_template_mutation)r€   rF   r   s      r   Úupdate_endpoint_templater„   …  s/   € ô %Ü×<Ò<¸[ÓVó€Lð ˜ÑÐ 8Ñ9Ð9r   ÚusernameÚpasswordc                 óR   • [        [        R                  " XU5      5      nUS   S   $ )a0  
Create a container registry authentication.

Args:
    name (str): The name of the container registry.
    username (str): The username for authentication.
    password (str): The password for authentication.

Returns:
    dict: The response data containing the saved container registry authentication.
r   ÚsaveRegistryAuth)r   Ú!container_register_auth_mutationsÚ generate_container_registry_auth)r5   r…   r†   r   s       r   Úcreate_container_registry_authr‹   —  s4   € ô %Ü)×JÒJØ˜Hó	
ó€Lð
 ˜ÑÐ 2Ñ3Ð3r   c                 óR   • [        [        R                  " XU5      5      nUS   S   $ )aJ  
Update a container registry authentication.

Args:
    registry_auth_id (str): The id of the container registry authentication
    username (str): The username for authentication.
    password (str): The password for authentication.

Returns:
    dict: The response data containing the updated container registry authentication.
r   ÚupdateRegistryAuth)r   r‰   Úupdate_container_registry_auth)ri   r…   r†   r   s       r   rŽ   rŽ   «  s4   € ô %Ü)×HÒHØ¨ó	
ó€Lð
 ˜ÑÐ 4Ñ5Ð5r   c                 óP   • [        [        R                  " U 5      5      nUS   S   $ )z€
Delete a container registry authentication.

Args:
    registry_auth_id (str): The id of the container registry authentication
r   ÚdeleteRegistryAuth)r   r‰   Údelete_container_registry_auth)ri   r   s     r   r‘   r‘   ¿  s2   € ô %Ü)×HÒHØó	
ó€Lð
 ˜ÑÐ 4Ñ5Ð5r   )N)r   N)Ú NrK   TTNNr   r   Nr   r   r’   Nz/runpod-volumeNNNNNNN)NrQ   NNNNFN)Ú	AMPERE_16NNé   ÚQUEUE_DELAYé   r   é   FNr   )+Ú__doc__Útypingr   Úgraphqlr   Ú	mutationsr   r‰   r   r|   r   rT   r	   rl   r
   r   Úqueriesrp   r   r,   r   ÚstrÚdictr   r   r#   Úintr*   r/   r4   ÚboolÚlistr[   r_   rc   rf   rn   rr   r   r„   r‹   rŽ   r‘   © r   r   Ú<module>r£      sÔ  ðñõ å &Ý SÝ 6Ý ,Ý 6Ý -Ý 2Ý Ý (Ý )ñ	�h˜s‘mð 	¨tõ 	ñ ð ¨x¸©}ð Èõ ñ 	�h˜s‘mð 	¨tõ 	ñ�Cð  sð ¸À#¹õ ñ2	�h˜s‘mð 	¨tõ 	ñ'�Cð ' (¨3¡-õ 'ð" !#Ø!%ØØ"ØØ$(Ø"&ØØØ*.ØØØØØ-ØØ!%Ø'+Ø,0ØØØ!%ñ/jØ
ðjà˜‘ðjð ˜#‘ðjð ð	jð
 ðjð ðjð ˜S‘Mðjð ˜3‘-ðjð ðjð ðjð # 3™-ðjð ðjð ðjð ðjð �C‰=ðjð  ð!jð" 
�$‰ð#jð$ ˜#‘ð%jð&   ‘}ð'jð( $ D™>ð)jð. ˜#‘ð/jð0 
õ1jðZ�Sô ð"�sð  sô ð*M˜#ô Mð" !Ø "ØØ!ØØØØ ñ/0Ø
ð/0àð/0ð ð/0ð ð	/0ð
 ð/0ð ð/0ð ð/0ð 
ð/0ð ð/0ð õ/0ðd�tô ð Ø!ØØØ$ØØØØØ!%Øñ50Ø
ð50àð50ð ð50ð ð	50ð
 ð50ð ð50ð ð50ð ð50ð ð50ð ð50ð ð50ð õ50ðp:¨#ð :¸Cô :ð$4¨ð 4¸ð 4Àsô 4ð(6°Sð 6ÀCð 6ÐSVô 6ð(6°Sõ 6r   