Skip to content

Commit 6134f4c

Browse files
authored
update local deployment aml_app_root to score script directory (Azure#30296)
* update aml_app_root to score script directory * updated the AML_APP_ROOT path * updated the AML_APP_ROOT path * fixed black and pylint
1 parent 80ebe50 commit 6134f4c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/_local_endpoints/azureml_image_context.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import logging
77
from pathlib import Path
8+
import os
89

910
from azure.ai.ml.constants._endpoint import LocalEndpointConstants
1011

@@ -79,12 +80,14 @@ def __init__(
7980
}
8081
}
8182
)
82-
self._environment[
83-
LocalEndpointConstants.ENVVAR_KEY_AML_APP_ROOT
84-
] = docker_code_mount_path # ie. /var/azureml-app/onlinescoring
85-
self._environment[
86-
LocalEndpointConstants.ENVVAR_KEY_AZUREML_ENTRY_SCRIPT
87-
] = yaml_code_scoring_script_file_name # ie. score.py
83+
# Set the directory containing scoring script as AML_APP_ROOT/working directory
84+
# ie. /var/azureml-app/onlinescoring
85+
self._environment[LocalEndpointConstants.ENVVAR_KEY_AML_APP_ROOT] = os.path.join(
86+
docker_code_mount_path, os.path.dirname(yaml_code_scoring_script_file_name)
87+
)
88+
self._environment[LocalEndpointConstants.ENVVAR_KEY_AZUREML_ENTRY_SCRIPT] = Path(
89+
yaml_code_scoring_script_file_name
90+
).name # ie. score.py
8891

8992
self.ports = {"5001/tcp": 5001}
9093

0 commit comments

Comments
 (0)