diff --git a/azure-pipelines/templates/deploy-model.template.yml b/azure-pipelines/templates/deploy-model.template.yml index aaf8e08..4be6097 100644 --- a/azure-pipelines/templates/deploy-model.template.yml +++ b/azure-pipelines/templates/deploy-model.template.yml @@ -50,7 +50,7 @@ jobs: artifactName: ${{parameters.artifactName}} deploymentScript: operation/execution/deploy_model.py scriptArguments: | - --model-name $(AML_MODEL_NAME) \ + --model-names $(AML_MODELS) \ --config-path configuration/compute/${{parameters.environment}}-realtimeinference-webservice-${{parameters.deploymentType}}.yml \ --env-path $(AML_REALTIMEINFERENCE_ENV_PATH) \ --service-name ${{parameters.webserviceName}} \ diff --git a/configuration/configuration-aml.variables.yml b/configuration/configuration-aml.variables.yml index aab47d1..f6ec0ea 100644 --- a/configuration/configuration-aml.variables.yml +++ b/configuration/configuration-aml.variables.yml @@ -30,3 +30,4 @@ variables: AML_REALTIMEINFERENCE_ENV_PATH: $(AML_BATCHINFERENCE_ENV_PATH) AKS_COMPUTE: aks-compute AML_WEBSERVICE: webservice + AML_MODELS: '[\"$(AML_MODEL_NAME)\",\"some-other-model\"]' diff --git a/operation/execution/deploy_model.py b/operation/execution/deploy_model.py index fe16864..e561740 100644 --- a/operation/execution/deploy_model.py +++ b/operation/execution/deploy_model.py @@ -7,11 +7,16 @@ from aml_utils import config, workspace, deployment +import json -def main(model_name, service_name, compute_config_file, environment_path, aks_target_name=None): + +def main(model_names, service_name, compute_config_file, environment_path, aks_target_name=None): ws = workspace.retrieve_workspace() - model = Model(ws, name=model_name) # TODO: support for more than 1 model? + models = [] + for name in model_names: + models.append(Model(ws, name=name)) + print(f"model_name: {name}") # Get repo root path, every other path will be relative to this base_path = config.get_root_path() @@ -32,7 +37,7 @@ def main(model_name, service_name, compute_config_file, environment_path, aks_ta service = deployment.launch_deployment( ws, service_name=service_name, - models=[model], + models=models, deployment_params=deployment_params ) print(f'Waiting for deployment of {service.name} to finish...') @@ -41,7 +46,7 @@ def main(model_name, service_name, compute_config_file, environment_path, aks_ta def parse_args(args_list=None): parser = argparse.ArgumentParser() - parser.add_argument('--model-name', type=str, required=True) + parser.add_argument('--model-names', type=json.loads, required=True) parser.add_argument('--config-path', type=str, required=True) parser.add_argument('--env-path', type=str, required=True) parser.add_argument('--service-name', type=str, default='webservice') @@ -53,7 +58,7 @@ def parse_args(args_list=None): args = parse_args() main( - model_name=args.model_name, + model_name=args.model_names, service_name=args.service_name, compute_config_file=args.config_path, environment_path=args.env_path,