Ejemplo n.º 1
0
 def test_process_group_start_base(self, proxy):
     '''basic process group startup'''
     pgroup = ProcessGroup(self.base_spec)
     data = pgroup.prefork()
     pgroup.start()
     proxy.assert_called_with([pgroup.executable] + pgroup.args, pgroup.tag,
             "Job %s/%s/%s" %(pgroup.jobid, pgroup.user, pgroup.id), pgroup.env,
             data, pgroup.runid)
Ejemplo n.º 2
0
 def simulator_init(self, spec, log):
     """Used by BBSimulator to be able to extend BBProcessGroup
     and pass through correct logger"""
     ProcessGroup.__init__(self, spec, log)
     if not self.kernel:
         self.kernel = "default"
     self.building_nodes = []
     self.pinging_nodes = []
     self.nodefile = tempfile.mkstemp()
     os.write(self.nodefile[0], " ".join(self.location))
     os.close(self.nodefile[0])
Ejemplo n.º 3
0
 def __init__(self, spec):
     ProcessGroup.__init__(self, spec, logger)
     if not self.kernel:
         self.kernel = "default"
     self.building_nodes = []
     self.pinging_nodes = []
     self.nodefile = tempfile.mkstemp()
     os.write(self.nodefile[0], " ".join(self.location))
     os.chmod(self.nodefile[1], stat.S_IRUSR|stat.S_IWUSR|stat.S_IRGRP|
               stat.S_IROTH)
     os.close(self.nodefile[0])
Ejemplo n.º 4
0
    def prefork (self):
        ret = {}
        ret = ProcessGroup.prefork(self)

        sim_mode  = get_cluster_system_config("simulation_mode", 'false').lower() in config_true_values
        if not sim_mode:
            nodefile_dir = get_cluster_system_config("nodefile_dir", "/var/tmp")
            self.nodefile = os.path.join(nodefile_dir, "cobalt.%s" % self.jobid)
        else:
            self.nodefile = "fake"

        try:
            #This is the head node, return this to the user.
            rank0 = self.location[0].split(":")[0]
        except IndexError:
            raise ProcessGroupCreationError("no location")

        split_args = self.args
        cmd_args = ['--nf', str(self.nodefile),
                    '--jobid', str(self.jobid),
                    '--cwd', str(self.cwd),]

        qsub_env_list = ["%s=%s" % (key, val) for key, val in self.env.iteritems()]
        for env in qsub_env_list:
            cmd_args.extend(['--env', env])
        cmd_args.append(self.executable)

        logger.debug("sim mode: %s", sim_mode)
        cmd_exe = None
        if sim_mode:
            logger.debug("We are setting up with simulation mode.")
            cmd_exe = get_cluster_system_config("simulation_executable", None)
            if None == cmd_exe:
                logger.critical("Job: %s/%s: Executable for simulator not specified! This job will not run!")
                raise RuntimeError("Unspecified simulation_executable in cobalt config")
        else:
            cmd_exe = get_cluster_system_config('launcher','/usr/bin/cobalt-launcher.py')

        #run the user script off the login node, and on the compute node
        if (get_cluster_system_config("run_remote", 'true').lower() in config_true_values and not sim_mode):
            cmd = ("/usr/bin/ssh", rank0, cmd_exe, ) + tuple(cmd_args) + tuple(split_args)
        else:
            cmd = (cmd_exe,) + tuple(cmd_args) + tuple(split_args)

        ret["cmd" ] = cmd
        ret["args"] = cmd[1:]
        ret["executable"] = cmd[0]
        self.executable = ret["executable"]
        self.cmd = ret["cmd"]
        self.args = list(ret["args"])

        return ret
Ejemplo n.º 5
0
 def __init__(self, spec):
     ProcessGroup.__init__(self, spec, logger)
     self.nodect = None
     self.script_id = None
Ejemplo n.º 6
0
 def __init__(self, spec):
     ProcessGroup.__init__(self, spec)
     self.nodect = spec.get("nodect", None)
Ejemplo n.º 7
0
 def __init__(self, spec):
     ProcessGroup.__init__(self, spec, logger)
     self.signals = []
Ejemplo n.º 8
0
 def __init__(self, spec):
     ProcessGroup.__init__(self, spec, logger)
     self.nodefile = ""
     self.start()
Ejemplo n.º 9
0
 def __init__(self, spec):
     spec['forker'] = "user_script_forker"
     ProcessGroup.__init__(self, spec)
     self.nodefile = ""
     self.label = "%s/%s/%s" % (self.jobid, self.user, self.id)
     self.start()
Ejemplo n.º 10
0
 def __init__(self, spec):
     spec['forker'] = "user_script_forker"
     ProcessGroup.__init__(self, spec)
     self.nodefile = ""
     self.label = "%s/%s/%s" %(self.jobid, self.user, self.id)
     self.start()
Ejemplo n.º 11
0
 def __init__(self, spec):
     ProcessGroup.__init__(self, spec, logger)
     self.nodefile = ""
     self.start()
Ejemplo n.º 12
0
 def __init__(self, spec):
     spec['forker'] = "cluster_run_forker"
     ProcessGroup.__init__(self, spec)
     self.nodefile = ""
     self.start()