Esempio n. 1
0
def fetch_wandb_project_run_info(entity: str, project: str, run_name: str,
                                 api: Api) -> Any:
    _logger.info("Fetching run info...")
    try:
        result = api.get_run_info(entity, project, run_name)
    except CommError:
        result = None
    if result is None:
        raise LaunchError(
            f"Run info is invalid or doesn't exist for {api.settings('base_url')}/{entity}/{project}/runs/{run_name}"
        )
    if result.get("codePath") is None:
        # TODO: we don't currently expose codePath in the runInfo endpoint, this downloads
        # it from wandb-metadata.json if we can.
        metadata = api.download_url(project,
                                    "wandb-metadata.json",
                                    run=run_name,
                                    entity=entity)
        if metadata is not None:
            _, response = api.download_file(metadata["url"])
            data = response.json()
            result["codePath"] = data.get("codePath")
            result["cudaVersion"] = data.get("cuda", None)

    if result.get("args") is not None:
        result["args"] = util._user_args_to_dict(result["args"])
    return result
Esempio n. 2
0
def download_h5(run, entity=None, project=None, out_dir=None):
    api = Api()
    meta = api.download_url(project or api.settings(
        "project"), DEEP_SUMMARY_FNAME, entity=entity or api.settings("entity"), run=run)
    if meta and 'md5' in meta and meta['md5'] is not None:
        # TODO: make this non-blocking
        wandb.termlog("Downloading summary data...")
        path, res = api.download_write_file(meta, out_dir=out_dir)
        return path
Esempio n. 3
0
def download_entry_point(entity: str, project: str, run_name: str, api: Api,
                         entry_point: str, dir: str) -> bool:
    metadata = api.download_url(project,
                                f"code/{entry_point}",
                                run=run_name,
                                entity=entity)
    if metadata is not None:
        _, response = api.download_file(metadata["url"])
        with util.fsync_open(os.path.join(dir, entry_point), "wb") as file:
            for data in response.iter_content(chunk_size=1024):
                file.write(data)
        return True
    return False
Esempio n. 4
0
def download_wandb_python_deps(entity: str, project: str, run_name: str,
                               api: Api, dir: str) -> Optional[str]:
    reqs = api.download_url(project,
                            "requirements.txt",
                            run=run_name,
                            entity=entity)
    if reqs is not None:
        _logger.info("Downloading python dependencies")
        _, response = api.download_file(reqs["url"])

        with util.fsync_open(os.path.join(dir, "requirements.frozen.txt"),
                             "wb") as file:
            for data in response.iter_content(chunk_size=1024):
                file.write(data)
        return "requirements.frozen.txt"
    return None