Skip to content

Commit

Permalink
Minor bug fixes related to deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
ljcornel committed Jan 25, 2024
1 parent 78c14c8 commit aaf66c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions geti_sdk/deployment/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def from_folder(cls, path_to_folder: Union[str, os.PathLike]) -> "Deployment":
:return: Deployment instance corresponding to the deployment data in the folder
"""
deployment_folder = path_to_folder
if not isinstance(path_to_folder, str):
path_to_folder = str(path_to_folder)
if not path_to_folder.endswith("deployment"):
if "deployment" in os.listdir(path_to_folder):
deployment_folder = os.path.join(path_to_folder, "deployment")
Expand Down
13 changes: 12 additions & 1 deletion geti_sdk/rest_clients/deployment_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,10 @@ def _backend_deploy_project(

# Wait for the deployment to become available
stop_polling = False
t_start = time.time()
timeout = 600
logging.info("Waiting for the deployment to be created...")
while not stop_polling:
while not stop_polling and time.time() - t_start < timeout:
time.sleep(1)
code_deployment = self._get_deployment_status(code_deployment.id)
if code_deployment.state == DeploymentState.DONE:
Expand All @@ -400,6 +402,15 @@ def _backend_deploy_project(
f"project '{self.project.name}'."
)

if code_deployment.state != DeploymentState.DONE:
raise ValueError(
f"The Intel® Geti™ server failed to create deployment for "
f"project '{self.project.name}' within 10 minutes. Deployment "
f"creation timed out, the current state of the deployment is"
f" `{code_deployment.state}` with a progress of "
f"{code_deployment.progress:.1f}%"
)

# Fetch the deployment package
deployment = self._fetch_deployment(deployment_id=code_deployment.id)

Expand Down

0 comments on commit aaf66c2

Please sign in to comment.