Skip to content

Commit 97a4b99

Browse files
Merge branch 'feature/SK-1336' into feature/SK-1688
2 parents f2d82c2 + a32e151 commit 97a4b99

File tree

104 files changed

+4571
-1820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+4571
-1820
lines changed

.ci/tests/examples/print_logs.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,23 @@ if [ "$service" == "api-server" ]; then
2222
fi
2323

2424
if [ "$service" == "combiner" ]; then
25-
echo "Reducer logs"
25+
echo "Combiner logs"
2626
docker logs "$(basename $PWD)-combiner-1"
2727
exit 0
2828
fi
2929

30+
if [ "$service" == "controller" ]; then
31+
echo "Controller logs"
32+
docker logs "$(basename $PWD)-controller-1"
33+
exit 0
34+
fi
35+
36+
if [ "$service" == "hooks" ]; then
37+
echo "Hooks logs"
38+
docker logs "hook"
39+
exit 0
40+
fi
41+
3042
if [ "$service" == "client" ]; then
3143
echo "Client 0 logs"
3244
if [ "$example" == "mnist-keras" ]; then

.ci/tests/examples/run.sh

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ else
2828
docker compose \
2929
-f ../../docker-compose.yaml \
3030
-f docker-compose.override.yaml \
31-
up -d --build combiner api-server mongo minio client1
31+
up -d --build combiner controller api-server hooks mongo minio client1
3232
fi
3333

3434
# add server functions to python path to import server functions code
@@ -40,6 +40,9 @@ python ../../.ci/tests/examples/wait_for.py reducer
4040
>&2 echo "Wait for combiners to connect"
4141
python ../../.ci/tests/examples/wait_for.py combiners
4242

43+
>&2 echo "Wait for controller to connect"
44+
python ../../.ci/tests/examples/wait_for.py controller
45+
4346
>&2 echo "Upload compute package"
4447
python ../../.ci/tests/examples/api_test.py set_package --path package.tgz --helper "$helper" --name test
4548

@@ -61,20 +64,6 @@ fi
6164
>&2 echo "Checking rounds success"
6265
python ../../.ci/tests/examples/wait_for.py rounds
6366

64-
>&2 echo "Test client connection with dowloaded settings"
65-
# Get config
66-
python ../../.ci/tests/examples/api_test.py get_client_config --output ../../client.yaml
67-
68-
# Redeploy clients with config
69-
docker compose \
70-
-f ../../docker-compose.yaml \
71-
-f docker-compose.override.yaml \
72-
-f ../../.ci/tests/examples/compose-client-settings.override.yaml \
73-
up -d
74-
75-
>&2 echo "Wait for clients to reconnect"
76-
python ../../.ci/tests/examples/wait_for.py clients
77-
7867
>&2 echo "Test API GET requests"
7968
python ../../.ci/tests/examples/api_test.py test_api_get_methods
8069

.ci/tests/examples/wait_for.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,20 @@ def _test_nodes(n_nodes, node_type, reducer_host='localhost', reducer_port='8092
6363
_eprint(f'Request exception enconuntered: {e}.')
6464
return False
6565

66+
def _test_controller(reducer_host='localhost', reducer_port='8092'):
67+
try:
68+
response = requests.get(
69+
f'http://{reducer_host}:{reducer_port}/get_controller_status', verify=False)
70+
71+
if response.status_code == 200:
72+
data = json.loads(response.content)
73+
_eprint(f'Controller is running: {data}')
74+
return True
75+
76+
except Exception as e:
77+
_eprint(f'Request exception encountered: {e}.')
78+
return False
79+
6680

6781
def rounds(n_rounds=3):
6882
assert (_retry(_test_rounds, n_rounds=n_rounds))
@@ -79,6 +93,9 @@ def combiners(n_combiners=1):
7993
def reducer():
8094
assert (_retry(_test_nodes, n_nodes=1, node_type='reducer'))
8195

96+
def controller():
97+
assert (_retry(_test_controller))
98+
8299

83100
if __name__ == '__main__':
84101
fire.Fire()

.github/workflows/build-containers.yaml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
name: "build containers"
1+
name: build containers
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
custom_tag:
7+
description: "Extra image tag to add (e.g. torchimage)"
8+
required: false
9+
default: ""
10+
extra_pip_packages:
11+
description: "Space-separated pip packages to add (e.g. numpy==1.26.4 uvicorn)"
12+
required: false
13+
default: ""
514
push:
6-
branches:
7-
- master
8-
- develop
15+
branches: [ master, develop ]
916
pull_request:
10-
branches:
11-
- develop
12-
- master
17+
branches: [ develop, master ]
1318
release:
1419
types: [published]
1520

1621
jobs:
1722
build-containers:
1823
runs-on: ubuntu-latest
19-
2024
permissions:
2125
packages: write
2226
contents: read
@@ -43,14 +47,14 @@ jobs:
4347
type=semver,pattern={{version}}
4448
type=semver,pattern={{major}}.{{minor}}
4549
type=sha
50+
type=raw,value=${{ inputs.custom_tag }},enable=${{ inputs.custom_tag != '' }}
4651
4752
- name: Log in to GitHub Container Registry
4853
uses: docker/login-action@v3
4954
with:
5055
registry: ghcr.io
5156
username: ${{ github.actor }}
5257
password: ${{ secrets.GITHUB_TOKEN }}
53-
5458

5559
- name: Build and push
5660
uses: docker/build-push-action@v6
@@ -60,3 +64,5 @@ jobs:
6064
tags: ${{ steps.meta1.outputs.tags }}
6165
labels: ${{ steps.meta1.outputs.labels }}
6266
file: Dockerfile
67+
build-args: |
68+
EXTRA_PIP_PACKAGES=${{ inputs.extra_pip_packages }}

.github/workflows/code-checks.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ jobs:
2626
--exclude-dir='flower-client'
2727
--exclude='tests.py'
2828
--exclude='controller_cmd.py'
29+
--exclude='api_server_cmd.py'
2930
--exclude='fedn_pb2_grpc.py'
31+
--exclude='fedn_pb2.pyi'
3032
--exclude='combiner_cmd.py'
3133
--exclude='run_cmd.py'
3234
--exclude='README.rst'

.github/workflows/integration-tests.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
- '.github/**'
1616
branches:
1717
- "**"
18+
workflow_dispatch:
1819

1920
jobs:
2021
integration-tests:
@@ -50,7 +51,15 @@ jobs:
5051
- name: print logs combiner
5152
if: failure()
5253
run: .ci/tests/examples/print_logs.sh combiner ${{ matrix.to_test }}
54+
55+
- name: print logs controller
56+
if: failure()
57+
run: .ci/tests/examples/print_logs.sh controller ${{ matrix.to_test }}
5358

59+
- name: print logs hooks
60+
if: failure()
61+
run: .ci/tests/examples/print_logs.sh hooks ${{ matrix.to_test }}
62+
5463
- name: print logs client
5564
if: failure()
5665
run: .ci/tests/examples/print_logs.sh client ${{ matrix.to_test }}
@@ -62,3 +71,5 @@ jobs:
6271
- name: print logs minio
6372
if: failure()
6473
run: .ci/tests/examples/print_logs.sh minio ${{ matrix.to_test }}
74+
75+

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ config/settings-combiner.yaml
175175
config/extra-hosts-client.yaml
176176
config/extra-hosts-reducer.yaml
177177
config/settings-client.yaml
178-
config/settings-reducer.yaml
179-
config/settings-combiner.yaml
178+
config/settings-api-server.yaml
179+
config/settings-controller.yaml
180180
config/settings-hooks.yaml
181181

182182
./tmp/*

.readthedocs.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ build:
77
jobs:
88
pre_build:
99
- sphinx-apidoc --ext-autodoc --module-first -o docs fedn ./*tests* ./fedn/cli* ./fedn/common* ./fedn/network/api/v1* ./fedn/network/grpc/fedn_pb2.py ./fedn/network/grpc/fedn_pb2_grpc.py ./fedn/network/api/server.py ./fedn/network/controller/controlbase.py
10+
1011
sphinx:
1112
configuration: docs/conf.py
13+
fail_on_warning: false
1214

1315
python:
1416
install:
1517
- method: pip
1618
path: .
1719
- requirements: docs/requirements.txt
20+
21+
# Ensure documentation is publicly accessible
22+
# Make sure this is not set to private in RTD settings

Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM $BASE_IMG AS builder
55
ARG GRPC_HEALTH_PROBE_VERSION=""
66
ARG REQUIREMENTS=""
77

8-
ARG INSTALL_TORCH=0
8+
ARG EXTRA_PIP_PACKAGES=""
99

1010
WORKDIR /build
1111

@@ -36,9 +36,12 @@ RUN python -m venv /venv \
3636
fi \
3737
&& rm -rf /build/requirements.txt
3838

39-
# only install torch when asked
40-
RUN if [ "$INSTALL_TORCH" = "1" ]; then /venv/bin/pip install torch; fi
41-
39+
RUN if [ -n "$EXTRA_PIP_PACKAGES" ]; then \
40+
echo "Installing extra pip packages: $EXTRA_PIP_PACKAGES" && \
41+
/venv/bin/pip install --no-cache-dir $EXTRA_PIP_PACKAGES; \
42+
else \
43+
echo "No EXTRA_PIP_PACKAGES provided"; \
44+
fi
4245

4346
# Install grpc health probe
4447
RUN if [ ! -z "$GRPC_HEALTH_PROBE_VERSION" ]; then \
@@ -79,4 +82,3 @@ RUN set -ex \
7982
USER appuser
8083

8184
ENTRYPOINT [ "/venv/bin/fedn" ]
82-

Dockerfile.dev

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ COPY . /app
1212
COPY config/settings-client.yaml.template /app/config/settings-client.yaml
1313
COPY config/settings-combiner.yaml.template /app/config/settings-combiner.yaml
1414
COPY config/settings-hooks.yaml.template /app/config/settings-hooks.yaml
15-
COPY config/settings-reducer.yaml.template /app/config/settings-reducer.yaml
15+
COPY config/settings-api-server.yaml.template /app/config/settings-api-server.yaml
16+
COPY config/settings-controller.yaml.template /app/config/settings-controller.yaml
1617
COPY $REQUIREMENTS /app/config/requirements.txt
1718

1819
# Install developer tools (needed for psutil)

0 commit comments

Comments
 (0)