-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I found that there're some options about the setting of Workspace in Azure ML in /src/utils.py script, and they're ordered sequentially. Indeed, they consist of 3 steps with try - except structure:
- Induce from
runobject
try:
run = Run.get_context()
if not isinstance(run, _OfflineRun):
ws = run.experiment.workspace
return ws
except Exception as ex:
print('Workspace from run not found', ex)- Retrieve config file with
.from_config()method
try:
ws = Workspace.from_config()
return ws
except Exception as ex:
print('Workspace config not found in local folder', ex)- Pre-defined subscription & Service principal
try:
sp = ServicePrincipalAuthentication(
tenant_id=os.environ['AML_TENANT_ID'],
service_principal_id=os.environ['AML_PRINCIPAL_ID'],
service_principal_password=os.environ['AML_PRINCIPAL_PASS']
)
ws = Workspace.get(
name="<ml-example>",
auth=sp,
subscription_id="<your-sub-id>"
)
except Exception as ex:
print('Workspace config not found in project', ex)Imagine that an user wants to use option 3(Service principal), and he/she receives errors for both options 1/2. Then, is it better to modify the structure of try - except?
Metadata
Metadata
Assignees
Labels
No labels