From 9a2a1dabbc18cd140b94b07b5cce3409acb93e50 Mon Sep 17 00:00:00 2001 From: "Chaurasiya, Payal" Date: Sun, 23 Feb 2025 22:21:07 -0800 Subject: [PATCH] Fix summary helper Signed-off-by: Chaurasiya, Payal --- .github/workflows/federated_runtime.yml | 4 ++-- .github/workflows/wf_functional_e2e.yml | 2 +- ..._runtime.yml => wf_secagg_federated_runtime.yml} | 4 ++-- .../test_suites/wf_federated_runtime_tests.py | 4 ++-- tests/end_to_end/utils/federation_helper.py | 2 +- tests/end_to_end/utils/summary_helper.py | 13 ++++++++++--- 6 files changed, 18 insertions(+), 11 deletions(-) rename .github/workflows/{secagg_federated_runtime.yml => wf_secagg_federated_runtime.yml} (95%) diff --git a/.github/workflows/federated_runtime.yml b/.github/workflows/federated_runtime.yml index 194e880ad9..5f92a054b0 100644 --- a/.github/workflows/federated_runtime.yml +++ b/.github/workflows/federated_runtime.yml @@ -12,7 +12,7 @@ permissions: jobs: test_federated_runtime_301_watermarking_notebook: - name: Watermarking Without TLS (torch/mnist, 3.10) + name: WF Watermarking Without TLS (torch/mnist, 3.10) if: | (github.event_name == 'schedule' && github.repository_owner == 'securefederatedai') || (github.event_name == 'workflow_dispatch') || @@ -50,7 +50,7 @@ jobs: if: ${{ always() }} run: | export PYTHONPATH="$PYTHONPATH:." - python tests/end_to_end/utils/summary_helper.py --func_name "print_federated_runtime_score" + python tests/end_to_end/utils/summary_helper.py --func_name "print_federated_runtime_score" --folder_name "wf_watermarking" echo "Test summary printed" - name: Tar files diff --git a/.github/workflows/wf_functional_e2e.yml b/.github/workflows/wf_functional_e2e.yml index 9d27a630b1..618db7543b 100644 --- a/.github/workflows/wf_functional_e2e.yml +++ b/.github/workflows/wf_functional_e2e.yml @@ -29,7 +29,7 @@ env: jobs: test_wf_functional_local_runtime: if: github.event.pull_request.draft == false - name: wf_functional_local_runtime + name: WF Functional Without TLS runs-on: ubuntu-22.04 timeout-minutes: 15 strategy: diff --git a/.github/workflows/secagg_federated_runtime.yml b/.github/workflows/wf_secagg_federated_runtime.yml similarity index 95% rename from .github/workflows/secagg_federated_runtime.yml rename to .github/workflows/wf_secagg_federated_runtime.yml index fa2c0cf1e4..5beb0006ff 100644 --- a/.github/workflows/secagg_federated_runtime.yml +++ b/.github/workflows/wf_secagg_federated_runtime.yml @@ -13,7 +13,7 @@ permissions: jobs: test_secure_agg_notebook: - name: SecAgg Without TLS (torch/mnist, 3.10) + name: WF SecAgg Without TLS (torch/mnist, 3.10) if: | (github.event_name == 'schedule' && github.repository_owner == 'securefederatedai') || (github.event_name == 'workflow_dispatch') || @@ -51,7 +51,7 @@ jobs: if: ${{ always() }} run: | export PYTHONPATH="$PYTHONPATH:." - python tests/end_to_end/utils/summary_helper.py --func_name "print_federated_runtime_score" + python tests/end_to_end/utils/summary_helper.py --func_name "print_federated_runtime_score" --folder_name "wf_secagg" echo "Test summary printed" - name: Tar files diff --git a/tests/end_to_end/test_suites/wf_federated_runtime_tests.py b/tests/end_to_end/test_suites/wf_federated_runtime_tests.py index 7ca51278c4..2e798ea0a4 100644 --- a/tests/end_to_end/test_suites/wf_federated_runtime_tests.py +++ b/tests/end_to_end/test_suites/wf_federated_runtime_tests.py @@ -29,7 +29,7 @@ def test_federated_runtime_301_watermarking(request): # Create result log files for the director and envoys result_path, participant_res_files = fh.create_federated_runtime_participant_res_files( - request.config.results_dir, envoys + request.config.results_dir, envoys, model_name="wf_watermarking" ) # Start the director @@ -94,7 +94,7 @@ def test_federated_runtime_secure_aggregation(request): # Create result log files for the director and envoys result_path, participant_res_files = fh.create_federated_runtime_participant_res_files( - request.config.results_dir, envoys, model_name="secure_aggregation_workflow" + request.config.results_dir, envoys, model_name="wf_secagg" ) # Start the director fh.start_director(workspace_path, participant_res_files["director"]) diff --git a/tests/end_to_end/utils/federation_helper.py b/tests/end_to_end/utils/federation_helper.py index 42dfcff714..329ad4ff14 100644 --- a/tests/end_to_end/utils/federation_helper.py +++ b/tests/end_to_end/utils/federation_helper.py @@ -831,7 +831,7 @@ def start_envoy(envoy_name, workspace_path, res_file): return True -def create_federated_runtime_participant_res_files(results_dir, envoys, model_name="301_mnist_watermarking"): +def create_federated_runtime_participant_res_files(results_dir, envoys, model_name): """ Create result log files for the director and envoys. Args: diff --git a/tests/end_to_end/utils/summary_helper.py b/tests/end_to_end/utils/summary_helper.py index 7e74a32ee9..9eb574b9d9 100644 --- a/tests/end_to_end/utils/summary_helper.py +++ b/tests/end_to_end/utils/summary_helper.py @@ -169,7 +169,7 @@ def print_task_runner_score(): ) -def print_federated_runtime_score(): +def print_federated_runtime_score(folder_name): """ Function to get the federated runtime score from the director log file And write the results to GitHub step summary @@ -183,7 +183,7 @@ def print_federated_runtime_score(): # Assumption - result directory is present in the home directory dir_res_file = os.path.join( result_path, - "301_mnist_watermarking", + folder_name, "director.log", ) @@ -243,6 +243,10 @@ def fetch_args(): parser.add_argument( "--func_name", required=True, default="", type=str, help="Name of function to be called" ) + # This argument is needed for workflow api and it value is set in the workflow during create_federated_runtime_participant_res_files as model_name + parser.add_argument( + "--folder_name", required=False, default="", type=str, help="Name of output folder" + ) args = parser.parse_args() return args @@ -255,4 +259,7 @@ def fetch_args(): if func_name in ["print_task_runner_score", "print_local_runtime_score"]: print_task_runner_score() elif func_name == "print_federated_runtime_score": - print_federated_runtime_score() + folder_name = args.folder_name + if not folder_name: + raise ValueError("folder_name argument is required for print_federated_runtime_score function") + print_federated_runtime_score(folder_name)