def create_batch_script(self, job_name, dispatcher_string): command = "nice -n 10 " + dispatcher_string days, hours, minutes, seconds = Time.sec_to_all(self.batch_parameters.max_walltime) walltime = '%d:%d:%d' % (days*24 + hours, minutes, seconds) num_nodes = "nodes=1:ppn=" + str(self.batch_parameters.nodes) memory = "pmem=" + str(self.batch_parameters.memory) + "gb" workdir = self.get_job_foldername(job_name) output = workdir + os.sep + BatchClusterComputationEngine.output_filename error = workdir + os.sep + BatchClusterComputationEngine.error_filename job_string = """ #PBS -S /bin/bash #PBS -N %s #PBS -l %s #PBS -l %s #PBS -l %s #PBS -o %s #PBS -e %s cd %s %s""" % (job_name, walltime, num_nodes, memory, output, error, workdir, command) return job_string
def create_batch_script(self, job_name, dispatcher_string, walltime, memory, nodes): command = "nice -n 10 " + dispatcher_string qos = self._infer_slurm_qos(walltime, nodes) days, hours, minutes, seconds = Time.sec_to_all(walltime) walltime = '%d-%d:%d:%d' % (days, hours, minutes, seconds) num_nodes = str(nodes) # note memory is in megabyes memory = str(memory) workdir = self.get_job_foldername(job_name) output = workdir + os.sep + BatchClusterComputationEngine.output_filename error = workdir + os.sep + BatchClusterComputationEngine.error_filename job_strings = ["#!/bin/bash"] job_strings += ["#SBATCH -J %s" % job_name] job_strings += ["#SBATCH --time=%s" % walltime] job_strings += ["#SBATCH --qos=%s" % qos] job_strings += ["#SBATCH -n %s" % num_nodes] job_strings += ["#SBATCH --mem=%s" % memory] job_strings += ["#SBATCH --output=%s" % output] job_strings += ["#SBATCH --error=%s" % error] if self.partition is not None: job_strings += ["#SBATCH --partition=%s" % self.partition] job_strings += ["cd %s" % workdir] job_strings += ["%s" % command] return os.linesep.join(job_strings)
def test_sec_to_all_11(self): secs = 11 days, hours, minutes, seconds = Time.sec_to_all(secs) nose.tools.assert_equal(days, 0) nose.tools.assert_equal(hours, 0) nose.tools.assert_equal(minutes, 0) nose.tools.assert_equal(seconds, 11)
def create_batch_script(self, job_name, dispatcher_string, walltime, memory, nodes): command = "nice -n 10 " + dispatcher_string qos = self._infer_slurm_qos(walltime, nodes) days, hours, minutes, seconds = Time.sec_to_all(walltime) walltime = '%d-%d:%d:%d' % (days, hours, minutes, seconds) num_nodes = str(nodes) # note memory is in megabyes memory = str(memory) workdir = self.get_job_foldername(job_name) output = workdir + os.sep + BatchClusterComputationEngine.output_filename error = workdir + os.sep + BatchClusterComputationEngine.error_filename job_string = """#!/bin/bash #SBATCH -J %s #SBATCH --time=%s #SBATCH --qos=%s #SBATCH -n %s #SBATCH --mem=%s #SBATCH --output=%s #SBATCH --error=%s cd %s %s""" % (job_name, walltime, qos, num_nodes, memory, output, error, workdir, command) return job_string
def test_sec_to_all_100001(self): secs = 100001 days, hours, minutes, seconds = Time.sec_to_all(secs) nose.tools.assert_equal(days, 1) nose.tools.assert_equal(hours, 3) nose.tools.assert_equal(minutes, 46) nose.tools.assert_equal(seconds, 41)
def create_batch_script(self, job_name, dispatcher_string): command = dispatcher_string days, hours, minutes, seconds = Time.sec_to_all( self.batch_parameters.max_walltime) walltime = '%d:%d:%d' % (days * 24, hours, minutes, seconds) memory = str(self.batch_parameters.memory) + "G" workdir = self.get_job_foldername(job_name) output = workdir + os.sep + BatchClusterComputationEngine.output_filename error = workdir + os.sep + BatchClusterComputationEngine.error_filename job_string = \ """#$ -S /bin/bash #$ -N %s #$ -l h_rt=%s #$ -l h_vmem=%s,tmem=%s #$ -o %s #$ -e %s #$ -wd %s source ~/.bash_profile %s""" % (job_name, walltime, memory, memory, output, error, workdir, command) return job_string
def create_batch_script(self, job_name, dispatcher_string): command = dispatcher_string days, hours, minutes, seconds = Time.sec_to_all(self.batch_parameters.max_walltime) walltime = '%d:%d:%d' % (days*24, hours, minutes, seconds) memory = str(self.batch_parameters.memory) + "G" workdir = self.get_job_foldername(job_name) output = workdir + os.sep + BatchClusterComputationEngine.output_filename error = workdir + os.sep + BatchClusterComputationEngine.error_filename job_string = \ """#$ -S /bin/bash #$ -N %s #$ -l h_rt=%s #$ -l h_vmem=%s,tmem=%s #$ -o %s #$ -e %s #$ -wd %s source ~/.bash_profile %s""" % (job_name, walltime, memory, memory, output, error, workdir, command) return job_string