-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexampleScript.py
More file actions
78 lines (66 loc) · 1.64 KB
/
Copy pathexampleScript.py
File metadata and controls
78 lines (66 loc) · 1.64 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python
#
# Example script demonstrating building a simple tree of tasks which
# can be executed of iterated over.
#
from tractor.api.tasktree import Job, Task, RemoteCmd
import tractor.api.serialize as serialize
myjob = Job('Simple Job Script')
task1 = Task( '1', 'Task number 1' )
cmd1 = task1.addRemoteCmd(service='Default')
cmd1.addExecutable('echo')
cmd1.addOption('hello')
myjob.addTask( task1 )
task2 = myjob.addTask( '2' )
cmd2 = RemoteCmd('echo hello')
task2.addRemoteCmd( cmd2 )
serializer = tractor.TractorSerializer( myjob )
serializer.spool( 'stdout' )
"""
job = { type':'job', 'label':'Simple Job Script',
'tasks': {
'task1': {
'type':'task',
'cmds': [
'cmd1':{
'type':'RemoteCmd',
'executable':'echo',
'options':[
('hello',),
]
}
'cmd2':{
'type':'RemoteCmd',
'executable':'echo',
'options':[
('hello',),
]
}
]
},
'task2': {
'type':'task',
'cmds': [
'cmd1':{
'type':'RemoteCmd',
'executable':'echo',
'options':[
('hello',),
]
}
'cmd2':{
'type':'RemoteCmd',
'executable':'echo',
'options':[
('hello',),
]
}
]
},
},
}
serializer = tractor.api.serialize.AlfSerializer()
serializer = tractor.api.serialize.PySerializer()
serializer = tractor.api.serialize.JSONSerializer()
serializer = tractor.api.serialize.Pickle()
"""