1- from azureml .core .authentication import AzureCliAuthentication
2- from azureml .core .compute import ComputeTarget
31from azureml .pipeline .core .graph import PipelineParameter
4- from azureml .pipeline .core import PublishedPipeline
52from azureml .pipeline .steps import PythonScriptStep
6- from azureml .pipeline .core import Pipeline , PipelineData , StepSequence
7- from azureml .data .data_reference import DataReference
3+ from azureml .pipeline .core import Pipeline , PipelineData
84from azureml .core .runconfig import RunConfiguration , CondaDependencies
9- from azureml .core import Workspace , Experiment , Datastore
10- import argparse
5+ from azureml .core import Datastore
116import datetime
12- import requests
13- import json
147import os
158import sys
169from dotenv import load_dotenv
1710sys .path .append (os .path .abspath ("./aml_service" )) # NOQA: E402
1811from workspace import get_workspace
1912from attach_compute import get_compute
2013
21- def main ():
14+
15+ def main ():
2216 load_dotenv ()
2317 workspace_name = os .environ .get ("AML_WORKSPACE_NAME" )
2418 resource_group = os .environ .get ("RESOURCE_GROUP" )
@@ -29,7 +23,7 @@ def main():
2923 sources_directory_train = os .environ .get ("SOURCES_DIR_TRAIN" )
3024 train_script_path = os .environ .get ("TRAIN_SCRIPT_PATH" )
3125 evaluate_script_path = os .environ .get ("EVALUATE_SCRIPT_PATH" )
32- register_script_path = os .environ .get ("REGISTER_SCRIPT_PATH" )
26+ register_script_path = os .environ .get ("REGISTER_SCRIPT_PATH" )
3327 vm_size_cpu = os .environ .get ("AML_COMPUTE_CLUSTER_CPU_SKU" )
3428 compute_name_cpu = os .environ .get ("AML_COMPUTE_CLUSTER_NAME" )
3529 experiment_name = os .environ .get ("EXPERIMENT_NAME" )
@@ -42,7 +36,7 @@ def main():
4236 tenant_id ,
4337 app_id ,
4438 app_secret )
45- print (aml_workspace )
39+ print (aml_workspace )
4640
4741 # Get Azure machine learning cluster
4842 aml_compute_cpu = get_compute (
@@ -61,7 +55,8 @@ def main():
6155 )
6256 run_config .environment .docker .enabled = True
6357
64- model_name = PipelineParameter (name = "model_name" , default_value = "sklearn_regression_model.pkl" )
58+ model_name = PipelineParameter (
59+ name = "model_name" , default_value = "sklearn_regression_model.pkl" )
6560 def_blob_store = Datastore (aml_workspace , "workspaceblobstore" )
6661 jsonconfigs = PipelineData ("jsonconfigs" , datastore = def_blob_store )
6762 config_suffix = datetime .datetime .now ().strftime ("%Y%m%d%H" )
@@ -89,15 +84,15 @@ def main():
8984 compute_target = aml_compute_cpu ,
9085 source_directory = sources_directory_train ,
9186 arguments = [
92- "--config_suffix" , config_suffix ,
93- "--json_config" , jsonconfigs ,
87+ "--config_suffix" , config_suffix ,
88+ "--json_config" , jsonconfigs ,
9489 ],
9590 runconfig = run_config ,
9691 inputs = [jsonconfigs ],
9792 # outputs=[jsonconfigs],
9893 allow_reuse = False ,
9994 )
100- print ("Step Evaluate created" )
95+ print ("Step Evaluate created" )
10196
10297 register_model_step = PythonScriptStep (
10398 name = "Register New Trained Model" ,
@@ -122,8 +117,8 @@ def main():
122117
123118 train_pipeline = Pipeline (workspace = aml_workspace , steps = steps )
124119 train_pipeline .validate ()
125- pipeline_run = train_pipeline .submit (experiment_name = experiment_name )
120+ train_pipeline .submit (experiment_name = experiment_name )
126121
127122
128123if __name__ == '__main__' :
129- main ()
124+ main ()
0 commit comments