def run(self, argv): subclass_args = ' '.join(self.prog_args) prog_usage = self.prog_usage parser = optparse.OptionParser("""%prog """ + """%(subclass_args)s %(prog_usage)s""" % locals()) parser.add_option("--time", action="store_true", default=False, dest="time") self.add_option_parser_options(parser) options, args = parser.parse_args(argv) num_args = len(self.prog_args) if len(args) < num_args: parser.error("Required arguments were not provided.") elif len(args) > num_args: parser.error("Too many arguments were not provided.") num_procs = self.num_procs(options, args) script_list_file_name = self.script_list_file_name(options, args) with open(script_list_file_name, 'w') as script_list_file: for script_name, command in self.scripts_and_commands(options, args): sc.run_command_here(script_name, command, job_name=script_name, output_file_name=script_name + '.out', numcpu=str(num_procs), time=options.time) script_list_file.write(script_name + '\n') print 'Wrote %s.' % script_list_file_name
def create_map_client_script(self, tfs, host_address, authkey, map_name): pbs_map_exe=self.pbs_map_exe script_file_name = tfs.temp_file_name('.pbs') # It's not possible for the temp file system to delete files created on the nodes. if os.getenv('DELETE') == 'FALSE': output_file_name = script_file_name + '.out' err_output_file_name = script_file_name + '.err' else: output_file_name = '/dev/null' err_output_file_name = '/dev/null' if configuration.clients_per_pbs > 1: base_command = ["mpiexec", "python"] else: base_command = ["python"] hostname, port = host_address run_command_here(script_file_name, ' '.join(base_command + [pbs_map_exe, hostname, str(port), authkey]), job_name=map_name, output_file_name=output_file_name, err_output_file_name=err_output_file_name, numcpu=configuration.numprocs, numnodes=configuration.numnodes, queue=configuration.queue, walltime=configuration.walltime, mem=configuration.pmem, disable_mpi=True) return script_file_name