Beispiel #1
0
    def test_ok_run(self):
        argv = ['run', '-d', '/path/to/dir']

        args = utils.get_args(argv)
        self.assertEqual(args.directory, '/path/to/dir')
        self.assertEqual(args.force_qc, False)
        self.assertEqual(args.email_list, None)
Beispiel #2
0
    def test_ok_step(self):
        argv = ['step', '-d', '/path/to/dir', '-s', '001']

        args = utils.get_args(argv)
        self.assertEqual(args.directory, '/path/to/dir')
        self.assertEqual(args.step, 1)
        self.assertEqual(args.force_qc, False)
Beispiel #3
0
    def test_sub_array_for_cmdfile(self):
        sched = Local()
        cmdfile = self.datadir + "/cmdfiles/sleeper.sh"
        argv = ['sub', '-P', 'project', '-q', 'normal', '-K',
                '-M', '500', '-o', 'tmp/out.%J.%I.txt', '-e',
                'tmp/err.%J.%I.txt', '-i', cmdfile]

        args = utils.get_args(argv)

        array_ids = sched.sub_array_for_cmdfile(args)
        self.assertTrue(isinstance(array_ids, list))
        self.assertEqual(len(array_ids), 1)
Beispiel #4
0
    def test_jobs_from_arrays(self):
        lsf = LSF()
        cmdfile = self.datadir + "/cmdfiles/sleeper.sh"
        argv = [
            'sub', '-P', 'project', '-q', 'normal', '-K', '-M', '500', '-o',
            'tmp/out.%J.%I.txt', '-e', 'tmp/err.%J.%I.txt', '-S', '3', '-i',
            cmdfile
        ]

        args = utils.get_args(argv)

        array_ids = lsf.sub_array_for_cmdfile(args)
        jobs = lsf.jobs_from_arrays(array_ids)
        self.assertEqual(len(jobs), 4)
Beispiel #5
0
    def test_sub_array_for_cmdfile_split(self):
        lsf = LSF()
        cmdfile = self.datadir + "/cmdfiles/sleeper.sh"
        argv = [
            'sub', '-P', 'project', '-q', 'normal', '-K', '-M', '500', '-o',
            'tmp/out.%J.%I.txt', '-e', 'tmp/err.%J.%I.txt', '-S', '3', '-i',
            cmdfile
        ]

        args = utils.get_args(argv)

        array_ids = lsf.sub_array_for_cmdfile(args)
        self.assertTrue(isinstance(array_ids, list))
        self.assertEqual(len(array_ids), 2)
        for array_id in array_ids:
            self.assertTrue(utils.isint(array_id))
Beispiel #6
0
    def test_ok_sub(self):
        argv = [
            'sub', '-P', 'project', '-q', 'normal', '-n', '5', '-K', '-s',
            'LSF', '-M', '500', '-o', 'out.%J.%I.txt', '-e', 'err.%J.%I.txt',
            '-i', 'cmds.sh'
        ]

        args = utils.get_args(argv)
        self.assertEqual(args.project, 'project')
        self.assertEqual(args.queue, 'normal')
        self.assertEqual(args.ncores, 5)
        self.assertTrue(args.hang)
        self.assertEqual(args.system, 'LSF')
        self.assertEqual(args.stdout, 'out.%J.%I.txt')
        self.assertEqual(args.stderr, 'err.%J.%I.txt')
        self.assertEqual(args.cmdfile, 'cmds.sh')
Beispiel #7
0
def main():
    """ Main routine """
    args = utils.get_args(sys.argv[1:])
    action = sys.argv[1]

    if action == "sub":
        if not args.system:
            args.system = detect_scheduler()
        if not args.jobname:
            args.jobname = os.path.basename(args.cmdfile)
        core.phoenix_sub(args)
    elif action == "step":
        core.phoenix_step(args.directory, args.step, args.force_qc)
    elif action == "run":
        core.phoenix_run(args.directory, args.step, args.email_list)
    else:
        sys.exit("ERROR: Unknown action '{}'".format(action))