def get_image_uri(region_name, repo_name, repo_version=1):
    """Return algorithm image URI for the given AWS region, repository name, and
    repository version

    Args:
        region_name:
        repo_name:
        repo_version:
    """
    if repo_name == "xgboost":
        if repo_version in ["0.90", "0.90-1", "0.90-1-cpu-py3"]:
            return get_xgboost_image_uri(region_name, XGBOOST_VERSION_1)

        supported_version = [
            version for version in XGBOOST_SUPPORTED_VERSIONS
            if repo_version in (version, version + "-cpu-py3")
        ]
        if supported_version:
            return get_xgboost_image_uri(region_name, supported_version[0])

        logging.warning(
            "There is a more up to date SageMaker XGBoost image. "
            "To use the newer image, please set 'repo_version'="
            "'%s'. For example:\n"
            "\tget_image_uri(region, 'xgboost', '%s').",
            XGBOOST_VERSION_1,
            XGBOOST_VERSION_1,
        )
    repo = "{}:{}".format(repo_name, repo_version)
    return "{}/{}".format(registry(region_name, repo_name), repo)
def get_image_uri(region_name, repo_name, repo_version=1):
    """Return algorithm image URI for the given AWS region, repository name, and
    repository version

    Args:
        region_name:
        repo_name:
        repo_version:
    """
    if repo_name == "xgboost":
        if not _is_latest_xgboost_version(repo_version):
            logging.warning(
                "There is a more up to date SageMaker XGBoost image. "
                "To use the newer image, please set 'repo_version'="
                "'%s'. For example:\n"
                "\tget_image_uri(region, 'xgboost', '%s').",
                XGBOOST_LATEST_VERSION,
                XGBOOST_LATEST_VERSION,
            )

        if repo_version in [
                XGBOOST_VERSION_0_90
        ] + _generate_version_equivalents(XGBOOST_VERSION_0_90_1):
            return get_xgboost_image_uri(region_name, XGBOOST_VERSION_0_90_1)

        supported_version = [
            version for version in XGBOOST_SUPPORTED_VERSIONS
            if repo_version in _generate_version_equivalents(version)
        ]
        if supported_version:
            return get_xgboost_image_uri(region_name, supported_version[0])

    repo = "{}:{}".format(repo_name, repo_version)
    return "{}/{}".format(registry(region_name, repo_name), repo)
def get_image_uri(region_name, repo_name, repo_version=1):
    """Return algorithm image URI for the given AWS region, repository name, and
    repository version

    Args:
        region_name:
        repo_name:
        repo_version:
    """
    logger.warning(
        "'get_image_uri' method will be deprecated in favor of 'ImageURIProvider' class "
        "in SageMaker Python SDK v2."
    )

    repo_version = str(repo_version)

    if repo_name == XGBOOST_NAME:

        if repo_version in XGBOOST_1P_VERSIONS:
            _warn_newer_xgboost_image()
            return "{}/{}:{}".format(registry(region_name, repo_name), repo_name, repo_version)

        if "-" not in repo_version:
            xgboost_version_matches = [
                version
                for version in XGBOOST_SUPPORTED_VERSIONS
                if repo_version == version.split("-")[0]
            ]
            if xgboost_version_matches:
                # Assumes that XGBOOST_SUPPORTED_VERSION is sorted from oldest version to latest.
                # When SageMaker version is not specified, we use the oldest one that matches
                # XGBoost version for backward compatibility.
                repo_version = xgboost_version_matches[0]

        supported_framework_versions = [
            version
            for version in XGBOOST_SUPPORTED_VERSIONS
            if repo_version in _generate_version_equivalents(version)
        ]

        if not supported_framework_versions:
            raise ValueError(
                "SageMaker XGBoost version {} is not supported. Supported versions: {}".format(
                    repo_version, ", ".join(XGBOOST_SUPPORTED_VERSIONS)
                )
            )

        if not _is_latest_xgboost_version(repo_version):
            _warn_newer_xgboost_image()

        return get_xgboost_image_uri(region_name, supported_framework_versions[-1])

    repo = "{}:{}".format(repo_name, repo_version)
    return "{}/{}".format(registry(region_name, repo_name), repo)
def get_image_uri(region_name, repo_name, repo_version=1):
    """Return algorithm image URI for the given AWS region, repository name, and
    repository version

    Args:
        region_name:
        repo_name:
        repo_version:
    """
    if repo_name == "xgboost":
        if repo_version in ["0.90", "0.90-1", "0.90-1-cpu-py3"]:
            return get_xgboost_image_uri(region_name, XGBOOST_LATEST_VERSION)
        logging.warning(
            "There is a more up to date SageMaker XGBoost image."
            "To use the newer image, please set 'repo_version'="
            "'0.90-1. For example:\n"
            "\tget_image_uri(region, 'xgboost', %s).",
            XGBOOST_LATEST_VERSION,
        )
    repo = "{}:{}".format(repo_name, repo_version)
    return "{}/{}".format(registry(region_name, repo_name), repo)