Ejemplo n.º 1
0
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_sge_jobs(commands, job_prefix, opts.queue,
                                  opts.job_dir, opts.num_jobs)
    else:
        exit("Should we ever get here???")
    if (opts.submit_jobs):
        submit_cluster_jobs(filenames, opts.verbose, delay=opts.delay)
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_torque_jobs(commands, job_prefix, opts.queue, opts.job_dir,opts.num_jobs)
    else:
        exit("Should we ever get here???")
    if (opts.submit_jobs):
        submit_cluster_jobs(filenames, opts.verbose)