forked from outerbounds/metaflow-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helloworld.py
92 lines (74 loc) · 2.74 KB
/
helloworld.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from metaflow import FlowSpec, step, resources
class HelloFlow(FlowSpec):
"""
A flow where Metaflow prints 'Hi'.
Run this flow to validate that Metaflow is installed correctly.
"""
@resources(cpu=3)
@step
def start(self):
"""
This is the 'start' step. All flows must have a step named 'start' that
is the first step in the flow.
"""
print("HelloFlow is starting.")
import subprocess
print("Cgroup info")
subprocess.call(["cat", "/sys/fs/cgroup/cpu/cpu.shares"])
subprocess.call(["cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"])
subprocess.call(["cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"])
self.next(self.hello)
@resources(cpu=1)
@step
def hello(self):
"""
A step for metaflow to introduce itself.
"""
import time
print("Metaflow says: Hi!")
import subprocess
print("Cgroup info")
subprocess.call(["cat", "/sys/fs/cgroup/cpu/cpu.shares"])
subprocess.call(["cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"])
subprocess.call(["cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"])
self.aa = "a" + str(time.time())
self.bb = "b" + str(time.time())
self.cc = "c" + str(time.time())
self.dd = "d" + str(time.time())
self.ee = "e" + str(time.time())
self.ff = "f" + str(time.time())
self.gg = "g" + str(time.time())
self.hh = "h" + str(time.time())
self.ii = "i" + str(time.time())
self.jj = "j" + str(time.time())
self.kk = "k" + str(time.time())
self.ll = "l" + str(time.time())
self.mm = "m" + str(time.time())
self.nn = "n" + str(time.time())
self.oo = "o" + str(time.time())
self.pp = "p" + str(time.time())
self.qq = "q" + str(time.time())
self.rr = "r" + str(time.time())
self.ss = "s" + str(time.time())
self.tt = "t" + str(time.time())
self.uu = "u" + str(time.time())
self.vv = "v" + str(time.time())
self.ww = "w" + str(time.time())
self.xx = "x" + str(time.time())
self.yy = "y" + str(time.time())
self.zz = "z" + str(time.time())
self.next(self.end)
@step
def end(self):
"""
This is the 'end' step. All flows must have an 'end' step, which is the
last step in the flow.
"""
print("HelloFlow is all done.")
import subprocess
print("Cgroup info")
subprocess.call(["cat", "/sys/fs/cgroup/cpu/cpu.shares"])
subprocess.call(["cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"])
subprocess.call(["cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"])
if __name__ == "__main__":
HelloFlow()