mirror of
https://github.com/gryf/coach.git
synced 2025-12-17 19:20:19 +01:00
fix dashboard to allow connections from a remote machine. (#231)
This commit is contained in:
@@ -43,6 +43,12 @@ parser.add_argument('-f', '--experiment_files',
|
||||
help="(string) The path of an experiment file to open",
|
||||
default=None,
|
||||
type=str)
|
||||
parser.add_argument('-rc', '--allow_remote_connection',
|
||||
help="(flag) Allow remote connection to view dashboard results from a remote machine. "
|
||||
"Note this opens up the connection and allows anyone who tries to connect to the "
|
||||
"ip address/port to connect and view the bokeh results via their browser.",
|
||||
action='store_true')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.experiment_dir:
|
||||
@@ -58,7 +64,19 @@ def main():
|
||||
from rl_coach.utils import get_open_port
|
||||
|
||||
dashboard_path = os.path.realpath(__file__)
|
||||
command = 'bokeh serve --show {} --port {}'.format(dashboard_path, get_open_port())
|
||||
port = get_open_port()
|
||||
command = 'bokeh serve --show {path} --port {port}'.format(path=dashboard_path, port=port)
|
||||
|
||||
if args.allow_remote_connection:
|
||||
# when allowing remote connection, selecting an experiment or a file via the GUI buttons do not seem to work
|
||||
# well from remote. Instead, we only allow entering an experiment dir from command line.
|
||||
if not args.experiment_dir and not args.experiment_files:
|
||||
raise ValueError("The allow_remote_connection flag only works in conjunction with either the experiment_dir"
|
||||
" or the experiment_files flag. ")
|
||||
|
||||
# allow-websocket-origin = * allows connections from a remote machine.
|
||||
command += ' --allow-websocket-origin=*'
|
||||
|
||||
if args.experiment_dir or args.experiment_files:
|
||||
command += ' --args'
|
||||
if args.experiment_dir:
|
||||
|
||||
Reference in New Issue
Block a user