-
Notifications
You must be signed in to change notification settings - Fork 0
/
monitor.py
executable file
·29 lines (25 loc) · 878 Bytes
/
monitor.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
import subprocess
import argparse
import os.path
parser = argparse.ArgumentParser(description=r'''
Launch tensorboard on multiple directories in an easy way.
''')
parser.add_argument('--port', default=6006, type=int,
help='The port to use for tensorboard')
parser.add_argument('--quiet', '-q', action='store_true',
help='Run in silent mode')
parser.add_argument('dirs', nargs='+', type=str,
help='directories of train instances to monitor')
args = parser.parse_args()
args.dirs = [s for s in args.dirs if os.path.isdir(s)]
for s in args.dirs:
print('Monitoring %s ...' % s)
print('')
cmd = 'tensorboard --port="{}" --logdir="{}"'.format(
args.port,
','.join(["%s:%s" % (os.path.basename(s), s) for s in args.dirs])
)
if args.quiet:
cmd += ' 2>/dev/null'
print(cmd)
subprocess.call(cmd, shell=True)