Skip to content

Commit bd9b81f

Browse files
committed
fl example working with 3 hospitals
1 parent 4f8f6bd commit bd9b81f

21 files changed

+1397
-572
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM continuumio/miniconda3
2+
3+
ENV WORKSPACE /workspace
4+
5+
ARG jupyter_port
6+
ENV env_jupyter_port=jupyter_port
7+
8+
# Setup workspace environment
9+
RUN apt-get update && apt-get install -y gcc
10+
# RUN conda install jupyter notebook=5.7.8
11+
RUN conda install jupyter notebook=6.1.5
12+
13+
14+
ADD projects/aries-fl/requirements.txt .
15+
16+
#
17+
# .
18+
RUN pip install -r requirements.txt
19+
20+
#RUN pip install aiohttp
21+
#RUN export PYTHONPATH="$PYTHONPATH:/aries_basic_controller"
22+
#ENV PYTHONPATH "${PYTHONPATH}:/aries_basic_controller"
23+
#RUN export JUPYTER_PATH="$JUPYTER_PATH:/aries_basic_controller"
24+
# Create jupyter notebook workspace
25+
#RUN mkdir $WORKSPACE
26+
WORKDIR $WORKSPACE
27+
28+
29+
# Make the image start the jupyer notebook
30+
COPY scripts/jupyter-entrypoint.sh /entrypoint.sh
31+
RUN chmod +x /entrypoint.sh
32+
33+
34+
35+
36+
37+
# ENTRYPOINT ["/entrypoint.sh", "$env_jupyter_port"]
38+
ENTRYPOINT ["/entrypoint.sh", "8888"]

projects/aries-fl/Dockerfile.ppmlcontroller

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ RUN pip install -r requirements.txt
2525
#RUN mkdir $WORKSPACE
2626
WORKDIR $WORKSPACE
2727

28+
2829
# Make the image start the jupyer notebook
2930
COPY scripts/jupyter-entrypoint.sh /entrypoint.sh
3031
RUN chmod +x /entrypoint.sh

projects/aries-fl/docker-compose.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ services:
176176
networks:
177177
- indy_demo
178178
volumes:
179-
- ./notebooks/hospital:/workspace
179+
- ./notebooks/hospital1:/workspace
180+
- ./hospital:/workspace/hospital
180181
ports:
181182
- "${HOSPITAL1_JUPYTER_PORT}:8888"
182183
- ${HOSPITAL1_WEBHOOK_PORT}:${HOSPITAL1_WEBHOOK_PORT}
@@ -221,7 +222,8 @@ services:
221222
networks:
222223
- indy_demo
223224
volumes:
224-
- ./notebooks/hospital:/workspace
225+
- ./notebooks/hospital2:/workspace
226+
- ./hospital:/workspace/hospital
225227
ports:
226228
- "${HOSPITAL2_JUPYTER_PORT}:8888"
227229
- ${HOSPITAL2_WEBHOOK_PORT}:${HOSPITAL2_WEBHOOK_PORT}
@@ -266,7 +268,8 @@ services:
266268
networks:
267269
- indy_demo
268270
volumes:
269-
- ./notebooks/hospital:/workspace
271+
- ./notebooks/hospital3:/workspace
272+
- ./hospital:/workspace/hospital
270273
ports:
271274
- "${HOSPITAL3_JUPYTER_PORT}:8888"
272275
- ${HOSPITAL3_WEBHOOK_PORT}:${HOSPITAL3_WEBHOOK_PORT}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from hospital.hospital import Hospital

projects/aries-fl/notebooks/hospital/hospital.py renamed to projects/aries-fl/hospital/hospital.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ def __init__(self, agent_config, data_location):
4545
def _register_agent_listeners(self):
4646

4747
loop = asyncio.get_event_loop()
48-
loop.create_task(self.agent_controller.listen_webhooks())
48+
loop.run_until_complete(self.agent_controller.listen_webhooks())
4949

5050
listeners = [{
51-
"handler": self._ml_messages_handler,
52-
"topic": "basicmessages"
53-
},
51+
"handler": self._ml_messages_handler,
52+
"topic": "basicmessages"
53+
},
5454
{
5555
"handler": self._connection_handler,
5656
"topic": "connections"
@@ -128,6 +128,7 @@ def _connection_handler(self, payload):
128128
response = loop.run_until_complete(self.agent_controller.proofs.send_request(proof_request_web_request))
129129
else:
130130
# No Auth Policy set
131+
print("No Auth Policy set")
131132
connection["is_trusted"].set_result(True)
132133
break
133134

@@ -288,7 +289,9 @@ def _process_data(self, file_path):
288289
for data in y_train.values:
289290
y_train_data.append([data])
290291
y_train_data = torch.tensor(y_train_data).float()
291-
292+
293+
print("Data Processed")
294+
292295
return {
293296
"x": x_train_data,
294297
"y": y_train_data
@@ -367,7 +370,7 @@ def establish_research_connection(self, invitation):
367370
}
368371

369372
self.pending_connections.append(pending_connection)
370-
373+
print("Establishing connection")
371374
loop.run_until_complete(pending_connection["is_trusted"])
372375

373376
if pending_connection["is_trusted"].result():

projects/aries-fl/manage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ configureEnvironment() {
174174
export HOSPITAL2_ADMIN_PORT=8061
175175
export HOSPITAL2_HTTP_PORT=8060
176176
export HOSPITAL2_WEBHOOK_PORT=8062
177-
export HOSPITAL2_WEBHOOK_URL=${HOSPITAL1_WEBHOOK_URL:-http://$DOCKERHOST:$HOSPITAL2_WEBHOOK_PORT}
178-
export HOSPITAL2_AGENT_ENDPOINT=${HOSPITAL1_AGENT_ENDPOINT:-http://$DOCKERHOST:$HOSPITAL2_HTTP_PORT}
177+
export HOSPITAL2_WEBHOOK_URL=${HOSPITAL2_WEBHOOK_URL:-http://$DOCKERHOST:$HOSPITAL2_WEBHOOK_PORT}
178+
export HOSPITAL2_AGENT_ENDPOINT=${HOSPITAL2_AGENT_ENDPOINT:-http://$DOCKERHOST:$HOSPITAL2_HTTP_PORT}
179179
export HOSPITAL2_WALLET_SEED="hospital2_seed_00000000000000000"
180180
export HOSPITAL2_JUPYTER_PORT="8892"
181181
export HOSPITAL2_WALLET_KEY="hospital2_key_00000000000000000000000"

projects/aries-fl/notebooks/hospital/Hospital2.ipynb

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)