Command Class

Base class for command node, used for command component version consumption.

You should not instantiate this class directly. Instead, you should create from builder function: command.

Inheritance
azure.ai.ml.entities._builders.base_node.BaseNode
Command

Constructor

Command(*, component: str | CommandComponent, compute: str | None = None, inputs: Dict[str, Input | str | bool | int | float | Enum] | None = None, outputs: Dict[str, str | Output] | None = None, limits: CommandJobLimits | None = None, identity: ManagedIdentityConfiguration | AmlTokenConfiguration | UserIdentityConfiguration | None = None, distribution: Dict | MpiDistribution | TensorFlowDistribution | PyTorchDistribution | None = None, environment: Environment | str | None = None, environment_variables: Dict | None = None, resources: JobResourceConfiguration | None = None, services: Dict[str, JobService | JupyterLabJobService | SshJobService | TensorBoardJobService | VsCodeJobService] | None = None, **kwargs)

Parameters

component
CommandComponent
Required

Id or instance of the command component/job to be run for the step

inputs
<xref:Dict>[str, <xref:Union>[Input, <xref:SweepDistribution>, str, bool, int, float, <xref:Enum>, dict]]
Required

Inputs to the command.

outputs
<xref:Dict>[str, <xref:Union>[str, Output, dict]]
Required

Mapping of output data bindings used in the job.

name
str
Required

Name of the command.

description
str
Required

Description of the command.

tags
dict[str, str]
Required

Tag dictionary. Tags can be added, removed, and updated.

properties
dict[str, str]
Required

The job property dictionary.

display_name
str
Required

Display name of the job.

experiment_name
str
Required

Name of the experiment the job will be created under, if None is provided, default will be set to current directory name.

command
str
Required

Command to be executed in training.

compute
str
Required

The compute target the job runs on.

resources
<xref:Union>[<xref:Dict>, JobResourceConfiguration]
Required

Compute Resource configuration for the command.

code
str
Required

A local path or http:, https:, azureml: url pointing to a remote location.

distribution
<xref:Union>[<xref:Dict>, PyTorchDistribution, MpiDistribution, TensorFlowDistribution]
Required

Distribution configuration for distributed training.

environment
<xref:Union>[Environment, str]
Required

Environment that training job will run in.

limits
CommandJobLimits
Required

Command Job limit.

identity
<xref:Union>[<xref:ManagedIdentity>, <xref:AmlToken>, <xref:UserIdentity>]
Required

Identity that training job will use while running on compute.

services
<xref:Dict>[str, <xref:Union>[JobService, JupyterLabJobService, SshJobService, TensorBoardJobService, VsCodeJobService]]
Required

Interactive services for the node. This is an experimental parameter, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.

Methods

set_limits

Set limits for Command.

set_resources

Set resources for Command.

sweep

Turn the command into a sweep node with extra sweep run setting. The command component in current Command node will be used as its trial component. A command node can sweep for multiple times, and the generated sweep node will share the same trial component.

set_limits

Set limits for Command.

set_limits(*, timeout: int, **kwargs)

set_resources

Set resources for Command.

set_resources(*, instance_type: str | List[str] | None = None, instance_count: int | None = None, properties: Dict | None = None, docker_args: str | None = None, shm_size: str | None = None, **kwargs)

sweep

Turn the command into a sweep node with extra sweep run setting. The command component in current Command node will be used as its trial component. A command node can sweep for multiple times, and the generated sweep node will share the same trial component.

sweep(*, primary_metric: str, goal: str, sampling_algorithm: str = 'random', compute: str | None = None, max_concurrent_trials: int | None = None, max_total_trials: int | None = None, timeout: int | None = None, trial_timeout: int | None = None, early_termination_policy: EarlyTerminationPolicy | str | None = None, search_space: Dict[str, Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform] | None = None, identity: ManagedIdentityConfiguration | AmlTokenConfiguration | UserIdentityConfiguration | None = None) -> Sweep

Parameters

primary_metric
str
Required

primary metric of the sweep objective, AUC e.g. The metric must be logged in running the trial component.

goal
str, <xref:valid values: maximize> or <xref:minimize>
Required

goal of the sweep objective.

sampling_algorithm
str, <xref:valid values: random>, <xref:grid> or <xref:bayesian>
Required

sampling algorithm to sample inside search space. Defaults to "random"

compute
str
Required

target compute to run the node. If not specified, compute of current node will be used.

max_total_trials
int
Required

maximum trials to run, will overwrite value in limits

max_concurrent_trials
int
Required

Sweep Job max concurrent trials.

max_total_trials
Required

Sweep Job max total trials.

timeout
int
Required

The max run duration in seconds, after which the job will be cancelled.

trial_timeout
int
Required

Sweep Job Trial timeout value in seconds.

early_termination_policy
<xref:Union>[<xref:EarlyTerminationPolicy>, str], <xref:valid values: bandit>, <xref:median_stopping> or <xref:truncation_selection.>
Required

early termination policy of the sweep node:

identity
<xref:Union>[<xref:azure.ai.ml.entities.ManagedIdentityConfiguration,azure.ai.ml.entities.AmlTokenConfiguration,azure.ai.ml.entities.UserIdentityConfiguration>]
Required

Identity that training job will use while running on compute.

Returns

A sweep node with component from current Command node as its trial component.

Return type

Attributes

code

command

component

distribution

identity

Configuration of the hyperparameter identity.

parameters

MLFlow parameters.

Returns

MLFlow parameters logged in job.

Return type

<xref:Dict>[str, str]

resources

services