This commit is contained in:
Marvin Buss 2020-04-01 00:05:58 +02:00
Родитель e210d9e26a
Коммит 032252fcd2
2 изменённых файлов: 15 добавлений и 4 удалений

Просмотреть файл

@ -10,7 +10,7 @@ from azureml.exceptions import AuthenticationException, ProjectSystemException,
from adal.adal_error import AdalError
from msrest.exceptions import AuthenticationError
from json import JSONDecodeError
from utils import AMLConfigurationException, AMLExperimentConfigurationException, required_parameters_provided, convert_to_markdown
from utils import AMLConfigurationException, AMLExperimentConfigurationException, required_parameters_provided, convert_to_markdown, mask_parameter
def main():
@ -32,14 +32,21 @@ def main():
message="Required parameter(s) not found in your azure credentials saved in AZURE_CREDENTIALS secret for logging in to the workspace. Please provide a value for the following key(s): "
)
# Mask values
print("::debug::Masking parameters")
mask_parameter(parameter=azure_credentials.get("tenantId", ""))
mask_parameter(parameter=azure_credentials.get("clientId", ""))
mask_parameter(parameter=azure_credentials.get("clientSecret", ""))
mask_parameter(parameter=azure_credentials.get("subscriptionId", ""))
# Loading parameters file
print("::debug::Loading parameters file")
parameters_file_path = os.path.join(".ml", ".azure", parameters_file)
parameters_file_path = os.path.join(".cloud", ".azure", parameters_file)
try:
with open(parameters_file_path) as f:
parameters = json.load(f)
except FileNotFoundError:
print(f"::debug::Could not find parameter file in {parameters_file_path}. Please provide a parameter file in your repository if you do not want to use default settings (e.g. .ml/.azure/workspace.json).")
print(f"::debug::Could not find parameter file in {parameters_file_path}. Please provide a parameter file in your repository if you do not want to use default settings (e.g. .cloud/.azure/workspace.json).")
parameters = {}
# Loading Workspace
@ -49,7 +56,7 @@ def main():
service_principal_id=azure_credentials.get("clientId", ""),
service_principal_password=azure_credentials.get("clientSecret", "")
)
config_file_path = os.environ.get("GITHUB_WORKSPACE", default=".ml/.azure")
config_file_path = os.environ.get("GITHUB_WORKSPACE", default=".cloud/.azure")
config_file_name = "aml_arm_config.json"
try:
ws = Workspace.from_config(

Просмотреть файл

@ -42,3 +42,7 @@ def convert_to_markdown(metrics_dict):
markdown += metrics + "%0A"
return markdown
def mask_parameter(parameter):
print(f"::add-mask::{parameter}")