-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple_job.py
executable file
·46 lines (31 loc) · 1.03 KB
/
simple_job.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
#!/usr/bin/env python
import time
from jobTree import Target
from jobTree.scriptTree.target import Target
from jobTree.scriptTree.stack import Stack
from optparse import OptionParser
class First(Target):
def __init__(self, value):
self.value = value
def run(self):
print "The Target has run:", self.value
self.addChildTarget(Second("I'm almost ready"))
self.addChildTarget(Second("I'm ready"))
self.setFollowOnTarget(Final("I'm Done"))
class Second(Target):
def __init__(self, value):
self.value = value
def run(self):
time.sleep(5)
print "The Second Target has run:", self.value
class Final(Target):
def __init__(self, value):
self.value = value
def run(self):
print "The Second Target has run:", self.value
if __name__ == "__main__":
import simple_job
parser = OptionParser()
Stack.addJobTreeOptions(parser)
options, args = parser.parse_args()
i = Stack(simple_job.First("hello world")).startJobTree(options)