Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 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()
Example #4
0
 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)
Example #5
0
 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)
Example #6
0
 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)
Example #7
0
 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)
Example #8
0
 def test_sge_bad_mail_type(self):
     script = SubmissionScript('',
                               scheduler='SGE',
                               stdout='thing',
                               mail_type='BAD',
                               mail_user='******')
     with self.assertRaises(KeyError):
         header = script.build_header()
Example #9
0
 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)
Example #10
0
 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)
Example #11
0
 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)
Example #12
0
 def test_memory_limit(self):
     script = SubmissionScript('', scheduler='SGE', memory_limit=16)
     self.assertEqual(16, script.memory_limit)
Example #13
0
 def test_import_env(self):
     script = SubmissionScript('', scheduler='SGE', import_env=True)
     header = script.build_header()
     exp = '#$ -V'
     self.assertTrue(exp in header)
Example #14
0
 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)
Example #15
0
 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)
Example #16
0
 def test_no_options(self):
     script = SubmissionScript('', scheduler='SGE')
     header = script.build_header()
     exp = SCHEDULER_CONFIG.SGE.shebang
     self.assertTrue(exp in header)
Example #17
0
 def test_default_weak_override(self):
     script = SubmissionScript('', scheduler='SGE')
     self.assertEqual(OPTIONS.memory_limit, script.memory_limit)
     os.environ['MAVIS_MEMORY_LIMIT'] = '0'
     script = SubmissionScript('', scheduler='SGE')
     self.assertEqual(0, script.memory_limit)
Example #18
0
 def test_unexpected_argument_error(self):
     with self.assertRaises(TypeError):
         SubmissionScript('', scheduler='SGE', blargh='thing')
Example #19
0
 def test_queue(self):
     script = SubmissionScript('', scheduler='SGE', queue='queue')
     self.assertEqual('queue', script.queue)
Example #20
0
 def test_stdout(self):
     script = SubmissionScript('', scheduler='SGE', stdout='stdout')
     self.assertEqual('stdout', script.stdout)
Example #21
0
 def test_jobname(self):
     script = SubmissionScript('', scheduler='SGE', jobname='name')
     self.assertEqual('name', script.jobname)