in src/python-sdk-v2/register_environment.py [0:0]
def main():
args = parse_args()
print(args)
credential = DefaultAzureCredential()
try:
ml_client = MLClient.from_config(credential, path='config.json')
except Exception as ex:
print("Could not find config.json or config.json is not in the right format.")
print(ex)
build_type = args.build_type
if build_type == 'docker':
print("Using docker build contect")
environment = Environment(
name=args.environment_name,
build=BuildContext(path=args.env_path),
description=args.description
)
elif build_type == 'conda':
environment = Environment(
image=args.base_image,
conda_file=args.env_path,
name=args.environment_name,
description=args.description
)
else:
print("Expected 'docker' or 'conda' as build type.")
print(ex)
ml_client.environments.create_or_update(environment)