Skip to content

create_leaderboard async

create_leaderboard(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    name: Optional[LeaderboardName] = None,
    type: Optional[LeaderboardType] = None,
    description: Optional[LeaderboardDescription] = None,
    required_metrics: Optional[LeaderboardRequiredMetricList] = None,
    client_token: Optional[LeaderboardClientToken] = None,
    tags: Optional[TagList] = None,
) -> CreateLeaderboardResponse

Creates a leaderboard. A leaderboard ranks candidates, such as your models, by the evaluation metrics that you add to it with AddCandidate.

The leaderboard name must be unique in your account in the current Region. If a leaderboard with the same name already exists, CreateLeaderboard returns a ResourceAlreadyExists error.

Parameters:

  • name (Optional[LeaderboardName], default: None ) –

    The name of the leaderboard. The name must be unique in your account in the current Region.

  • type (Optional[LeaderboardType], default: None ) –

    The type of the leaderboard. The type determines what kind of candidates the leaderboard ranks.

  • description (Optional[LeaderboardDescription], default: None ) –

    A description of the leaderboard.

  • required_metrics (Optional[LeaderboardRequiredMetricList], default: None ) –

    The metrics that you expect each candidate on the leaderboard to report, grouped by evaluation criterion. SageMaker stores this list with the leaderboard and returns it in GetLeaderboard. AddCandidate doesn't check evaluation metrics against this list. You can't change the list after you create the leaderboard.

  • client_token (Optional[LeaderboardClientToken], default: None ) –

    A unique, case-sensitive identifier for the request. If you don't specify a client token, the Amazon Web Services SDKs and the Amazon Web Services CLI generate one for you.

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

    Tags to apply to the leaderboard. You can add tags to your leaderboard in the same way you add them in other Amazon Web Services services that support tagging. For more information about tagging Amazon Web Services resources, see Tagging your Amazon Web Services resources in the Tagging Amazon Web Services Resources User Guide.

Raises:

  • ConflictException –

    There was a conflict when you attempted to modify a SageMaker entity such as an Experiment or Artifact.

  • ResourceAlreadyExists –

    The resource that you are trying to create already exists. Use a different resource name, or delete the existing resource before retrying.

  • 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/async_sage_maker.py
async def create_leaderboard(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    name: Optional["capo_sagemaker.types.leaderboard_name.LeaderboardName"] = None,
    type: Optional["capo_sagemaker.types.leaderboard_type.LeaderboardType"] = None,
    description: Optional[
        "capo_sagemaker.types.leaderboard_description.LeaderboardDescription"
    ] = None,
    required_metrics: Optional[
        "capo_sagemaker.types.leaderboard_required_metric_list.LeaderboardRequiredMetricList"
    ] = None,
    client_token: Optional[
        "capo_sagemaker.types.leaderboard_client_token.LeaderboardClientToken"
    ] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
) -> "capo_sagemaker.types.create_leaderboard_response.CreateLeaderboardResponse":
    """<p>Creates a leaderboard. A leaderboard ranks candidates, such as your models, by the evaluation metrics that you add to it with <code>AddCandidate</code>.</p> <p>The leaderboard name must be unique in your account in the current Region. If a leaderboard with the same name already exists, <code>CreateLeaderboard</code> returns a <code>ResourceAlreadyExists</code> error.</p>

    Args:
        name: <p>The name of the leaderboard. The name must be unique in your account in the current Region.</p>
        type: <p>The type of the leaderboard. The type determines what kind of candidates the leaderboard ranks.</p>
        description: <p>A description of the leaderboard.</p>
        required_metrics: <p>The metrics that you expect each candidate on the leaderboard to report, grouped by evaluation criterion. SageMaker stores this list with the leaderboard and returns it in <code>GetLeaderboard</code>. <code>AddCandidate</code> doesn't check evaluation metrics against this list. You can't change the list after you create the leaderboard.</p>
        client_token: <p>A unique, case-sensitive identifier for the request. If you don't specify a client token, the Amazon Web Services SDKs and the Amazon Web Services CLI generate one for you.</p>
        tags: <p>Tags to apply to the leaderboard. You can add tags to your leaderboard in the same way you add them in other Amazon Web Services services that support tagging. For more information about tagging Amazon Web Services resources, see <a href="https://docs.aws.amazon.com/tag-editor/latest/userguide/tagging.html">Tagging your Amazon Web Services resources</a> in the <i>Tagging Amazon Web Services Resources User Guide</i>.</p>

    Raises:
        capo_sagemaker.errors.conflict_exception.ConflictException: <p>There was a conflict when you attempted to modify a SageMaker entity such as an <code>Experiment</code> or <code>Artifact</code>.</p>
        capo_sagemaker.errors.resource_already_exists.ResourceAlreadyExists: <p>The resource that you are trying to create already exists. Use a different resource name, or delete the existing resource before retrying.</p>
        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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.create_leaderboard_request.CreateLeaderboardRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.create_leaderboard_response.CreateLeaderboardResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_leaderboard

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.create_leaderboard.async_create_leaderboard(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateLeaderboard")
    )
    input_: capo_sagemaker.types.create_leaderboard_request.CreateLeaderboardRequest = {}
    if name is not None:
        input_["name"] = name
    if type is not None:
        input_["type"] = type
    if description is not None:
        input_["description"] = description
    if required_metrics is not None:
        input_["required_metrics"] = required_metrics
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output