Skip to content

Commit

Permalink
Add an env var flag to recreate AMLS Environment (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
celaus authored Mar 16, 2020
1 parent d531b2e commit 1d2d773
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ RUN_EVALUATION = 'true'

# Set to true cancels the Azure ML pipeline run when evaluation criteria are not met.
ALLOW_RUN_CANCEL = 'true'

# Flag to allow rebuilding the AML Environment after it was built for the first time. This enables dependency updates from conda_dependencies.yaml.
AML_REBUILD_ENVIRONMENT = 'false'
7 changes: 6 additions & 1 deletion .pipelines/diabetes_regression-variables-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,9 @@ variables:
# For debugging deployment issues. Specify a build id with the MODEL_BUILD_ID pipeline variable at queue time
# to skip training and deploy a model registered by a previous build.
- name: modelbuildid
value: $[coalesce(variables['MODEL_BUILD_ID'], variables['Build.BuildId'])]
value: $[coalesce(variables['MODEL_BUILD_ID'], variables['Build.BuildId'])]


# Flag to allow rebuilding the AML Environment after it was built for the first time. This enables dependency updates from conda_dependencies.yaml.
# - name: AML_REBUILD_ENVIRONMENT
# value: "false"
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def main():

# Create a reusable Azure ML environment
environment = get_environment(
aml_workspace, e.aml_env_name, create_new=False) # NOQA: E501

aml_workspace, e.aml_env_name, create_new=e.rebuild_env) #
run_config = RunConfiguration()
run_config.environment = environment

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def main():
# Make sure to include `r-essentials'
# in diabetes_regression/conda_dependencies.yml
environment = get_environment(
aml_workspace, e.aml_env_name, create_new=False) # NOQA: E501
aml_workspace, e.aml_env_name, create_new=e.rebuild_env) # NOQA: E501
run_config = RunConfiguration()
run_config.environment = environment

Expand Down
6 changes: 6 additions & 0 deletions ml_service/util/env_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def __init__(self):
self._allow_run_cancel = os.environ.get(
"ALLOW_RUN_CANCEL", "true")
self._aml_env_name = os.environ.get("AML_ENV_NAME")
self._rebuild_env = os.environ.get("AML_REBUILD_ENVIRONMENT",
"false").lower().strip() == "true"

@property
def workspace_name(self):
Expand Down Expand Up @@ -166,3 +168,7 @@ def allow_run_cancel(self):
@property
def aml_env_name(self):
return self._aml_env_name

@property
def rebuild_env(self):
return self._rebuild_env

0 comments on commit 1d2d773

Please sign in to comment.