in src/main.py [0:0]
def get_arg_parser():
parser = argparse.ArgumentParser(
description="A command line utility to create new versions of Amazon SageMaker Distribution"
)
subparsers = parser.add_subparsers(dest="subcommand")
create_major_version_parser = subparsers.add_parser(
"create-major-version-artifacts", help="Creates a new major version of Amazon SageMaker Distribution."
)
create_major_version_parser.set_defaults(func=create_major_version_artifacts, runtime_version_upgrade_type=_MAJOR)
create_minor_version_parser = subparsers.add_parser(
"create-minor-version-artifacts", help="Creates a new minor version of Amazon SageMaker Distribution."
)
create_minor_version_parser.set_defaults(func=create_minor_version_artifacts, runtime_version_upgrade_type=_MINOR)
create_patch_version_parser = subparsers.add_parser(
"create-patch-version-artifacts", help="Creates a new patch version of Amazon SageMaker Distribution."
)
create_patch_version_parser.set_defaults(func=create_patch_version_artifacts, runtime_version_upgrade_type=_PATCH)
# Common arguments
for p in [create_major_version_parser, create_minor_version_parser, create_patch_version_parser]:
p.add_argument(
"--base-patch-version",
required=True,
help="Specify the base patch version from which a new version should be created.",
)
p.add_argument(
"--pre-release-identifier",
help="Optionally specify the pre-release identifier for this new version that should " "be created.",
)
p.add_argument(
"--force",
action="store_true",
help="Overwrites any existing directory corresponding to the new version that will be generated.",
)
build_image_parser = subparsers.add_parser("build", help="Builds a new image from the Dockerfile.")
build_image_parser.add_argument(
"--target-patch-version",
required=True,
help="Specify the target version of Amazon SageMaker Distribution for which an image needs to be built.",
)
build_image_parser.add_argument(
"--skip-tests", action="store_true", help="Disable running tests against the newly generated Docker image."
)
build_image_parser.add_argument(
"--force",
action="store_true",
help="Builds a new docker image which will fetch the latest versions of each package in "
"the conda environment. Any existing env.out file will be overwritten.",
)
build_image_parser.add_argument(
"--target-ecr-repo",
action="append",
help="Specify the AWS ECR repository in which this image needs to be uploaded.",
)
build_image_parser.add_argument("--region", help="Specify the region of the ECR repository.")
build_image_parser.set_defaults(func=build_images)
package_staleness_parser = subparsers.add_parser(
"generate-staleness-report",
help="Generates package staleness report for each of the marquee packages in the given " "image version.",
)
package_staleness_parser.set_defaults(func=generate_package_staleness_report)
package_staleness_parser.add_argument(
"--target-patch-version",
required=True,
help="Specify the base patch version for which the package staleness report needs to be " "generated.",
)
package_size_parser = subparsers.add_parser(
"generate-size-report",
help="Generates toatl image size and package size report for each of the packages in the given "
"image version.",
)
package_size_parser.set_defaults(func=generate_package_size_report)
package_size_parser.add_argument(
"--target-patch-version",
required=True,
help="Specify the target patch version for which the package size report needs to be " "generated.",
)
package_size_parser.add_argument(
"--staging-repo-name",
required=True,
help="Specify the staging repository",
)
package_size_parser.add_argument(
"--staging-account",
required=True,
help="Specify the staging account",
)
package_size_parser.add_argument(
"--validate",
action="store_true",
help="Validate package size delta and raise error if the validation failed.",
)
package_dependency_parser = subparsers.add_parser(
"generate-dependency-report",
help="Generates package dependency report for each of newly introcuded packages in the target image version.",
)
package_dependency_parser.set_defaults(func=generate_package_dependency_report)
package_dependency_parser.add_argument(
"--target-patch-version",
required=True,
help="Specify the target patch version for which the package dependency report needs to be generated.",
)
package_release_parser = subparsers.add_parser(
"generate-version-release-note",
help="Generates release for each new image version.",
)
package_release_parser.set_defaults(func=generate_new_version_release_note)
package_release_parser.add_argument(
"--target-patch-version",
required=True,
help="Specify the target patch version for which the release needs to be generated.",
)
package_release_parser.add_argument(
"--image-type",
required=True,
help="Specify the image type for which the release needs to be generated.",
)
return parser