notifly/server.py
def proc_manager(**kwargs):
    """
    Manage nameserver processes
    classes: dict of process categories
    properties: dict of class arguments passed as **kwargs
    runtime: list of running processes
    """
    if 'classes' in kwargs.keys():
        classes = kwargs['classes']
    else:
        sys.exit(1)
    if 'properties' in kwargs.keys():
        properties = kwargs['properties']
    else:
        properties = {}
    if 'runtime' in kwargs.keys():
        runtime = kwargs['runtime']
    else:
        runtime = []
    if not runtime:
        logging.info('we have an empty runtime, a new one is coming up')
        for proc_name, proc_class in classes.items():
            proc_instance = proc_class(**properties)
            proc_instance.start()
            runtime.append(tuple((proc_name, proc_instance)))
    for unix_proc in runtime:
        proc_name = unix_proc[0]
        proc_instance = unix_proc[1]
        if not proc_instance.is_alive():
            logging.info('proc {} died, new instance is on the rise %s' % proc_instance)
            runtime.remove(unix_proc)
            new_instance = classes[proc_name](**properties)
            new_instance.start()
            runtime.append(tuple((proc_name, new_instance)))

    Manage nameserver processes
    classes: dict of process categories
    properties: dict of class arguments passed as **kwargs
    runtime: list of running processes
    
Manage nameserver processes
classes: dict of process categories
properties: dict of class arguments passed as **kwargs
runtime: list of running processes
Manage nameserver processes classes : dict of process categories properties : dict of class arguments passed as ** kwargs runtime : list of running processes
def proc_manager(**kwargs):
    if 'classes' in kwargs.keys():
        classes = kwargs['classes']
    else:
        sys.exit(1)
    if 'properties' in kwargs.keys():
        properties = kwargs['properties']
    else:
        properties = {}
    if 'runtime' in kwargs.keys():
        runtime = kwargs['runtime']
    else:
        runtime = []
    if not runtime:
        logging.info('we have an empty runtime, a new one is coming up')
        for proc_name, proc_class in classes.items():
            proc_instance = proc_class(**properties)
            proc_instance.start()
            runtime.append(tuple((proc_name, proc_instance)))
    for unix_proc in runtime:
        proc_name = unix_proc[0]
        proc_instance = unix_proc[1]
        if not proc_instance.is_alive():
            logging.info('proc {} died, new instance is on the rise %s' % proc_instance)
            runtime.remove(unix_proc)
            new_instance = classes[proc_name](**properties)
            new_instance.start()
            runtime.append(tuple((proc_name, new_instance)))
def proc_manager ( ** kwargs ) : if 'classes' in kwargs . keys ( ) : classes = kwargs [ 'classes' ] else : sys . exit ( 1 ) if 'properties' in kwargs . keys ( ) : properties = kwargs [ 'properties' ] else : properties = { } if 'runtime' in kwargs . keys ( ) : runtime = kwargs [ 'runtime' ] else : runtime = [ ] if not runtime : logging . info ( 'we have an empty runtime, a new one is coming up' ) for proc_name , proc_class in classes . items ( ) : proc_instance = proc_class ( ** properties ) proc_instance . start ( ) runtime . append ( tuple ( ( proc_name , proc_instance ) ) ) for unix_proc in runtime : proc_name = unix_proc [ 0 ] proc_instance = unix_proc [ 1 ] if not proc_instance . is_alive ( ) : logging . info ( 'proc {} died, new instance is on the rise %s' % proc_instance ) runtime . remove ( unix_proc ) new_instance = classes [ proc_name ] ( ** properties ) new_instance . start ( ) runtime . append ( tuple ( ( proc_name , new_instance ) ) )
Manage nameserver processes
classes: dict of process categories
properties: dict of class arguments passed as **kwargs
runtime: list of running processes
Manage nameserver processes classes : dict of process categories properties : dict of class arguments passed as ** kwargs runtime : list of running processes
"""
    Manage nameserver processes
    classes: dict of process categories
    properties: dict of class arguments passed as **kwargs
    runtime: list of running processes
    """