-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·46 lines (37 loc) · 1.19 KB
/
run.py
File metadata and controls
executable file
·46 lines (37 loc) · 1.19 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
#!/usr/bin/env python
from helpers import *
from steps import StepsEnv
class RunEnv(StepsEnv):
step = 'run'
process = [ 'mkenv', 'runjob' ]
@log_step
def mkenv(self):
# Create env.sh and build.sh from templates
R.render_file(f'{self.vals["machine"]}.run.sh.j2', self.vals, self.dir / 'run.sh')
R.render_file('result.sh.j2', self.vals, self.dir / 'result.sh')
return 0
@log_step
def runjob(self):
return check_execute(
self.dir/'run.log',
self.dir/'run.sh',
cwd = str(self.dir))
# TODO: ensure run_dir is created inside build_dir
def run(argv):
assert len(argv) >= 2, f"Usage: {argv[0]} [run info]"
cfg = Config("config.yaml")
info = argv[1:]
if cfg.validate_runinfo(info):
return 101
buildID = derive( info[:len(cfg.buildvars)] )
work = cfg.work / buildID
assert work.is_dir(), f"Error: build directory {work} not found."
R = RunEnv(work, cfg.runvars, info)
ret = R.run()
R.log_result(ret)
if ret:
print("Encountered error during run.")
return ret
if __name__=="__main__":
import sys
exit( run(sys.argv) )