Skip to content

create_trial_component

create_trial_component(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    trial_component_name: Optional[ExperimentEntityName] = None,
    display_name: Optional[ExperimentEntityName] = None,
    status: Optional[TrialComponentStatus] = None,
    start_time: Optional[Timestamp] = None,
    end_time: Optional[Timestamp] = None,
    parameters: Optional[TrialComponentParameters] = None,
    input_artifacts: Optional[TrialComponentArtifacts] = None,
    output_artifacts: Optional[TrialComponentArtifacts] = None,
    metadata_properties: Optional[MetadataProperties] = None,
    tags: Optional[TagList] = None,
) -> CreateTrialComponentResponse

Creates a trial component, which is a stage of a machine learning trial. A trial is composed of one or more trial components. A trial component can be used in multiple trials.

Trial components include pre-processing jobs, training jobs, and batch transform jobs.

When you use SageMaker Studio or the SageMaker Python SDK, all experiments, trials, and trial components are automatically tracked, logged, and indexed. When you use the Amazon Web Services SDK for Python (Boto), you must use the logging APIs provided by the SDK.

You can add tags to a trial component and then use the Search API to search for the tags.

Parameters:

  • trial_component_name (Optional[ExperimentEntityName], default: None ) –

    The name of the component. The name must be unique in your Amazon Web Services account and is not case-sensitive.

  • display_name (Optional[ExperimentEntityName], default: None ) –

    The name of the component as displayed. The name doesn't need to be unique. If DisplayName isn't specified, TrialComponentName is displayed.

  • status (Optional[TrialComponentStatus], default: None ) –

    The status of the component. States include:

    • InProgress

    • Completed

    • Failed

  • start_time (Optional[Timestamp], default: None ) –

    When the component started.

  • end_time (Optional[Timestamp], default: None ) –

    When the component ended.

  • parameters (Optional[TrialComponentParameters], default: None ) –

    The hyperparameters for the component.

  • input_artifacts (Optional[TrialComponentArtifacts], default: None ) –

    The input artifacts for the component. Examples of input artifacts are datasets, algorithms, hyperparameters, source code, and instance types.

  • output_artifacts (Optional[TrialComponentArtifacts], default: None ) –

    The output artifacts for the component. Examples of output artifacts are metrics, snapshots, logs, and images.

  • tags (Optional[TagList], default: None ) –

    A list of tags to associate with the component. You can use Search API to search on the tags.

Raises:

  • ResourceLimitExceeded –

    You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def create_trial_component(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    trial_component_name: Optional[
        "capo_sagemaker.types.experiment_entity_name.ExperimentEntityName"
    ] = None,
    display_name: Optional[
        "capo_sagemaker.types.experiment_entity_name.ExperimentEntityName"
    ] = None,
    status: Optional[
        "capo_sagemaker.types.trial_component_status.TrialComponentStatus"
    ] = None,
    start_time: Optional["capo_sagemaker.types.timestamp.Timestamp"] = None,
    end_time: Optional["capo_sagemaker.types.timestamp.Timestamp"] = None,
    parameters: Optional[
        "capo_sagemaker.types.trial_component_parameters.TrialComponentParameters"
    ] = None,
    input_artifacts: Optional[
        "capo_sagemaker.types.trial_component_artifacts.TrialComponentArtifacts"
    ] = None,
    output_artifacts: Optional[
        "capo_sagemaker.types.trial_component_artifacts.TrialComponentArtifacts"
    ] = None,
    metadata_properties: Optional[
        "capo_sagemaker.types.metadata_properties.MetadataProperties"
    ] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
) -> "capo_sagemaker.types.create_trial_component_response.CreateTrialComponentResponse":
    """<p>Creates a <i>trial component</i>, which is a stage of a machine learning <i>trial</i>. A trial is composed of one or more trial components. A trial component can be used in multiple trials.</p> <p>Trial components include pre-processing jobs, training jobs, and batch transform jobs.</p> <p>When you use SageMaker Studio or the SageMaker Python SDK, all experiments, trials, and trial components are automatically tracked, logged, and indexed. When you use the Amazon Web Services SDK for Python (Boto), you must use the logging APIs provided by the SDK.</p> <p>You can add tags to a trial component and then use the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Search.html">Search</a> API to search for the tags.</p>

    Args:
        trial_component_name: <p>The name of the component. The name must be unique in your Amazon Web Services account and is not case-sensitive.</p>
        display_name: <p>The name of the component as displayed. The name doesn't need to be unique. If <code>DisplayName</code> isn't specified, <code>TrialComponentName</code> is displayed.</p>
        status: <p>The status of the component. States include:</p> <ul> <li> <p>InProgress</p> </li> <li> <p>Completed</p> </li> <li> <p>Failed</p> </li> </ul>
        start_time: <p>When the component started.</p>
        end_time: <p>When the component ended.</p>
        parameters: <p>The hyperparameters for the component.</p>
        input_artifacts: <p>The input artifacts for the component. Examples of input artifacts are datasets, algorithms, hyperparameters, source code, and instance types.</p>
        output_artifacts: <p>The output artifacts for the component. Examples of output artifacts are metrics, snapshots, logs, and images.</p>
        tags: <p>A list of tags to associate with the component. You can use <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Search.html">Search</a> API to search on the tags.</p>

    Raises:
        capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.create_trial_component_request.CreateTrialComponentRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.create_trial_component_response.CreateTrialComponentResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_trial_component

        output, http_response = (
            capo_sagemaker._operations.sage_maker.create_trial_component.create_trial_component(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTrialComponent")
    )
    input_: capo_sagemaker.types.create_trial_component_request.CreateTrialComponentRequest = {}
    if trial_component_name is not None:
        input_["trial_component_name"] = trial_component_name
    if display_name is not None:
        input_["display_name"] = display_name
    if status is not None:
        input_["status"] = status
    if start_time is not None:
        input_["start_time"] = start_time
    if end_time is not None:
        input_["end_time"] = end_time
    if parameters is not None:
        input_["parameters"] = parameters
    if input_artifacts is not None:
        input_["input_artifacts"] = input_artifacts
    if output_artifacts is not None:
        input_["output_artifacts"] = output_artifacts
    if metadata_properties is not None:
        input_["metadata_properties"] = metadata_properties
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output