def main():
    option_parser, opts, args =\
       parse_command_line_parameters(**script_info)
       
    if opts.submit_jobs and not opts.make_jobs:
        option_parser.error('Must pass -m if passing -s. (Sorry about this, '+\
        'it\'s for backwards-compatibility.)') 

    min_args = 2
    if len(args) != min_args:
        option_parser.error('Program requires <commands file> and  <job prefix>')

    if (len(args[1])>10 or len(args[1])==0):
        option_parser.error('job prefix must be 1-10 characters long')
 
    commands = list(open(args[0]))
    job_prefix = args[1]

    if(not exists(opts.job_dir)):
        try:
            makedirs(opts.job_dir)
        except OSError:
            exit(" Jobs directory can not be created. "
                 +"Check for permissions or file with the same name: %s\n"
                 % opts.job_dir)

    if (opts.make_jobs):
        filenames = make_jobs(commands, job_prefix, opts.queue, opts.job_dir)
    else:
        exit("Should we ever get here???")
    if (opts.submit_jobs):
        submit_jobs(filenames, opts.verbose)
def main():
    option_parser, opts, args =\
       parse_command_line_parameters(**script_info)

    if opts.submit_jobs and not opts.make_jobs:
        option_parser.error('Must pass -m if passing -s. (Sorry about this, '
                            'it\'s for backwards-compatibility.)')

    min_args = 2
    if len(args) != min_args:
        option_parser.error('Program requires <commands file> and '
                            '<job prefix>')

    if (len(args[1]) > 10 or len(args[1]) == 0):
        option_parser.error('job prefix must be 1-10 characters long')

    commands = list(open(args[0]))
    job_prefix = args[1]

    if (not exists(opts.job_dir)):
        try:
            makedirs(opts.job_dir)
        except OSError:
            exit(" Jobs directory can not be created. "
                 "Check for permissions or file with the same name: %s\n" %
                 opts.job_dir)

    if (opts.make_jobs):
        filenames = make_jobs(commands, job_prefix, opts.queue, opts.job_dir,
                              (str(opts.max_walltime) + ":00:00"), opts.cpus,
                              opts.nodes)
    else:
        exit("Should we ever get here???")
    if (opts.submit_jobs):
        submit_jobs(filenames, opts.verbose)
def main():
    option_parser, opts, args = parse_command_line_parameters(**script_info)

    if opts.submit_jobs and not opts.make_jobs:
        option_parser.error("Must pass -m if passing -s. (Sorry about this, " "it's for backwards-compatibility.)")

    min_args = 2
    if len(args) != min_args:
        option_parser.error("Program requires <commands file> and " "<job prefix>")

    if len(args[1]) > 10 or len(args[1]) == 0:
        option_parser.error("job prefix must be 1-10 characters long")

    commands = list(open(args[0]))
    job_prefix = args[1]

    if not exists(opts.job_dir):
        try:
            makedirs(opts.job_dir)
        except OSError:
            exit(
                " Jobs directory can not be created. "
                "Check for permissions or file with the same name: %s\n" % opts.job_dir
            )

    if opts.make_jobs:
        filenames = make_jobs(
            commands, job_prefix, opts.queue, opts.job_dir, (str(opts.max_walltime) + ":00:00"), opts.cpus, opts.nodes
        )
    else:
        exit("Should we ever get here???")
    if opts.submit_jobs:
        submit_jobs(filenames, opts.verbose)
    def test_submit_jobs(self):
        """submit jobs via qsub works"""

        filenames = make_jobs([self.command], "test_qsub", self.queue)
        submit_jobs(filenames)

        for i in range(10):
            if exists(self.tmp_result_file):
                return
            else:
                #wait for job to finish
                sleep(10)
        self.fail("The test job apparently never finished.\n" +
                  "check the jobs error log and check the queue status\n.")
 def test_submit_jobs(self):
     """submit jobs via qsub works"""
     
     filenames = make_jobs([self.command], "test_qsub", self.queue) 
     submit_jobs(filenames)
     
     for i in range(10):
         if exists(self.tmp_result_file):
             return
         else:
             #wait for job to finish
             sleep(10)
     self.fail("The test job apparently never finished.\n"
               +"check the jobs error log and check the queue status\n.")