Skip to content

Commit

Permalink
Cosmetic changes
Browse files Browse the repository at this point in the history
Signed-off-by: noopur <[email protected]>
  • Loading branch information
noopurintel committed Dec 17, 2024
1 parent 967a9d5 commit 78131e1
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 26 deletions.
2 changes: 1 addition & 1 deletion tests/end_to_end/models/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
3 changes: 1 addition & 2 deletions tests/end_to_end/models/collaborator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
3 changes: 2 additions & 1 deletion tests/end_to_end/models/model_owner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 2 additions & 4 deletions tests/end_to_end/test_suites/memory_logs_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 0 additions & 3 deletions tests/end_to_end/test_suites/task_runner_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
11 changes: 5 additions & 6 deletions tests/end_to_end/utils/common_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions tests/end_to_end/utils/docker_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 2 additions & 4 deletions tests/end_to_end/utils/federation_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down Expand Up @@ -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
"""
Expand Down

0 comments on commit 78131e1

Please sign in to comment.