CommandComponent Class
Command component version, used to define a Command Component or Job.
Constructor
CommandComponent(*, name: str | None = None, version: str | None = None, description: str | None = None, tags: Dict | None = None, display_name: str | None = None, command: str | None = None, code: str | PathLike | None = None, environment: Environment | str | None = None, distribution: Dict | MpiDistribution | TensorFlowDistribution | PyTorchDistribution | RayDistribution | DistributionConfiguration | None = None, resources: JobResourceConfiguration | None = None, inputs: Dict | None = None, outputs: Dict | None = None, instance_count: int | None = None, is_deterministic: bool = True, additional_includes: List | None = None, properties: Dict | None = None, **kwargs: Any)
Keyword-Only Parameters
| Name | Description |
|---|---|
|
name
|
The name of the Command job or component. Default value: None
|
|
version
|
The version of the Command job or component. Default value: None
|
|
description
|
The description of the component. Defaults to None. Default value: None
|
|
tags
|
Tag dictionary. Tags can be added, removed, and updated. Defaults to None. Default value: None
|
|
display_name
|
The display name of the component. Default value: None
|
|
command
|
The command to be executed. Default value: None
|
|
code
|
The source code to run the job. Can be a local path or "http:", "https:", or "azureml:" url pointing to a remote location. Default value: None
|
|
environment
|
The environment that the job will run in. Default value: None
|
|
distribution
|
The configuration for distributed jobs. Defaults to None. Default value: None
|
|
resources
|
The compute resource configuration for the command. Default value: None
|
|
inputs
|
A mapping of input names to input data sources used in the job. Defaults to None. Default value: None
|
|
outputs
|
A mapping of output names to output data sources used in the job. Defaults to None. Default value: None
|
|
instance_count
|
The number of instances or nodes to be used by the compute target. Defaults to 1. Default value: None
|
|
is_deterministic
|
Specifies whether the Command will return the same output given the same input. Defaults to True. When True, if a Command (component) is deterministic and has been run before in the current workspace with the same input and settings, it will reuse results from a previous submitted job when used as a node or step in a pipeline. In that scenario, no compute resources will be used. Default value: True
|
|
additional_includes
|
A list of shared additional files to be included in the component. Defaults to None. Default value: None
|
|
properties
|
The job property dictionary. Defaults to None. Default value: None
|
Examples
Creating a CommandComponent.
from azure.ai.ml.entities import CommandComponent
component = CommandComponent(
name="sample_command_component_basic",
display_name="CommandComponentBasic",
description="This is the basic command component",
tags={"tag": "tagvalue", "owner": "sdkteam"},
version="1",
outputs={"component_out_path": {"type": "uri_folder"}},
command="echo Hello World",
code="./src",
environment="AzureML-sklearn-1.0-ubuntu20.04-py38-cpu:33",
)
Methods
| dump |
Dump the component content into a file in yaml format. |
dump
Dump the component content into a file in yaml format.
dump(dest: str | PathLike | IO, **kwargs: Any) -> None
Parameters
| Name | Description |
|---|---|
|
dest
Required
|
The destination to receive this component's content. Must be either a path to a local file, or an already-open file stream. If dest is a file path, a new file will be created, and an exception is raised if the file exists. If dest is an open file, the file will be written to directly, and an exception will be raised if the file is not writable. |
Attributes
base_path
creation_context
The creation context of the resource.
Returns
| Type | Description |
|---|---|
|
The creation metadata for the resource. |
display_name
distribution
The configuration for the distributed command component or job.
Returns
| Type | Description |
|---|---|
|
The distribution configuration. |
id
inputs
instance_count
The number of instances or nodes to be used by the compute target.
Returns
| Type | Description |
|---|---|
|
The number of instances or nodes. |
is_deterministic
Whether the component is deterministic.
Returns
| Type | Description |
|---|---|
|
Whether the component is deterministic |
outputs
resources
The compute resource configuration for the command component or job.
Returns
| Type | Description |
|---|---|
|
The compute resource configuration for the command component or job. |