Skip to content

Fix bugs in Azure ML CI helper scripts (aml_creation.py, aml_attach_blob.py) - #190

Open
Manya Sharma (ManyaS-Git) wants to merge 1 commit into
microsoft:masterfrom
ManyaS-Git:fix/aml-ci-script-bugs
Open

Fix bugs in Azure ML CI helper scripts (aml_creation.py, aml_attach_blob.py)#190
Manya Sharma (ManyaS-Git) wants to merge 1 commit into
microsoft:masterfrom
ManyaS-Git:fix/aml-ci-script-bugs

Conversation

@ManyaS-Git

Copy link
Copy Markdown

Summary

This PR fixes several genuine bugs in the Azure ML CI helper scripts under .ci/scripts/.

.ci/scripts/aml_attach_blob.py

  1. Copy-paste bug in CLI argument parsing — all five datastore options (-dsn/--blob_datastore_name, -cn/--container_name, -an/--account_name, -ak/--account_key, -drg/--datastore_rg) were assigned to workspace_region. The variables actually consumed by Datastore.register_azure_blob_container(...) were therefore never set, which would raise a NameError at runtime. Each option now stores into its own variable.
  2. Missing importDatastore is used but was never imported from azureml.core, which would also raise NameError.
  3. Indentation bug — the workspace/datastore creation block was indented inside the for opt, arg in opts: loop, so the creation logic ran once per CLI option instead of once after parsing completed.
  4. Copy-paste usage string — the usage/help text referenced aml_creation.py instead of aml_attach_blob.py.

.ci/scripts/aml_creation.py

  1. Indentation bug — same issue: Workspace.create(...) was indented inside the argument-parsing for loop and executed once per option.
  2. Removed leftover cookiecutter template placeholders ({{cookiecutter.*}}) that were never substituted.

Verification

  • Simulated the fixed getopt parsing (same option tables) and confirmed each long option now assigns to the correct variable.
  • Confirmed with tokenize that the workspace/datastore creation block sits at function-body level (after the parsing loop) in both scripts.

These scripts are referenced by the Azure DevOps templates (creation_step.yml, deploy_steps.yml). No behavior change beyond fixing the bugs.

Fix several bugs in .ci/scripts/aml_creation.py and .ci/scripts/aml_attach_blob.py:

- aml_creation.py: the workspace creation block was indented inside the
  option-parsing 'for' loop, so Workspace.create was invoked once per
  CLI option instead of once. Also removed leftover cookiecutter template
  placeholders after __main__.

- aml_attach_blob.py: all five datastore CLI options (-dsn/-cn/-an/-ak/-drg)
  were assigned to 'workspace_region' due to a copy-paste error, leaving the
  actual variables unbound and raising NameError at Datastore registration.
  Each option now stores into its own variable. Added the missing Datastore
  import, fixed the same indentation bug, and corrected the usage message
  that incorrectly referenced aml_creation.py.
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

Successfully merging this pull request may close these issues.

1 participant