in src/utils.py [0:0]
def parse_modified_dlc_test_files_info(files, framework, pattern=""):
"""
Parse all the files in PR to find ecs/eks/ec2 tests related changes for any framework
to trigger an image build matching the image_type(training/testing) for all the device_types(cpu,gpu)
and python_versions(py2,py3)
Args:
files:
framework:
pattern:
"""
rule = re.findall(rf"{pattern}", files)
# JobParameters variables are not set with constants.ALL
for test_file in rule:
test_dirs = test_file.split("/")
test_folder = test_dirs[0]
if test_folder == "dlc_tests":
test_name = test_dirs[1]
# The below code looks for file changes in /test/dlc_tests/(ecs|eks|ec2) directory
if test_name in ["ecs", "eks", "ec2"]:
framework_changed = test_dirs[2]
if framework_changed == framework:
job_name = test_dirs[3]
if job_name in constants.IMAGE_TYPES:
JobParameters.add_image_types(job_name)
JobParameters.build_for_all_device_types_py_versions()
update_image_run_test_types(job_name, test_name)
# If file changed is under /test/dlc_tests/(ecs|eks|ec2)
# but not in (inference|training) dirs
else:
JobParameters.build_for_all_images()
update_image_run_test_types(constants.ALL, test_name)
break
# If file changed is under /test/dlc_tests/(ecs|eks|ec2) dirs init and conftest files
elif framework_changed not in constants.FRAMEWORKS:
JobParameters.build_for_all_images()
update_image_run_test_types(constants.ALL, test_name)
break
# If file changed is under /test/dlc_tests/ dir sanity, container_tests dirs
# and init, conftest files
else:
JobParameters.build_for_all_images()
update_image_run_test_types(constants.ALL, constants.EC2_TESTS)
update_image_run_test_types(constants.ALL, constants.ECS_TESTS)
update_image_run_test_types(constants.ALL, constants.EKS_TESTS)
break