-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
executable file
·52 lines (40 loc) · 1.43 KB
/
run.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
#!/usr/bin/env python
###############################################################################
# MAIN
if __name__ == '__main__':
import os
import json
import logging
import shutil
import argparse
import subprocess
import datetime
logging.basicConfig()
log = logging.getLogger('QMR')
log.setLevel(getattr(logging, 'DEBUG'))
logging.getLogger('QMR').setLevel(logging.INFO)
log.info(' start %s' % datetime.datetime.utcnow())
os.environ['FLYWHEEL_SDK_SKIP_VERSION_CHECK'] = '1'
ap = argparse.ArgumentParser()
ap.add_argument('--config_file',
type=str,
dest="config_file",
default='/flywheel/v0/config.json',
help='Full path to the input json config file.')
ap.add_argument('--output_dir',
type=str,
dest="output_dir",
default='/flywheel/v0/output',
help='Directory in which to save the results.')
args = ap.parse_args()
# RUN MATLAB CODE
matlab_binary = '/usr/local/bin/fwgear_mrq'
matlab_library = '/opt/mcr/v93'
with open('/dockerenv.json', 'r') as f:
environ = json.load(f)
run_command = [matlab_binary, args.config_file, args.output_dir]
status = subprocess.check_call(run_command, env=environ)
# EXIT
if status == 0:
log.info('Success!')
os.sys.exit(status)