Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/ansys/hps/client/jms/api/jms_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import logging
import os
from typing import Dict, List, Union
import uuid

import backoff

Expand Down Expand Up @@ -409,10 +408,16 @@ def _restore_project(jms_api, archive_path):
if not os.path.exists(archive_path):
raise HPSError(f"Project archive: path does not exist {archive_path}")

bucket = f"hps-client-restore-{uuid.uuid4()}"

log.info(f"Uploading archive {archive_path}")

# POST project archive dir creation request
url = f"{jms_api.url}/projects/dir"
r = jms_api.client.session.post(url)
if not r.json()["project_dir"]:
msg = "Failed to create the archive restore dir."
msg += f" Request response: {r.json()}"
raise HPSError(f"{msg}")
bucket = r.json()["project_dir"][0]
_upload_archive(jms_api, archive_path, bucket)

# POST restore request
Expand Down