Exemplo n.º 1
0
def _load_deployments(api_client: ApiClient, artifact_base_uri: str):
    dbfs_service = DbfsService(api_client)
    dbx_deployments = f"{artifact_base_uri}/.dbx/deployments.json"
    raw_config_payload = dbfs_service.read(dbx_deployments)["data"]
    payload = base64.b64decode(raw_config_payload).decode("utf-8")
    deployments = json.loads(payload)
    return deployments
Exemplo n.º 2
0
def _load_dbx_file(api_client: ApiClient, artifact_base_uri: str,
                   name: str) -> Dict[Any, Any]:
    dbfs_service = DbfsService(api_client)
    dbx_deployments = f"{artifact_base_uri}/.dbx/{name}"
    raw_config_payload = dbfs_service.read(dbx_deployments)["data"]
    payload = base64.b64decode(raw_config_payload).decode("utf-8")
    deployments = json.loads(payload)
    return deployments
Exemplo n.º 3
0
class FileUploader:
    def __init__(self, api_client: ApiClient):
        self._dbfs_service = DbfsService(api_client)

    def file_exists(self, file_path: str):
        try:
            self._dbfs_service.get_status(file_path)
            return True
        except:  # noqa
            return False

    @retry(tries=3, delay=1, backoff=0.3)
    def upload_file(self, file_path: pathlib.Path):
        posix_path_str = file_path.as_posix()
        posix_path = pathlib.PurePosixPath(posix_path_str)
        dbx_echo(f"Deploying file: {file_path}")
        mlflow.log_artifact(str(file_path), str(posix_path.parent))
Exemplo n.º 4
0
 def __init__(self, api_client: ApiClient):
     self._dbfs_service = DbfsService(api_client)