-
Notifications
You must be signed in to change notification settings - Fork 2
/
example.py
executable file
·60 lines (45 loc) · 981 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python
'''
example
'''
import qtask
from qtask import task
def example(infile):
qtask.pipeline.monitor = "sqlite://foo.db"
qtask.pipeline.project = 'World domination'
qtask.pipeline.sample = infile
hold = holding()
t1 = task1('foo').deps(hold)
t2 = task2('bar').deps(t1)
t2.name="quux2"
for arg in 'abcd':
qtask.pipeline.basejobname = arg
t3 = task3(arg).deps(t2)
task4('baz').deps(t3)
qtask.pipeline.submit(verbose=True)
hold.release()
@task(holding=True, walltime='00:00:10')
def holding():
return ''
@task()
def task1(infile):
cmd = 'echo "%s"' % infile
return cmd
@task()
def task2(outfile):
cmd = '''
# longer command/bash script
echo "%s"
datetime
hostname
''' % outfile
return cmd
@task()
def task3(arg):
cmd = 'echo "%s, %s"' % (arg, arg)
return cmd
@task()
def task4(arg):
return str(arg)
if __name__ == '__main__':
example('filename.fastq')