Created
March 16, 2016 06:39
-
-
Save brainstorm/b80a6b9b9c9bc1fd7738 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from toil.job import Job | |
def fn(job, i): | |
job.fileStore.logToMaster("Parent says: i is %s" % i, level=100) | |
return i+1 | |
def child_worker(job, i): | |
job.fileStore.logToMaster("Child says: i is %s" % i, level=100) | |
return i | |
def sum_it_all(job): | |
job.fileStore.logToMaster("Merging results from all children", level=100) | |
if __name__=="__main__": | |
## Toil options | |
options = Job.Runner.getDefaultOptions("./toilWorkflowRun") | |
options.batchSystem = 'slurm' | |
options.logLevel = 'DEBUG' | |
# Dummy parent job | |
parent = Job.wrapJobFn(fn, 1) | |
for child in xrange(1,5): | |
parent.addChildJobFn(child_worker, child) | |
wrapup = parent.addFollowOnJobFn(sum_it_all) | |
Job.Runner.startToil(parent, options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment