(name)
return decorator
Return runner based on name ( worker or timer ) and settings.TASK_RUNNER.
Return runner based on name ( worker or timer ) and settings.TASK_RUNNER.
Return runner based on name ( worker or timer ) and settings . TASK_RUNNER .
def select_runner(name):
    """
    Return runner based on name ( worker or timer ) and settings.TASK_RUNNER.
    """
    mapper = {
        'block': {'worker': b_worker, 'timer': b_timer},
        'uwsgi': {'worker': u_worker, 'timer': u_timer},
        'celery': {'worker': c_worker, 'timer': c_timer},
        'threaded': {'worker': t_worker, 'timer': t_timer},
        'disable': {'worker': d_worker, 'timer': d_timer},
    }

    if settings.TASK_RUNNER not in mapper:
        logger.error(f"Invalid Task. valid options : {mapper.keys()}")
        raise Exception('Invalid task.')

    # Call primary function here and return worker decorator.
    decorator = mapper.get(settings.TASK_RUNNER)[name]()
    return decorator
def select_runner ( name ) : mapper = { 'block' : { 'worker' : b_worker , 'timer' : b_timer } , 'uwsgi' : { 'worker' : u_worker , 'timer' : u_timer } , 'celery' : { 'worker' : c_worker , 'timer' : c_timer } , 'threaded' : { 'worker' : t_worker , 'timer' : t_timer } , 'disable' : { 'worker' : d_worker , 'timer' : d_timer } , } if settings . TASK_RUNNER not in mapper : logger . error ( f"Invalid Task. valid options : {mapper.keys()}" ) raise Exception ( 'Invalid task.' ) # Call primary function here and return worker decorator. decorator = mapper . get ( settings . TASK_RUNNER ) [ name ] ( ) return decorator