Skip to content

Commit

Permalink
Improve readability of exceptions in build pipeline script (microsoft…
Browse files Browse the repository at this point in the history
…#357)

* Update manage_environment.py

* Update attach_compute.py

* Update attach_compute.py

* Update manage_environment.py

Co-authored-by: João Pedro Martins <[email protected]>
  • Loading branch information
Inevitable-Marzipan and lokijota authored Dec 14, 2021
1 parent d081fc2 commit 4b2667e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions ml_service/util/attach_compute.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

import traceback
from azureml.core import Workspace
from azureml.core.compute import AmlCompute
from azureml.core.compute import ComputeTarget
Expand Down Expand Up @@ -32,7 +33,7 @@ def get_compute(workspace: Workspace, compute_name: str, vm_size: str, for_batch
show_output=True, min_node_count=None, timeout_in_minutes=10
)
return compute_target
except ComputeTargetException as ex:
print(ex)
except ComputeTargetException:
traceback.print_exc()
print("An error occurred trying to provision compute.")
exit(1)
5 changes: 3 additions & 2 deletions ml_service/util/manage_environment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import os
import traceback
from azureml.core import Workspace, Environment
from ml_service.util.env_variables import Env
from azureml.core.runconfig import DEFAULT_CPU_IMAGE, DEFAULT_GPU_IMAGE
Expand Down Expand Up @@ -35,6 +36,6 @@ def get_environment(
if restored_environment is not None:
print(restored_environment)
return restored_environment
except Exception as e:
print(e)
except Exception:
traceback.print_exc()
exit(1)

0 comments on commit 4b2667e

Please sign in to comment.