Example #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)
Example #2
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
Example #3
0
    def prefork (self):
        ret = {}
        ret = ProcessGroup.prefork(self)

        sim_mode  = get_orcm_system_config("simulation_mode", 'false').lower() in config_true_values
        if not sim_mode:
            nodefile_dir = get_orcm_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)

        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_orcm_system_config('launcher','/usr/bin/cobalt-launcher.py')

        #run the user script off the login node, and on the compute node
        if (get_orcm_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