def function_caller()

in src/local_gpu_verifier/src/verifier/utils/__init__.py [0:0]


def function_caller(inp):
    """ This function is run in a separate thread by 
    function_wrapper_with_timeout function so that if the execution of the
    function passed as an argument takes more than the max threshold time limit then
    the thread is killed.

    Args:
        inp (tuple): the tuple containing the function to be executed and its
                     arguments. 
    """
    assert type(inp) is list

    event = inp[-1]
    q = inp[-2]
    function_name = inp[-3]
    function = inp[0]
    arguments = inp[1:-3]
    
    result = function(*arguments)
    
    if event.is_set():
        event_log.info(f"{function_name} execution timed out, stopping.")
        return

    q.put(result)