-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_workflow.py
74 lines (61 loc) · 2.15 KB
/
example_workflow.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
61
62
63
64
65
66
67
68
69
70
71
72
73
from accli import WKubeTask
root_job = WKubeTask()
callback_task = WKubeTask(
repo_url='https://github.com/iiasa/wkube-task-example.git',
repo_branch='master',
docker_filename='Dockerfile',
command="python -c \"import task; task.task(1,2,3, location='first callback')\"",
required_cores=1,
required_ram=1024*1024,
required_storage_local=1024*1024,
required_storage_workflow=1024*1024,
timeout=60*60
)
another_callback = WKubeTask(
repo_url='https://github.com/iiasa/wkube-task-example.git',
repo_branch='master',
docker_filename='Dockerfile',
command="python -c \"import task; task.task(1,2,3, location='another callback')\"",
required_cores=1,
required_ram=1024*1024,
required_storage_local=1024*1024,
required_storage_workflow=1024*1024,
timeout=60*60
)
callback_task.add_callback(
another_callback
)
root_job.add_callback(
callback_task
)
for item in ["parallel 1", "parallel 2", "parallel 3"]:
child = WKubeTask(
repo_url='https://github.com/iiasa/wkube-task-example.git',
repo_branch='master',
docker_filename='Dockerfile',
command=f"python -c \"import task; task.task(1,2,3, location='{item}')\"",
required_cores=1,
required_ram=1024*1024,
required_storage_local=1024*1024,
required_storage_workflow=1024*1024,
timeout=60*60
)
callb = WKubeTask()
child.add_callback(callb)
for ii in ['cp1', 'cp2', 'cp3']:
callb.add_child(
WKubeTask(
repo_url='https://github.com/iiasa/wkube-task-example.git',
repo_branch='master',
docker_filename='Dockerfile',
command=f"python -c \"import task; task.task(1,2,3, location='{item}{ii}')\"",
required_cores=1,
required_ram=1024*1024,
required_storage_local=1024*1024,
required_storage_workflow=1024*1024,
timeout=60*60
)
)
root_job.add_child(
child
)