Skip to content

Commit

Permalink
Minor corrections and reverts
Browse files Browse the repository at this point in the history
Signed-off-by: noopur <[email protected]>
  • Loading branch information
noopurintel committed Jan 20, 2025
1 parent 9f06608 commit 323b895
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 164 deletions.
1 change: 0 additions & 1 deletion .github/workflows/federated_runtime.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#---------------------------------------------------------------------------
# Workflow to run 301_MNIST_Watermarking notebook
# Authors - Noopur, Payal Chaurasiya
#---------------------------------------------------------------------------
name: Federated Runtime 301 MNIST Watermarking

Expand Down
268 changes: 133 additions & 135 deletions .github/workflows/task_runner_basic_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
# There are open issues for some of the models, so excluding them for now:
# model_name: [ "torch_cnn_mnist", "keras_cnn_mnist", "torch_cnn_histology" ]
# model_name: ["torch_cnn_mnist", "keras_cnn_mnist", "xgb_higgs"]
model_name: ["xgb_higgs"]
# python_version: ["3.10", "3.11", "3.12"]
python_version: ["3.10"]
# There are open issues for some of the models, so excluding them for now.
# Also models like xgb_higgs require runners with higher memory and CPU to run.
model_name: ["torch_cnn_mnist", "keras_cnn_mnist"]
python_version: ["3.10", "3.11", "3.12"]
fail-fast: false # do not immediately fail if one of the combinations fail

env:
Expand Down Expand Up @@ -73,132 +71,132 @@ jobs:
with:
test_type: "tr_tls"

# test_with_non_tls:
# name: tr_non_tls
# runs-on: ubuntu-22.04
# timeout-minutes: 30
# strategy:
# matrix:
# # Testing non TLS scenario only for torch_cnn_mnist model and python 3.10
# # If required, this can be extended to other models and python versions
# model_name: ["torch_cnn_mnist"]
# python_version: ["3.10"]
# fail-fast: false # do not immediately fail if one of the combinations fail

# env:
# MODEL_NAME: ${{ matrix.model_name }}
# PYTHON_VERSION: ${{ matrix.python_version }}

# steps:
# - name: Checkout OpenFL repository
# id: checkout_openfl
# uses: actions/[email protected]
# with:
# fetch-depth: 2 # needed for detecting changes
# submodules: "true"
# token: ${{ secrets.GITHUB_TOKEN }}

# - name: Pre test run
# uses: ./.github/actions/tr_pre_test_run
# if: ${{ always() }}

# - name: Run Task Runner E2E tests without TLS
# id: run_tests
# run: |
# python -m pytest -s tests/end_to_end/test_suites/task_runner_tests.py \
# -m task_runner_basic --model_name ${{ env.MODEL_NAME }} \
# --num_rounds ${{ env.NUM_ROUNDS }} --num_collaborators ${{ env.NUM_COLLABORATORS }} --disable_tls
# echo "Task runner end to end test run completed"

# - name: Post test run
# uses: ./.github/actions/tr_post_test_run
# if: ${{ always() }}
# with:
# test_type: "tr_non_tls"

# test_with_no_client_auth:
# name: tr_no_client_auth
# runs-on: ubuntu-22.04
# timeout-minutes: 30
# strategy:
# matrix:
# # Testing non TLS scenario only for torch_cnn_mnist model and python 3.10
# # If required, this can be extended to other models and python versions
# model_name: ["keras_cnn_mnist"]
# python_version: ["3.10"]
# fail-fast: false # do not immediately fail if one of the combinations fail

# env:
# MODEL_NAME: ${{ matrix.model_name }}
# PYTHON_VERSION: ${{ matrix.python_version }}

# steps:
# - name: Checkout OpenFL repository
# id: checkout_openfl
# uses: actions/[email protected]
# with:
# fetch-depth: 2 # needed for detecting changes
# submodules: "true"
# token: ${{ secrets.GITHUB_TOKEN }}

# - name: Pre test run
# uses: ./.github/actions/tr_pre_test_run
# if: ${{ always() }}

# - name: Run Task Runner E2E tests without TLS
# id: run_tests
# run: |
# python -m pytest -s tests/end_to_end/test_suites/task_runner_tests.py \
# -m task_runner_basic --model_name ${{ env.MODEL_NAME }} \
# --num_rounds ${{ env.NUM_ROUNDS }} --num_collaborators ${{ env.NUM_COLLABORATORS }} --disable_client_auth
# echo "Task runner end to end test run completed"

# - name: Post test run
# uses: ./.github/actions/tr_post_test_run
# if: ${{ always() }}
# with:
# test_type: "tr_no_client_auth"

# test_memory_logs:
# name: tr_tls_memory_logs
# runs-on: ubuntu-22.04
# timeout-minutes: 30
# strategy:
# matrix:
# # Testing non TLS scenario only for torch_cnn_mnist model and python 3.10
# # If required, this can be extended to other models and python versions
# model_name: ["torch_cnn_mnist"]
# python_version: ["3.10"]
# fail-fast: false # do not immediately fail if one of the combinations fail

# env:
# MODEL_NAME: ${{ matrix.model_name }}
# PYTHON_VERSION: ${{ matrix.python_version }}

# steps:
# - name: Checkout OpenFL repository
# id: checkout_openfl
# uses: actions/[email protected]
# with:
# fetch-depth: 2 # needed for detecting changes
# submodules: "true"
# token: ${{ secrets.GITHUB_TOKEN }}

# - name: Pre test run
# uses: ./.github/actions/tr_pre_test_run
# if: ${{ always() }}

# - name: Run Task Runner E2E tests with TLS and memory logs
# id: run_tests
# run: |
# python -m pytest -s tests/end_to_end/test_suites/memory_logs_tests.py \
# -k test_log_memory_usage_basic --model_name ${{ env.MODEL_NAME }} \
# --num_rounds ${{ env.NUM_ROUNDS }} --num_collaborators ${{ env.NUM_COLLABORATORS }} \
# --log_memory_usage
# echo "Task runner memory logs test run completed"

# - name: Post test run
# uses: ./.github/actions/tr_post_test_run
# if: ${{ always() }}
# with:
# test_type: "tr_tls_memory_logs"
test_with_non_tls:
name: tr_non_tls
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
matrix:
# Testing non TLS scenario only for torch_cnn_mnist model and python 3.10
# If required, this can be extended to other models and python versions
model_name: ["torch_cnn_mnist"]
python_version: ["3.10"]
fail-fast: false # do not immediately fail if one of the combinations fail

env:
MODEL_NAME: ${{ matrix.model_name }}
PYTHON_VERSION: ${{ matrix.python_version }}

steps:
- name: Checkout OpenFL repository
id: checkout_openfl
uses: actions/[email protected]
with:
fetch-depth: 2 # needed for detecting changes
submodules: "true"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Pre test run
uses: ./.github/actions/tr_pre_test_run
if: ${{ always() }}

- name: Run Task Runner E2E tests without TLS
id: run_tests
run: |
python -m pytest -s tests/end_to_end/test_suites/task_runner_tests.py \
-m task_runner_basic --model_name ${{ env.MODEL_NAME }} \
--num_rounds ${{ env.NUM_ROUNDS }} --num_collaborators ${{ env.NUM_COLLABORATORS }} --disable_tls
echo "Task runner end to end test run completed"
- name: Post test run
uses: ./.github/actions/tr_post_test_run
if: ${{ always() }}
with:
test_type: "tr_non_tls"

test_with_no_client_auth:
name: tr_no_client_auth
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
matrix:
# Testing non TLS scenario only for torch_cnn_mnist model and python 3.10
# If required, this can be extended to other models and python versions
model_name: ["keras_cnn_mnist"]
python_version: ["3.10"]
fail-fast: false # do not immediately fail if one of the combinations fail

env:
MODEL_NAME: ${{ matrix.model_name }}
PYTHON_VERSION: ${{ matrix.python_version }}

steps:
- name: Checkout OpenFL repository
id: checkout_openfl
uses: actions/[email protected]
with:
fetch-depth: 2 # needed for detecting changes
submodules: "true"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Pre test run
uses: ./.github/actions/tr_pre_test_run
if: ${{ always() }}

- name: Run Task Runner E2E tests without TLS
id: run_tests
run: |
python -m pytest -s tests/end_to_end/test_suites/task_runner_tests.py \
-m task_runner_basic --model_name ${{ env.MODEL_NAME }} \
--num_rounds ${{ env.NUM_ROUNDS }} --num_collaborators ${{ env.NUM_COLLABORATORS }} --disable_client_auth
echo "Task runner end to end test run completed"
- name: Post test run
uses: ./.github/actions/tr_post_test_run
if: ${{ always() }}
with:
test_type: "tr_no_client_auth"

test_memory_logs:
name: tr_tls_memory_logs
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
matrix:
# Testing non TLS scenario only for torch_cnn_mnist model and python 3.10
# If required, this can be extended to other models and python versions
model_name: ["torch_cnn_mnist"]
python_version: ["3.10"]
fail-fast: false # do not immediately fail if one of the combinations fail

env:
MODEL_NAME: ${{ matrix.model_name }}
PYTHON_VERSION: ${{ matrix.python_version }}

steps:
- name: Checkout OpenFL repository
id: checkout_openfl
uses: actions/[email protected]
with:
fetch-depth: 2 # needed for detecting changes
submodules: "true"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Pre test run
uses: ./.github/actions/tr_pre_test_run
if: ${{ always() }}

- name: Run Task Runner E2E tests with TLS and memory logs
id: run_tests
run: |
python -m pytest -s tests/end_to_end/test_suites/memory_logs_tests.py \
-k test_log_memory_usage_basic --model_name ${{ env.MODEL_NAME }} \
--num_rounds ${{ env.NUM_ROUNDS }} --num_collaborators ${{ env.NUM_COLLABORATORS }} \
--log_memory_usage
echo "Task runner memory logs test run completed"
- name: Post test run
uses: ./.github/actions/tr_post_test_run
if: ${{ always() }}
with:
test_type: "tr_tls_memory_logs"
28 changes: 2 additions & 26 deletions .github/workflows/tr_docker_native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Create workspace image
run: |
fx workspace create --prefix example_workspace --template xgb_higgs
fx workspace create --prefix example_workspace --template keras_cnn_mnist
cd example_workspace
fx plan initialize -a localhost
fx workspace dockerize --save --revision https://github.com/${GITHUB_REPOSITORY}.git@${{ github.event.pull_request.head.sha }}
Expand Down Expand Up @@ -58,25 +58,6 @@ jobs:
rm -f $tarfiles
rm -f col_charlie_to_agg_cert_request.zip
# Delta
fx collaborator create -d data/2 -n delta --silent
fx collaborator generate-cert-request -n delta --silent
fx collaborator certify --request-pkg col_delta_to_agg_cert_request.zip --silent
# Pack the collaborator's private key, signed cert, and data.yaml into a tarball
tarfiles="plan/data.yaml agg_to_col_delta_signed_cert.zip"
for entry in cert/client/*; do
if [[ "$entry" == *.key ]]; then
tarfiles="$tarfiles $entry"
fi
done
tar -cf cert_col_delta.tar $tarfiles
# Clean up
rm -f $tarfiles
rm -f col_delta_to_agg_cert_request.zip
- name: Create signed cert for aggregator
run: |
cd example_workspace
Expand All @@ -102,15 +83,10 @@ jobs:
docker run --rm \
--network host \
--mount type=bind,source=./cert_agg.tar,target=/certs.tar \
example_workspace bash -c "tar -xf /certs.tar && fx aggregator start"
example_workspace bash -c "tar -xf /certs.tar && fx aggregator start" &
# TODO: Run with two collaborators instead.
docker run --rm \
--network host \
--mount type=bind,source=./cert_col_charlie.tar,target=/certs.tar \
example_workspace bash -c "tar -xf /certs.tar && fx collaborator certify --import agg_to_col_charlie_signed_cert.zip && fx collaborator start -n charlie"
docker run --rm \
--network host \
--mount type=bind,source=./cert_col_delta.tar,target=/certs.tar \
example_workspace bash -c "tar -xf /certs.tar && fx collaborator certify --import agg_to_col_delta_signed_cert.zip && fx collaborator start -n delta"
2 changes: 1 addition & 1 deletion tests/end_to_end/models/collaborator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import logging

import tests.end_to_end.utils.docker_helper as dh
import tests.end_to_end.utils.federation_helper as fh
import tests.end_to_end.utils.exceptions as ex
import tests.end_to_end.utils.federation_helper as fh

log = logging.getLogger(__name__)

Expand Down
4 changes: 3 additions & 1 deletion tests/end_to_end/utils/federation_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def _create_tarball(collaborator_name, index, local_bind_path, add_data):
]
client_certs = " ".join(client_cert_entries) if client_cert_entries else ""
tarfiles += f" agg_to_col_{collaborator_name}_signed_cert.zip {client_certs}"
# IMPORTANT: Model xgb_higgs uses format like data/1 and data/2, thus adding data to tarball in the same format.
if add_data:
tarfiles += f" data/{index}"

Expand Down Expand Up @@ -681,7 +682,8 @@ def setup_collaborator(index, workspace_path, local_bind_path):

def setup_collaborator_data(collaborators, model_name, local_bind_path):
"""
This function is specific to the model and should be updated as per the model requirements.
Function to setup the data for collaborators.
IMP: This function is specific to the model and should be updated as per the model requirements.
Args:
collaborators (list): List of collaborator objects
model_name (str): Model name
Expand Down

0 comments on commit 323b895

Please sign in to comment.