コード例 #1
0
ファイル: tensorboard.py プロジェクト: liaopeiyuan/determined
def open_tensorboard(args: Namespace) -> None:
    resp = api.get(args.master,
                   "tensorboard/{}".format(args.tensorboard_id)).json()
    tensorboard = render.unmarshal(Command, resp)
    check_eq(tensorboard.state, "RUNNING",
             "TensorBoard must be in a running state")
    api.open(args.master, resp["service_address"])
コード例 #2
0
def start_notebook(args: Namespace) -> None:
    config = parse_config(args.config_file, None, args.config, args.volume)

    resp = launch_command(
        args.master,
        "api/v1/notebooks",
        config,
        args.template,
        context_path=args.context,
        preview=args.preview,
    )

    if args.preview:
        print(render.format_object_as_yaml(resp["config"]))
        return

    obj = resp["notebook"]

    if args.detach:
        print(obj["id"])
        return

    with api.ws(args.master, "notebooks/{}/events".format(obj["id"])) as ws:
        for msg in ws:
            if msg["service_ready_event"] and not args.no_browser:
                url = api.open(args.master, obj["serviceAddress"])
                print(colored("Jupyter Notebook is running at: {}".format(url), "green"))
            render_event_stream(msg)
コード例 #3
0
ファイル: tensorboard.py プロジェクト: wbwatkinson/determined
def start_tensorboard(args: Namespace) -> None:
    if args.trial_ids is None and args.experiment_ids is None:
        print("Either experiment_ids or trial_ids must be specified.")
        sys.exit(1)

    config = parse_config(args.config_file, None, [], [])
    req_body = {
        "config": config,
        "trial_ids": args.trial_ids,
        "experiment_ids": args.experiment_ids,
    }

    if args.context is not None:
        req_body["files"], _ = context.read_context(args.context,
                                                    constants.MAX_CONTEXT_SIZE)

    resp = api.post(args.master, "api/v1/tensorboards",
                    body=req_body).json()["tensorboard"]

    if args.detach:
        print(resp["id"])
        return

    url = "tensorboard/{}/events".format(resp["id"])
    with api.ws(args.master, url) as ws:
        for msg in ws:
            if msg["log_event"] is not None:
                # TensorBoard will print a url by default. The URL is incorrect since
                # TensorBoard is not aware of the master proxy address it is assigned.
                if "http" in msg["log_event"]:
                    continue

            if msg["service_ready_event"]:
                if args.no_browser:
                    url = api.make_url(args.master, resp["serviceAddress"])
                else:
                    url = api.open(args.master, resp["serviceAddress"])

                print(
                    colored("TensorBoard is running at: {}".format(url),
                            "green"))
                render_event_stream(msg)
                break
            render_event_stream(msg)
コード例 #4
0
def open_notebook(args: Namespace) -> None:
    resp = api.get(args.master, "api/v1/notebooks/{}".format(args.notebook_id)).json()["notebook"]
    check_eq(resp["state"], "STATE_RUNNING", "Notebook must be in a running state")
    api.open(args.master, resp["serviceAddress"])
コード例 #5
0
def open_notebook(args: Namespace) -> None:
    resp = api.get(args.master, "notebooks/{}".format(args.notebook_id)).json()
    notebook = render.unmarshal(Command, resp)
    check_eq(notebook.state, "RUNNING", "Notebook must be in a running state")
    api.open(args.master, resp["service_address"])
コード例 #6
0
ファイル: tensorboard.py プロジェクト: wbwatkinson/determined
def open_tensorboard(args: Namespace) -> None:
    resp = api.get(args.master, "api/v1/tensorboards/{}".format(
        args.tensorboard_id)).json()["tensorboard"]
    check_eq(resp["state"], "STATE_RUNNING",
             "TensorBoard must be in a running state")
    api.open(args.master, resp["serviceAddress"])