
    tniI                         d Z ddlZddlZddlmZmZ ddlmZmZm	Z	m
Z
  ej                    Z e	j                    ZdefdZdeeef         ddfdZdeeef         ddfd	ZdS )
zz
runpod | serverless | worker_loop.py
Called to convert a container into a worker pod for the runpod serverless platform.
    N)AnyDict)	rp_loggerrp_localrp_pingrp_scalereturnc                     | d                              dd          rdS t          j                             dd          dS dS )z?Returns True if the worker is running locally, False otherwise.rp_args
test_inputNTRUNPOD_WEBHOOK_GET_JOBF)getosenvironconfigs    U/var/www/html/gpu-tools/venv/lib/python3.11/site-packages/runpod/serverless/worker.py	_is_localr      sE    i\400 t	z~~.55=t5    r   c                     t                                            t          j        |           }|                                 dS )a!  
    Starts the worker loop for multi-processing.

    This function is called when the worker is running on Runpod. This function
    starts a loop that runs indefinitely until the worker is killed.

    Args:
        config (Dict[str, Any]): Configuration parameters for the worker.
    N)	heartbeat
start_pingr   	JobScalerstart)r   
job_scalers     r   
run_workerr      s@      #F++Jr   c                     t          |           r(t          j        t          j        |                      dS t          |            dS )z
    Checks if the worker is running locally or on Runpod.
    If running locally, the test job is run and the worker exits.
    If running on Runpod, the worker loop is created.
    N)r   asynciorunr   	run_localr   r   s    r   mainr!   .   sK      H&v..///// 	6r   )__doc__r   r   typingr   r   runpod.serverless.modulesr   r   r   r   RunPodLoggerlog	Heartbeatr   boolr   strr   r!    r   r   <module>r+      s    
  				         L L L L L L L L L L L LiG	    tCH~ $    $
c3h 
D 
 
 
 
 
 
r   