-
Notifications
You must be signed in to change notification settings - Fork 215
117 lines (99 loc) · 4.65 KB
/
federated_runtime.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#---------------------------------------------------------------------------
# Workflow to run 301_MNIST_Watermarking notebook
# Authors - Noopur, Payal Chaurasiya
#---------------------------------------------------------------------------
name: Federated Runtime 301 MNIST Watermarking
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
permissions:
contents: read
jobs:
run_notebook:
if: github.event.pull_request.draft == false
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Checkout OpenFL repository
uses: actions/[email protected]
with:
fetch-depth: 2 # needed for detecting changes
submodules: "true"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies # Without this step, fx command will not work
id: install_dependencies
run: |
python -m pip install --upgrade pip
pip install .
- name: Install Jupyter Lab Package
run: pip install jupyterlab
- name: Create results folder for logs
run: | # Present working director - /home/runner/work/openfl/openfl
mkdir -p /home/runner/results
cd /home/runner/results
touch director.log bangalore.log chandler.log && chmod 755 director.log bangalore.log chandler.log
- name: Activate and run the director in background
run: |
cd openfl-tutorials/experimental/workflow/FederatedRuntime/301_MNIST_Watermarking
fx experimental activate
cd director
nohup ./start_director.sh &> ~/results/director.log &
echo "Director started with 30s sleep time. This will be removed once the retry logic at envoy side is implemented."
sleep 30 # DO NOT remove - envoys will simply exit if director is not ready
- name: Run the envoy Bangalore in background
run: |
cd openfl-tutorials/experimental/workflow/FederatedRuntime/301_MNIST_Watermarking/Bangalore
nohup ./start_envoy.sh Bangalore Bangalore_config.yaml &> ~/results/bangalore.log &
echo "Bangalore envoy started"
- name: Run the envoy Chandler in background
run: |
cd openfl-tutorials/experimental/workflow/FederatedRuntime/301_MNIST_Watermarking/Chandler
nohup ./start_envoy.sh Chandler Chandler_config.yaml &> ~/results/chandler.log &
echo "Chandler envoy started"
- name: Check if envoys are connected to the director
run: |
python_path="tests/end_to_end/utils/github_helper.py"
python3 $python_path --func_name "verify_envoys_director_conn_federated_runtime" \
--notebook_path "openfl-tutorials/experimental/workflow/FederatedRuntime/301_MNIST_Watermarking/workspace/MNIST_Watermarking.ipynb" \
--expected_envoys "['Bangalore', 'Chandler']"
- name: Run Notebook
run: |
cd openfl-tutorials/experimental/workflow/FederatedRuntime/301_MNIST_Watermarking/workspace
jupyter nbconvert --execute --to markdown ./MNIST_Watermarking.ipynb --no-input --stdout
echo "Notebook run completed"
- name: Check if the experiment was successful using logs
run: |
cd openfl-tutorials/experimental/workflow/FederatedRuntime/301_MNIST_Watermarking
if ! grep "End of Federation reached." ~/results/bangalore.log; then
echo "Federation didn't reach end for Bangalore envoy"
fi
if ! grep "End of Federation reached." ~/results/chandler.log; then
echo "Federation didn't reach end for Chandler envoy"
fi
if ! grep "Experiment FederatedFlow_MNIST_Watermarking was finished successfully" ~/results/director.log; then
echo "Experiment didn't finish successfully"
exit 1
fi
echo "Notebook run was successful"
echo "| Aggregated model validation score |" >> $GITHUB_STEP_SUMMARY
echo "| -------------- |" >> $GITHUB_STEP_SUMMARY
echo $(grep -oP 'Aggregated model validation score = \K[\d.]+' ~/results/director.log | tail -1) >> $GITHUB_STEP_SUMMARY
- name: Tar files
if: ${{ always() }} # collect artifacts regardless of failures
run: |
tar -cvf notebook.tar \
./openfl-tutorials/experimental/workflow/FederatedRuntime/301_MNIST_Watermarking/workspace \
~/results \
--ignore-failed-read
echo "TAR file created"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
if: ${{ always() }} # collect artifacts regardless of failures
with:
name: federated_runtime_301_watermarking_${{ github.run_id }}
path: notebook.tar