Exemple #1
0
def _start_cluster_machine_master(channel, args, main_script, lb_class_name,
        subdomain_addr_map, iface):
    """Starts a machine master process on a remote host.

    This function is executed by the execnet module.  In order for it to work,
    it cannot depend on any global symbols."""
    try:
        import cPickle as pickle
    except ImportError:
        import pickle
    import os
    import platform
    import sys
    import traceback

    early_termination = True
    try:
        sys.path.append(os.path.dirname(main_script))
        import imp

        try:
            main = imp.load_source('main', main_script)
        except:
            main = None
            with open('log%s.txt'%ids,'w') as fp: 
                fp.write('failed imp\n')
                fp.write(str(sys.path)+'\n')
            

        for name in dir(main):
            globals()[name] = getattr(main, name)

        lb_class = globals()[lb_class_name]

        from sailfish.master import LBMachineMaster
        import multiprocessing as mp
        pname = 'Master/{0}'.format(platform.node())
        mp.current_process().name = pname

        master = LBMachineMaster(*pickle.loads(args), lb_class=lb_class,
                subdomain_addr_map=subdomain_addr_map, channel=channel,
                iface=iface)
        early_termination = master.run()
    except Exception:
        # Send any exceptions to the controller to aid
        # debugging.
        channel.send(traceback.format_exc())

    if not early_termination:
        channel.send('FIN')
Exemple #2
0
def _start_cluster_machine_master(channel, args, main_script, lb_class_name,
        subdomain_addr_map, iface):
    """Starts a machine master process on a remote host.

    This function is executed by the execnet module.  In order for it to work,
    it cannot depend on any global symbols."""
    try:
        import cPickle as pickle
    except ImportError:
        import pickle
    import os
    import platform
    import sys
    import traceback

    early_termination = True
    try:
        sys.path.append(os.path.dirname(main_script))
        import imp
        main = imp.load_source('main', main_script)
        for name in dir(main):
            globals()[name] = getattr(main, name)

        lb_class = globals()[lb_class_name]

        from sailfish.master import LBMachineMaster
        import multiprocessing as mp
        pname = 'Master/{0}'.format(platform.node())
        mp.current_process().name = pname

        master = LBMachineMaster(*pickle.loads(args), lb_class=lb_class,
                subdomain_addr_map=subdomain_addr_map, channel=channel,
                iface=iface)
        early_termination = master.run()
    except Exception:
        # Send any exceptions to the controller to aid
        # debugging.
        channel.send(traceback.format_exc())

    if not early_termination:
        channel.send('FIN')
Exemple #3
0
def _start_machine_master(config, subdomains, lb_class):
    """Starts a machine master process locally."""
    from sailfish.master import LBMachineMaster
    master = LBMachineMaster(config, subdomains, lb_class)
    master.run()
    return master
Exemple #4
0
def _start_machine_master(config, subdomains, lb_class):
    """Starts a machine master process locally."""
    from sailfish.master import LBMachineMaster
    master = LBMachineMaster(config, subdomains, lb_class)
    master.run()
    return master