def _command_pipeline_show(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#show_pipeline" pipeline_id = argument.Argument("pipeline_id", "--pipeline-id", "-i", required=True, help="ID of the pipeline to show (guid)") output_file = argument.Argument("output_file", "--output-file", "-f", required=False, help="File to write output in JSON format") return cli_command.CliCommand("show", "Show details of a pipeline and respective schedules.", [pipeline_id, output_file, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_pipeline_enable(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#enable_pipeline" pipeline_id = argument.Argument("pipeline_id", "--pipeline-id", "-i", required=True, help="ID of the pipeline to enable (guid)") output_file = argument.Argument("output_file", "--output-file", "-f", required=False, help="File to write output in JSON format") return cli_command.CliCommand("enable", "Enable a pipeline and allow it to run.", [pipeline_id, output_file, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_pipeline_get(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#get_pipeline" pipeline_id = argument.Argument("pipeline_id", "--pipeline-id", "-i", required=False, help="ID of the Pipeline to get (guid)") pipeline_draft_id = argument.Argument("pipeline_draft_id", "--pipeline-draft-id", "-d", required=False, help="ID of the PipelineDraft to get (guid)") path = argument.Argument("path", "--path", "-p", required=True, help="File path to save Pipeline yaml to.") return cli_command.CliCommand("get", "Generate yml definition describing the pipeline.", [pipeline_id, pipeline_draft_id, path, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_pipeline_clone(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#clone_pipeline_run" pipeline_id = argument.Argument("pipeline_run_id", "--pipeline-run-id", "-i", required=True, help="ID of the PipelineRun to clone (guid)") path = argument.Argument("path", "--path", "-p", required=True, help="File path to save pipeline yaml to.") output_file = argument.Argument("output_file", "--output-file", "-f", required=False, help="File to write output in JSON format") return cli_command.CliCommand("clone", "Generate yml definition describing the pipeline run," " supported only for ModuleStep for now.", [pipeline_id, path, output_file, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_schedule_create(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#create_schedule" pipeline_id = argument.Argument("pipeline_id", "--pipeline-id", "-i", required=True, help="ID of the pipeline to create schedule (guid)") name = argument.Argument("name", "--name", "-n", required=True, help="Name of schedule") experiment_name = argument.Argument("experiment-name", "--experiment-name", "-e", required=True, help="Name of experiment") schedule_yaml = argument.Argument("schedule_yaml", "--schedule-yaml", "-y", required=False, help="Schedule YAML input") return cli_command.CliCommand("create-schedule", "Create a schedule.", [name, pipeline_id, experiment_name, schedule_yaml, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_pipeline_draft_submit(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#submit_pipeline_draft" pipeline_draft_id = argument.Argument("pipeline_draft_id", "--pipeline-draft-id", "-i", required=True, help="ID of the PipelineDraft to use to submit run") return cli_command.CliCommand("submit-draft", "Submit a run from the pipeline draft.", [pipeline_draft_id, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_pipeline_draft_publish(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#publish_pipeline_draft" pipeline_draft_id = argument.Argument("pipeline_draft_id", "--pipeline-draft-id", "-i", required=True, help="ID of the PipelineDraft to publish") return cli_command.CliCommand("publish-draft", "Publish a pipeline draft as a published pipeline.", [pipeline_draft_id, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_pipeline_list(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#list_pipelines" output_file = argument.Argument("output_file", "--output-file", "-f", required=False, help="File to write output in JSON format") return cli_command.CliCommand("list", "List all pipelines and respective schedules in the workspace.", [output_file, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_schedule_show(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#show_schedule" schedule_id = argument.Argument("schedule_id", "--schedule-id", "-s", required=True, help="ID of the schedule to show (guid)") return cli_command.CliCommand("show-schedule", "Show details of a schedule.", [schedule_id, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_schedule_enable(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#enable_schedule" schedule_id = argument.Argument("schedule_id", "--schedule-id", "-s", required=True, help="ID of the schedule to show (guid)") return cli_command.CliCommand("enable-schedule", "Enable a schedule and allow it to run.", [schedule_id, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_pipeline_runs_list(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#list_pipeline_runs" schedule_id = argument.Argument("schedule_id", "--schedule-id", "-s", required=True, help="ID of the schedule to show (guid)") return cli_command.CliCommand("pipeline-runs-list", "List pipeline runs generated from a schedule.", [schedule_id, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_last_pipeline_run_show(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#show_last_pipeline_run" schedule_id = argument.Argument("schedule_id", "--schedule-id", "-s", required=True, help="ID of the schedule to show (guid)") return cli_command.CliCommand("last-pipeline-run", "Show last pipeline run for a schedule.", [schedule_id, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_pipeline_draft_delete(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#delete_pipeline_draft" pipeline_draft_id = argument.Argument("pipeline_draft_id", "--pipeline-draft-id", "-i", required=True, help="ID of the PipelineDraft to delete (guid)") return cli_command.CliCommand("delete-draft", "Delete a pipeline draft.", [pipeline_draft_id, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_schedule_update(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#update_schedule" schedule_id = argument.Argument("schedule_id", "--schedule-id", "-s", required=True, help="ID of the schedule to show (guid)") name = argument.Argument("name", "--name", "-n", required=False, help="Name of the schedule to show (guid)") status = argument.Argument("status", "--status", "-t", required=False, help="Status of the schedule to show (guid)") schedule_yaml = argument.Argument("schedule_yaml", "--schedule-yaml", "-y", required=False, help="Schedule YAML input") return cli_command.CliCommand("update-schedule", "update a schedule.", [schedule_id, name, status, schedule_yaml, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_pipeline_list_steps(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#list_pipeline_steps" output_file = argument.Argument("output_file", "--output-file", "-f", required=False, help="File to write output in JSON format") return cli_command.CliCommand("list-steps", "List the step runs generated from a pipeline run", [output_file, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME, argument.RUN_ID_OPTION.get_required_true_copy()], function_path)
def _command_pipeline_drafts_list(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#list_pipeline_drafts" tags = argument.Argument("tags", "--tags", "-t", required=False, help="Tags for a draft with 'key=value' syntax.", action="append", default=[]) return cli_command.CliCommand("list-drafts", "List pipeline drafts in the workspace.", [tags, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_pipeline_draft_clone(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#clone_pipeline_draft" pipeline_draft_id = argument.Argument("pipeline_draft_id", "--pipeline-draft-id", "-i", required=False, help="ID of the PipelineDraft to create PipelineDraft from.") pipeline_run_id = argument.Argument("pipeline_run_id", "--pipeline-run-id", "-r", required=False, help="ID of the PipelineRun to create PipelineDraft from") experiment_name = argument.Argument("experiment_name", "--experiment-name", "-e", required=False, help="Experiment name of the specified PipelineRun") pipeline_id = argument.Argument("pipeline_id", "--pipeline-id", "-p", required=False, help="ID of the PublishedPipeline to create PipelineDraft from") return cli_command.CliCommand("clone-draft", "Create a pipeline draft from an existing pipeline.", [pipeline_draft_id, pipeline_run_id, pipeline_id, experiment_name, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_pipeline_draft_create(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#create_pipeline_draft" pipeline_yml = argument.Argument("pipeline_yml", "--pipeline-yaml", "-y", required=True, help="YAML file which defines the pipeline draft") name = argument.Argument("name", "--name", "-n", required=True, help="Name to assign to the pipeline draft") description = argument.Argument("description", "--description", "-d", required=False, help="Description text of the pipeline draft") pipeline_parameters = argument.Argument("pipeline_parameters", "--parameters", "", required=False, help="PipelineParameters for the draft with 'key=value' syntax.", action="append", default=[]) properties = argument.Argument("properties", "--properties", "-p", required=False, help="Properties for the draft with 'key=value' syntax.", action="append", default=[]) tags = argument.Argument("tags", "--tags", "-t", required=False, help="Tags for the draft with 'key=value' syntax.", action="append", default=[]) experiment_name = argument.Argument("experiment_name", "--experiment_name", "-e", required=True, help="Experiment name for the pipeline draft") allow_continue = argument.Argument( "continue_on_step_failure", "--continue", "-c", required=False, help="Boolean flag to allow a pipeline to continue executing after a step fails") return cli_command.CliCommand("create-draft", "Create a pipeline draft from a yml definition.", [pipeline_yml, name, description, experiment_name, pipeline_parameters, allow_continue, tags, properties, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
def _command_pipeline_create(self): function_path = "azureml.pipeline._cli_wrapper.cmd_pipeline#create_pipeline" pipeline_yaml = argument.Argument("pipeline_yaml", "--pipeline-yaml", "-y", required=True, help="YAML file which defines a pipeline") name = argument.Argument("name", "--name", "-n", required=True, help="Name to assign to the pipeline") description = argument.Argument("description", "--description", "-d", required=False, help="Description text of the pipeline") version = argument.Argument("version", "--version", "-v", required=False, help="Version string of the pipeline") allow_continue = argument.Argument( "continue_on_step_failure", "--continue", "-c", required=False, help="Boolean flag to allow a pipeline to continue executing after a step fails") output_file = argument.Argument("output_file", "--output-file", "-f", required=False, help="File to write output in JSON format") return cli_command.CliCommand("create", "Create a pipeline from a yaml definition.", [pipeline_yaml, name, description, version, allow_continue, output_file, argument.RESOURCE_GROUP_NAME, argument.WORKSPACE_NAME], function_path)
import os import ruamel from azureml._cli.run.run_subgroup import RunSubGroup from azureml._cli.cli_command import command from azureml._cli import argument from azureml.core import Run from azureml.exceptions import UserErrorException from azureml._restclient import ExperimentClient from azureml._base_sdk_common.cli_wrapper._common import _parse_key_values, _get_experiment_or_default from azureml.core import RunConfiguration, ScriptRunConfig from collections import OrderedDict PARENT_RUN_ID = argument.Argument("parent_run_id", "--parent-run-id", "", help="Parent Run ID") PIPELINE_RUN_ID = argument.Argument("pipeline_run_id", "--pipeline-run-id", "", help="Pipeline Run ID") DENYLISTED_RUNDTO_KEYS = [ 'token', 'token_expiry_time_utc', 'options' ] def _run_to_output_dict(run): # TODO: This should move to base run.py base_dict = run._run_dto for key in DENYLISTED_RUNDTO_KEYS: # Not user-meaningful - not a security issue base_dict.pop(key, None)
resource_group_name, auth=auth) workspaces_dict = Workspace.list(default_subscription_id, auth=auth, resource_group=resource_group_name) serialized_workspace_list = list() for workspace_name in workspaces_dict: for workspace_object in workspaces_dict[workspace_name]: serialized_workspace_list.append(workspace_object._to_dict()) return serialized_workspace_list NO_WAIT = argument.Argument( "no_wait", "--no-wait", "", action="store_true", help="Do not wait for the workspace deletion to complete.") DELETE_DEPENDENT_RESOURCES = argument.Argument( "delete_dependent_resources", "--all-resources", "", action="store_true", help= "Deletes resources which this workspace depends on like storage, acr, kv and app insights." ) ACR_RESOURCE = argument.Argument( "container_registry", "--acr",
# --------------------------------------------------------- import json from azureml._cli.dataset.dataset_subgroup import DatasetSubGroup from azureml._cli.cli_command import command from azureml._cli import argument from azureml.exceptions import UserErrorException from azureml.core.dataset import Dataset from azureml.data._dataset_deprecation import deprecated from azureml.data._dataset_persistence import generate_file_template, create_dataset_from_file DATASET_NAME = argument.Argument("dataset_name", "--name", "-n", required=False, help="Registration name of the dataset") DATASET_VERSION = argument.Argument("dataset_version", "--version", "-v", required=False, default='latest', help="Registration version of the dataset") DATASET_ID = argument.Argument("dataset_id", "--id", "-i", required=False, help="ID of the dataset saved to workspace") DATASET_FILE = argument.Argument("dataset_file", "--file",
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from azureml._cli.datastore.datastore_subgroup import DatastoreSubGroup from azureml._cli.cli_command import command from azureml._cli import argument from azureml.data.datastore_client import _DatastoreClient INCLUDE_SECRET = argument.Argument( "include_secret", "--include-secret", "", help="Show the registered secret for the datastores.", default=False) DATASTORE_NAME = argument.Argument("datastore_name", "--name", "-n", help="The datastore name.", required=True) @command(subgroup_type=DatastoreSubGroup, command="list", short_description="List datastores in the workspace", argument_list=[INCLUDE_SECRET]) def list_datastores_in_workspace(workspace=None, include_secret=False, logger=None): dss = _DatastoreClient.list(workspace)
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from azureml._cli import argument PE_NAME_ARGUMENT = argument.Argument( "pe-name", "--pe-name", "", help="Name of the workspace private endpoint. " "Use this parameter to restrict workspace access to private networks, via a private endpoint." ) PE_LOCATION_ARGUMENT = argument.Argument( "pe-location", "--pe-location", "", help="Location of the workspace private endpoint. " "If not specified it will be the same location of the workspace.") PE_VNET_NAME_ARGUMENT = argument.Argument( "pe-vnet-name", "--pe-vnet-name", "", help= "Name of the existing vnet to create the workspace private endpoint in. ") PE_SUBNET_NAME_ARGUMENT = argument.Argument( "pe-subnet-name", "--pe-subnet-name", "", default="default", help=
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from azureml._cli.environment.environment_subgroup import EnvironmentSubGroup from azureml._cli.cli_command import command from azureml._cli import argument from azureml.core.environment import Environment ENVIRONMENT_NAME = argument.Argument( "environment_name", "--name", "-n", required=True, help="Name of the environment") ENVIRONMENT_VERSION = argument.Argument( "environment_version", "--version", "-v", required=False, help="Version of the environment") ENVIRONMENT_DIRECTORY = argument.Argument( "environment_directory", "--directory", "-d", required=True, help="Directory for the environment") ENVIRONMENT_OVERWRITE = argument.Argument( "environment_overwrite", "--overwrite", "", action="store_true", required=False, help="Overwrite any existing destination folder") @command( subgroup_type=EnvironmentSubGroup, command="list", short_description="List environments in a workspace") def list_environments( workspace=None,