diff --git a/tests/end_to_end/models/aggregator.py b/tests/end_to_end/models/aggregator.py index 1196a05586..332b6a5558 100644 --- a/tests/end_to_end/models/aggregator.py +++ b/tests/end_to_end/models/aggregator.py @@ -55,7 +55,7 @@ def start(self, res_file, run_for_dockerized_ws=False): Start the aggregator Args: res_file (str): Result file to track the logs - run_for_dockerized_ws (bool): Flag to run the aggregator inside a docker container + run_for_dockerized_ws (bool): Flag specific to dockerized workspace scenario. Default is False. Returns: str: Path to the log file """ diff --git a/tests/end_to_end/models/collaborator.py b/tests/end_to_end/models/collaborator.py index 01401c2ebd..b5474a5719 100644 --- a/tests/end_to_end/models/collaborator.py +++ b/tests/end_to_end/models/collaborator.py @@ -89,8 +89,7 @@ def import_pki(self, zip_name, run_for_dockerized_ws=False): Import and certify the CSR for the collaborator Args: zip_name (str): Zip file name - run_for_dockerized_ws (bool): Run the command inside the docker container - This is special case for dockerized workspace. + run_for_dockerized_ws (bool): Flag specific to dockerized workspace scenario. Default is False. Returns: bool: True if successful, else False """ diff --git a/tests/end_to_end/models/model_owner.py b/tests/end_to_end/models/model_owner.py index dd751c502f..31793fbf03 100644 --- a/tests/end_to_end/models/model_owner.py +++ b/tests/end_to_end/models/model_owner.py @@ -141,6 +141,7 @@ def modify_plan(self, param_config, plan_path): with open(plan_file) as fp: data = yaml.load(fp, Loader=yaml.FullLoader) + # NOTE: If more parameters need to be modified, add them here data["aggregator"]["settings"]["rounds_to_train"] = int(self.rounds_to_train) # Memory Leak related data["aggregator"]["settings"]["log_memory_usage"] = self.log_memory_usage @@ -214,7 +215,7 @@ def certify_workspace(self): def dockerize_workspace(self): """ - Dockerize the workspace + Dockerize the workspace. It internally uses workspace name as the image name """ log.info("Dockerizing the workspace. It will take some time to complete..") try: diff --git a/tests/end_to_end/test_suites/memory_logs_tests.py b/tests/end_to_end/test_suites/memory_logs_tests.py index aeb63a0924..4c4b30e821 100644 --- a/tests/end_to_end/test_suites/memory_logs_tests.py +++ b/tests/end_to_end/test_suites/memory_logs_tests.py @@ -12,10 +12,8 @@ log = logging.getLogger(__name__) -# Note: This test file contains the test cases for logging memory usage in a federated learning setup. -# Fixture and marker mapping: -# fx_federation_tr - task_runner_basic and task_runner_docker -# fx_federation_tr_dws - task_runner_dockerized_ws + +# NOTE: This test file contains the test cases for logging memory usage in a federated learning setup. @pytest.mark.task_runner_basic @pytest.mark.log_memory_usage diff --git a/tests/end_to_end/test_suites/task_runner_dockerized_ws_tests.py b/tests/end_to_end/test_suites/task_runner_dockerized_ws_tests.py index cf9976dd86..4adbc31dbd 100644 --- a/tests/end_to_end/test_suites/task_runner_dockerized_ws_tests.py +++ b/tests/end_to_end/test_suites/task_runner_dockerized_ws_tests.py @@ -11,9 +11,6 @@ # NOTE: This test file contains the test cases for the task runner federation using dockerized workspace approach. -# Fixture and marker mapping: -# fx_federation_tr - task_runner_basic and task_runner_docker -# fx_federation_tr_dws - task_runner_dockerized_ws @pytest.mark.task_runner_dockerized_ws def test_federation_via_dockerized_workspace(request, fx_federation_tr_dws): diff --git a/tests/end_to_end/test_suites/task_runner_tests.py b/tests/end_to_end/test_suites/task_runner_tests.py index 49ff240d2f..6363b7e452 100644 --- a/tests/end_to_end/test_suites/task_runner_tests.py +++ b/tests/end_to_end/test_suites/task_runner_tests.py @@ -11,9 +11,6 @@ # NOTE: This test file contains the test cases for the task runner federation using bare metal and docker approaches. -# Fixture and marker mapping: -# fx_federation_tr - task_runner_basic and task_runner_docker -# fx_federation_tr_dws - task_runner_dockerized_ws @pytest.mark.task_runner_basic def test_federation_via_native(request, fx_federation_tr): diff --git a/tests/end_to_end/utils/common_fixtures.py b/tests/end_to_end/utils/common_fixtures.py index cdedf7f91e..d431b1d88c 100644 --- a/tests/end_to_end/utils/common_fixtures.py +++ b/tests/end_to_end/utils/common_fixtures.py @@ -38,7 +38,7 @@ def fx_federation_tr(request): if test_env not in ["task_runner_docker", "task_runner_basic"]: raise ValueError( - "Use fx_federation_tr_dws for this test environment: task_runner_dockerized_ws" + "Fixture fx_federation_tr is only supported for task_runner_basic and task_runner_docker markers" ) collaborators = [] @@ -143,7 +143,7 @@ def fx_federation_tr_dws(request): """ if fh.get_test_env_from_markers(request) != "task_runner_dockerized_ws": raise ValueError( - "Use fx_federation_tr_dws for this test environment: task_runner_dockerized_ws" + "Fixture fx_federation_tr_dws is only supported for task_runner_dockerized_ws marker" ) collaborators = [] @@ -174,7 +174,10 @@ def fx_federation_tr_dws(request): # Initialize the plan model_owner.initialize_plan(agg_domain_name=agg_domain_name) + # Command 'fx workspace dockerize --save ..' will use the workspace name for image name + # which is 'workspace' in this case. model_owner.dockerize_workspace() + image_name = "workspace" # Certify the workspace in case of TLS # Register the collaborators in case of non-TLS @@ -225,10 +228,6 @@ def fx_federation_tr_dws(request): if return_code != 0: raise Exception(f"Failed to create tar for aggregator: {error}") - # When no name is provided 'fx workspace dockerize --save ..' will use the last folder name - # which is workspace in this case for tar and image name. - image_name = "workspace" - # Note: In case of multiple machines setup, scp this workspace tar # to the other machine(s) so that docker load can load the image. model_owner.load_workspace(workspace_tar_name=f"{image_name}.tar") diff --git a/tests/end_to_end/utils/docker_helper.py b/tests/end_to_end/utils/docker_helper.py index 1867d361ff..bfb8c214cb 100644 --- a/tests/end_to_end/utils/docker_helper.py +++ b/tests/end_to_end/utils/docker_helper.py @@ -94,7 +94,7 @@ def start_docker_container( volumes = { local_participant_path: {"bind": docker_participant_path, "mode": "rw"}, } - log.info(f"Volumes for {container_name}: {volumes}") + log.debug(f"Volumes for {container_name}: {volumes}") environment = { "WORKSPACE_PATH": docker_participant_path, @@ -106,7 +106,7 @@ def start_docker_container( key, val = keyval.split("=") environment[key] = val - log.info(f"Environment variables for {container_name}: {environment}") + log.debug(f"Environment variables for {container_name}: {environment}") # Start a container from the image container = client.containers.run( image, diff --git a/tests/end_to_end/utils/federation_helper.py b/tests/end_to_end/utils/federation_helper.py index 3ed6edfcb2..2247ddcd47 100644 --- a/tests/end_to_end/utils/federation_helper.py +++ b/tests/end_to_end/utils/federation_helper.py @@ -231,8 +231,7 @@ def run_federation(fed_obj, install_dependencies=True, run_for_dockerized_ws=Fal Args: fed_obj (object): Federation fixture object install_dependencies (bool): Install dependencies on collaborators (default is True) - run_for_dockerized_ws (bool): Run the command inside docker container (default is False) - This is special case for dockerized workspace where the command is run inside the container only at the end + run_for_dockerized_ws (bool): Flag specific to dockerized workspace scenario. Default is False. Returns: list: List of response files for all the participants """ @@ -593,8 +592,7 @@ def run_command( run_in_background (bool): Run the command in background bg_file (str): Background file (with path) print_output (bool): Print the output - run_for_dockerized_ws (bool): Run the command inside docker container - This is special case for dockerized workspace where the command is run inside the container only at the end + run_for_dockerized_ws (bool): Flag specific to dockerized workspace scenario. Default is False. Returns: tuple: Return code, output and error """