def test_slurm_bad_mail_type(self): script = SubmissionScript('', scheduler='SLURM', stdout='thing', mail_type='FAIL,BAD', mail_user='******') with self.assertRaises(KeyError): header = script.build_header() script = SubmissionScript('', scheduler='SLURM', stdout='thing', mail_type='BAD', mail_user='******') with self.assertRaises(KeyError): header = script.build_header()
def test_slurm_mail_option_from_env(self): os.environ['MAVIS_MAIL_TYPE'] = 'ALL' os.environ['MAVIS_MAIL_USER'] = '******' script = SubmissionScript('', scheduler='SLURM') header = script.build_header() self.assertTrue('#SBATCH --mail-user=someone' in header) self.assertTrue('#SBATCH --mail-type=ALL' in header)
def test_sge_mail_option_from_env(self): os.environ['MAVIS_MAIL_TYPE'] = 'ALL' os.environ['MAVIS_MAIL_USER'] = '******' script = SubmissionScript('', scheduler='SGE') header = script.build_header() self.assertTrue('#$ -M someone' in header) self.assertTrue('#$ -m abes' in header)
def test_slurm_mail_user_only(self): script = SubmissionScript('', scheduler='SLURM', stdout='thing', mail_user='******') header = script.build_header() exp = '#SBATCH --mail-user=someone' self.assertTrue(exp in header)
def test_sge_mail_user_only(self): script = SubmissionScript('', scheduler='SGE', stdout='thing', mail_user='******') header = script.build_header() exp = '#$ -M someone' self.assertTrue(exp in header)
def test_slurm_mail_type_no_user(self): script = SubmissionScript('', scheduler='SLURM', stdout='thing', mail_type='ALL') header = script.build_header() exp = '#SBATCH --mail-type=ALL' self.assertTrue(exp not in header)
def test_sge_mail_type_no_user(self): script = SubmissionScript('', scheduler='SGE', stdout='thing', mail_type='ALL') header = script.build_header() exp = '#$ -m abes' self.assertTrue(exp not in header)
def test_sge_mail_type_none_mix(self): script = SubmissionScript('', scheduler='SGE', stdout='thing', mail_type='ALL,NONE', mail_user='******') with self.assertRaises(ValueError): header = script.build_header()
def test_sge_multiple_mail_options(self): script = SubmissionScript('', scheduler='SGE', stdout='thing', mail_type='FAIL,ALL', mail_user='******') header = script.build_header() self.assertTrue('#$ -M someone' in header) self.assertTrue('#$ -m abes' in header)
def test_slurm_multiple_mail_types(self): script = SubmissionScript('', scheduler='SLURM', stdout='thing', mail_type='FAIL,ALL', mail_user='******') header = script.build_header() self.assertTrue('#SBATCH --mail-user=someone' in header) self.assertTrue('#SBATCH --mail-type=ALL,FAIL' in header)
def test_sge_mail_fail(self): script = SubmissionScript('', scheduler='SGE', stdout='thing', mail_type='FAIL', mail_user='******') header = script.build_header() print(header) self.assertTrue('#$ -M someone' in header) self.assertTrue('#$ -m as' in header)
def test_import_env(self): script = SubmissionScript('', scheduler='SGE', import_env=True) header = script.build_header() exp = '#$ -V' self.assertTrue(exp in header)
def test_stdout(self): script = SubmissionScript('', scheduler='SGE', stdout='thing') header = script.build_header() exp = '#$ -o thing/sge-$JOB_NAME-$JOB_ID.log' self.assertTrue(exp in header)
def test_memory_limit(self): script = SubmissionScript('', scheduler='SGE', memory_limit=6000) header = script.build_header() exp = '#$ -l mem_free={0}G,mem_token={0}G,h_vmem={0}G'.format(6) self.assertTrue(exp in header)
def test_no_options(self): script = SubmissionScript('', scheduler='SGE') header = script.build_header() exp = SCHEDULER_CONFIG.SGE.shebang self.assertTrue(exp in header)