sagemaker_image_builder/package_report.py [94:121]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def _validate_new_package_size(new_package_total_size, target_total_size, image_type, target_version):
    # Validate if the new packages account for <= 5% of the total python package size of target image.
    new_package_total_size_percent_threshold = 5
    validate_result = None
    new_package_total_size_percent = round(new_package_total_size / target_total_size * 100, 2)
    new_package_total_size_percent_string = str(new_package_total_size_percent)
    if new_package_total_size_percent > new_package_total_size_percent_threshold:
        validate_result = (
            "The total size of newly introduced Python packages accounts for more than "
            + str(new_package_total_size_percent_threshold)
            + "% of the total Python package size of "
            + image_type
            + " image, version "
            + str(target_version)
            + "! ("
            + str(new_package_total_size_percent)
            + "%)"
        )
        new_package_total_size_percent_string = "${\color{red}" + str(new_package_total_size_percent) + "}$"

    print(
        "The total size of newly introduced Python packages is "
        + sizeof_fmt(new_package_total_size)
        + ", accounts for "
        + new_package_total_size_percent_string
        + "% of the total package size."
    )
    return validate_result
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



sagemaker_image_builder/package_report.py [124:151]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def _validate_new_package_size(new_package_total_size, target_total_size, image_type, target_version):
    # Validate if the new packages account for <= 5% of the total python package size of target image.
    new_package_total_size_percent_threshold = 5
    validate_result = None
    new_package_total_size_percent = round(new_package_total_size / target_total_size * 100, 2)
    new_package_total_size_percent_string = str(new_package_total_size_percent)
    if new_package_total_size_percent > new_package_total_size_percent_threshold:
        validate_result = (
            "The total size of newly introduced Python packages accounts for more than "
            + str(new_package_total_size_percent_threshold)
            + "% of the total Python package size of "
            + image_type
            + " image, version "
            + str(target_version)
            + "! ("
            + str(new_package_total_size_percent)
            + "%)"
        )
        new_package_total_size_percent_string = "${\color{red}" + str(new_package_total_size_percent) + "}$"

    print(
        "The total size of newly introduced Python packages is "
        + sizeof_fmt(new_package_total_size)
        + ", accounts for "
        + new_package_total_size_percent_string
        + "% of the total package size."
    )
    return validate_result
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



