PageRenderTime 107ms CodeModel.GetById 99ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/galaxy/jobs/splitters/basic.py

https://bitbucket.org/cistrome/cistrome-harvard/
Python | 24 lines | 17 code | 5 blank | 2 comment | 2 complexity | f15d1b7e4910a624e17bec76d4fc3a49 MD5 | raw file
 1import logging
 2import multi
 3
 4log = logging.getLogger( __name__ )
 5
 6def set_basic_defaults(job_wrapper):
 7    parent_job = job_wrapper.get_job()
 8    parallelism = job_wrapper.get_parallelism()
 9    parallelism.attributes['split_inputs'] = parent_job.input_datasets[0].name
10    parallelism.attributes['merge_outputs'] = job_wrapper.get_output_hdas_and_fnames().keys()[0]
11
12def do_split (job_wrapper):
13    if len(job_wrapper.get_input_fnames()) > 1 or len(job_wrapper.get_output_fnames()) > 1:
14        log.error("The basic splitter is not capable of handling jobs with multiple inputs or outputs.")
15        raise Exception,  "Job Splitting Failed, the basic splitter only handles tools with one input and one output"
16    # add in the missing information for splitting the one input and merging the one output
17    set_basic_defaults(job_wrapper)
18    return multi.do_split(job_wrapper)
19
20def do_merge( job_wrapper,  task_wrappers):
21    # add in the missing information for splitting the one input and merging the one output
22    set_basic_defaults(job_wrapper)
23    return multi.do_merge(job_wrapper,  task_wrappers)
24