def run_deep_canary_pr_testbuilds()

in src/start_testbuilds.py [0:0]


def run_deep_canary_pr_testbuilds():
    """
    Deep Canaries can only be run on PyTorch or TensorFlow, Training or Inference, x86 or Graviton/
    ARM64 DLC images.
    This helper function determines whether this PR build job has been enabled, and this job has
    corresponding Deep Canaries that can be executed.
    If both these conditions are true, then it configures and launches a "dlc-pr-deep-canary-test"
    test job to test the specific framework, image-type, arch-type subset of Prod DLC images that
    match this PR build job.
    As a part of the setup, this function needs to create the TEST_TRIGGER env variable, and
    populate the constants.TEST_ENV_PATH file, which would normally have been done by image_builder
    after building images, if it had executed on this PR build job.
    If this PR build job is not enabled, then it does nothing.
    """
    build_framework = os.getenv("FRAMEWORK")
    general_builder_enabled = config.is_general_builder_enabled_for_this_pr_build(build_framework)
    graviton_builder_enabled = config.is_graviton_builder_enabled_for_this_pr_build(build_framework)
    arm64_builder_enabled = config.is_arm64_builder_enabled_for_this_pr_build(build_framework)
    if config.is_deep_canary_mode_enabled() and (
        general_builder_enabled or graviton_builder_enabled or arm64_builder_enabled
    ):
        commit = os.getenv("CODEBUILD_RESOLVED_SOURCE_VERSION")
        # Write TEST_TRIGGER to TEST_ENV_PATH because image_builder wasn't run.
        test_env_variables = [
            {"name": "TEST_TRIGGER", "value": get_codebuild_project_name(), "type": "PLAINTEXT"},
        ]
        utils.write_to_json_file(constants.TEST_ENV_PATH, test_env_variables)
        test_type = "deep-canary"
        LOGGER.debug(f"test_type : {test_type}")
        pr_test_job = f"dlc-pr-{test_type}-test"
        if graviton_builder_enabled:
            pr_test_job += "-graviton"
        elif arm64_builder_enabled:
            pr_test_job += "-arm64"
        run_test_job(commit, pr_test_job)