From 15044bce5440c30584b7196621ad5875eaf7f5af Mon Sep 17 00:00:00 2001 From: Claus Matzinger Date: Wed, 11 Mar 2020 15:44:17 +0100 Subject: [PATCH 1/4] added a flag --- .../pipelines/diabetes_regression_build_train_pipeline.py | 3 +-- .../diabetes_regression_build_train_pipeline_with_r.py | 2 +- ml_service/util/env_variables.py | 6 ++++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ml_service/pipelines/diabetes_regression_build_train_pipeline.py b/ml_service/pipelines/diabetes_regression_build_train_pipeline.py index f0e7bf3a..69552a9c 100644 --- a/ml_service/pipelines/diabetes_regression_build_train_pipeline.py +++ b/ml_service/pipelines/diabetes_regression_build_train_pipeline.py @@ -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 == "true") # run_config = RunConfiguration() run_config.environment = environment diff --git a/ml_service/pipelines/diabetes_regression_build_train_pipeline_with_r.py b/ml_service/pipelines/diabetes_regression_build_train_pipeline_with_r.py index ef42d63e..53db3650 100644 --- a/ml_service/pipelines/diabetes_regression_build_train_pipeline_with_r.py +++ b/ml_service/pipelines/diabetes_regression_build_train_pipeline_with_r.py @@ -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 == "true") # NOQA: E501 run_config = RunConfiguration() run_config.environment = environment diff --git a/ml_service/util/env_variables.py b/ml_service/util/env_variables.py index c00ee603..c8c7362e 100644 --- a/ml_service/util/env_variables.py +++ b/ml_service/util/env_variables.py @@ -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", "true").lower().strip() + @property def workspace_name(self): @@ -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 \ No newline at end of file From b9fd1dbbaa13b3f920db946ccd5c3178aadbd0e0 Mon Sep 17 00:00:00 2001 From: Claus Matzinger Date: Thu, 12 Mar 2020 09:53:47 +0100 Subject: [PATCH 2/4] flag examples + tiny docs --- .env.example | 3 +++ .pipelines/diabetes_regression-variables-template.yml | 7 ++++++- ml_service/util/env_variables.py | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index d68b73c5..01dc40e8 100644 --- a/.env.example +++ b/.env.example @@ -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' diff --git a/.pipelines/diabetes_regression-variables-template.yml b/.pipelines/diabetes_regression-variables-template.yml index fdccb3b7..def14549 100644 --- a/.pipelines/diabetes_regression-variables-template.yml +++ b/.pipelines/diabetes_regression-variables-template.yml @@ -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'])] \ No newline at end of file + 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" diff --git a/ml_service/util/env_variables.py b/ml_service/util/env_variables.py index c8c7362e..0860975c 100644 --- a/ml_service/util/env_variables.py +++ b/ml_service/util/env_variables.py @@ -46,7 +46,7 @@ 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", "true").lower().strip() + self._rebuild_env = os.environ.get("AML_REBUILD_ENVIRONMENT", "false").lower().strip() @property From 62ac3bde8969ff701d9c59e4b35b56f6269bafe6 Mon Sep 17 00:00:00 2001 From: Claus Matzinger Date: Thu, 12 Mar 2020 13:06:37 +0100 Subject: [PATCH 3/4] make the linter check happy --- .../pipelines/diabetes_regression_build_train_pipeline.py | 2 +- ml_service/util/env_variables.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ml_service/pipelines/diabetes_regression_build_train_pipeline.py b/ml_service/pipelines/diabetes_regression_build_train_pipeline.py index 69552a9c..f8ddbc73 100644 --- a/ml_service/pipelines/diabetes_regression_build_train_pipeline.py +++ b/ml_service/pipelines/diabetes_regression_build_train_pipeline.py @@ -33,7 +33,7 @@ def main(): # Create a reusable Azure ML environment environment = get_environment( - aml_workspace, e.aml_env_name, create_new=e.rebuild_env == "true") # + aml_workspace, e.aml_env_name, create_new=e.rebuild_env == "true") # run_config = RunConfiguration() run_config.environment = environment diff --git a/ml_service/util/env_variables.py b/ml_service/util/env_variables.py index 0860975c..8979b8b2 100644 --- a/ml_service/util/env_variables.py +++ b/ml_service/util/env_variables.py @@ -46,8 +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() - + self._rebuild_env = os.environ.get("AML_REBUILD_ENVIRONMENT", + "false").lower().strip() @property def workspace_name(self): @@ -171,4 +171,4 @@ def aml_env_name(self): @property def rebuild_env(self): - return self._rebuild_env \ No newline at end of file + return self._rebuild_env From 45961356893508dace8e1474a0cfff544f3a03eb Mon Sep 17 00:00:00 2001 From: Claus Matzinger Date: Mon, 16 Mar 2020 09:42:38 +0100 Subject: [PATCH 4/4] boolean types --- .../pipelines/diabetes_regression_build_train_pipeline.py | 2 +- .../diabetes_regression_build_train_pipeline_with_r.py | 2 +- ml_service/util/env_variables.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ml_service/pipelines/diabetes_regression_build_train_pipeline.py b/ml_service/pipelines/diabetes_regression_build_train_pipeline.py index f8ddbc73..2fb16f09 100644 --- a/ml_service/pipelines/diabetes_regression_build_train_pipeline.py +++ b/ml_service/pipelines/diabetes_regression_build_train_pipeline.py @@ -33,7 +33,7 @@ def main(): # Create a reusable Azure ML environment environment = get_environment( - aml_workspace, e.aml_env_name, create_new=e.rebuild_env == "true") # + aml_workspace, e.aml_env_name, create_new=e.rebuild_env) # run_config = RunConfiguration() run_config.environment = environment diff --git a/ml_service/pipelines/diabetes_regression_build_train_pipeline_with_r.py b/ml_service/pipelines/diabetes_regression_build_train_pipeline_with_r.py index 53db3650..b49ae53d 100644 --- a/ml_service/pipelines/diabetes_regression_build_train_pipeline_with_r.py +++ b/ml_service/pipelines/diabetes_regression_build_train_pipeline_with_r.py @@ -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=e.rebuild_env == "true") # NOQA: E501 + aml_workspace, e.aml_env_name, create_new=e.rebuild_env) # NOQA: E501 run_config = RunConfiguration() run_config.environment = environment diff --git a/ml_service/util/env_variables.py b/ml_service/util/env_variables.py index 8979b8b2..c734e098 100644 --- a/ml_service/util/env_variables.py +++ b/ml_service/util/env_variables.py @@ -47,7 +47,7 @@ def __init__(self): "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() + "false").lower().strip() == "true" @property def workspace_name(self):