-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathmonitor.py
22 lines (18 loc) · 859 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
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)