Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import Workspace in Azure ML #5

Open
kyoro1 opened this issue Oct 3, 2021 · 0 comments
Open

import Workspace in Azure ML #5

kyoro1 opened this issue Oct 3, 2021 · 0 comments

Comments

@kyoro1
Copy link
Contributor

kyoro1 commented Oct 3, 2021

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:

  1. Induce from run object
    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)
  1. 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)
  1. 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant