From 67f0a9248c324c9ecc1f8bb27ae06c0a98d9d928 Mon Sep 17 00:00:00 2001 From: ChenLong Ma Date: Tue, 29 Jun 2021 16:46:22 +0800 Subject: [PATCH 1/4] feat: FATE chart support polling Signed-off-by: ChenLong Ma --- .../FATE/templates/eggroll-config.yaml | 13 +++++++ .../FATE/templates/rollsite-module.yaml | 34 +++++++++++++++++-- helm-charts/FATE/values-template-example.yaml | 12 ++++++- helm-charts/FATE/values-template.yaml | 15 ++++++++ helm-charts/FATE/values.yaml | 14 ++++++++ 5 files changed, 84 insertions(+), 4 deletions(-) diff --git a/helm-charts/FATE/templates/eggroll-config.yaml b/helm-charts/FATE/templates/eggroll-config.yaml index 05f0875e9..7b454d6e1 100644 --- a/helm-charts/FATE/templates/eggroll-config.yaml +++ b/helm-charts/FATE/templates/eggroll-config.yaml @@ -82,3 +82,16 @@ data: eggroll.rollsite.push.long.retry=2 eggroll.rollsite.push.batches.per.stream=10 eggroll.rollsite.adapter.sendbuf.size=100000 + + # polling + # {{ .Values.modules.rollsite.polling.enabled }} + # {{ .Values.modules.rollsite.polling.type }} + # + {{- if and .Values.modules.rollsite.polling.enabled ( eq .Values.modules.rollsite.polling.type "client" ) }} + eggroll.rollsite.polling.client.enabled=true + {{- end }} + + {{- if and .Values.modules.rollsite.polling.enabled ( eq .Values.modules.rollsite.polling.type "server" ) }} + eggroll.rollsite.polling.server.enabled=true + eggroll.rollsite.polling.concurrency= {{ .Values.modules.rollsite.polling.concurrency | default 50 }} + {{- end }} diff --git a/helm-charts/FATE/templates/rollsite-module.yaml b/helm-charts/FATE/templates/rollsite-module.yaml index 9fdfe7a7b..55b786736 100644 --- a/helm-charts/FATE/templates/rollsite-module.yaml +++ b/helm-charts/FATE/templates/rollsite-module.yaml @@ -24,12 +24,23 @@ data: "default": { "default": [ { - {{- with .Values.exchange }} - "ip": "{{ .partyIp }}", - "port": {{ .partyPort }} + {{- if .Values.exchange }} + "ip": "{{ .Values.exchange.partyIp }}", + "port": {{ .Values.exchange.partyPort }} {{- else }} + + {{- if and .Values.modules.rollsite.polling.enabled ( eq .Values.modules.rollsite.polling.type "client" ) }} + + {{- with .Values.modules.rollsite.polling.server }} + "ip": "{{ .ip }}", + "port": {{ .port }} + {{- end }} + + {{- else }} "ip": "rollsite", "port": 9370 + {{- end }} + {{- end }} } ] @@ -43,6 +54,23 @@ data: } ] }, + {{- end }} + + {{- if and .Values.modules.rollsite.polling.enabled ( eq .Values.modules.rollsite.polling.type "server" ) }} + + {{- range .Values.modules.rollsite.polling.clientList}} + "{{ .partID }}": + { + "default": [ + { + "port": -1, + "ip": "", + "is_polling": true + } + ] + }, + {{- end }} + {{- end }} "{{ .Values.partyId }}": { "fateflow": [ diff --git a/helm-charts/FATE/values-template-example.yaml b/helm-charts/FATE/values-template-example.yaml index 2128bdd4d..df062f8b8 100644 --- a/helm-charts/FATE/values-template-example.yaml +++ b/helm-charts/FATE/values-template-example.yaml @@ -36,7 +36,7 @@ backend: eggroll # rabbitmqUI: 9999.rabbitmq.kubefate.net # pulsarUI: 9999.pulsar.kubefate.net -# rollsite: +rollsite: # type: NodePort # nodePort: 30091 # exchange: @@ -54,6 +54,16 @@ backend: eggroll # value: "value" # effect: "NoSchedule" # affinity: + polling: + enabled: true + type: server + # server: + # ip: 192.168.100.1 + # port: 9370 + clientList: + - partID: 9999 + concurrency: 49 + # lbrollsite: # type: NodePort diff --git a/helm-charts/FATE/values-template.yaml b/helm-charts/FATE/values-template.yaml index 36ce9edaf..cad013a26 100644 --- a/helm-charts/FATE/values-template.yaml +++ b/helm-charts/FATE/values-template.yaml @@ -87,6 +87,21 @@ modules: affinity: {{ toYaml . | indent 6 }} {{- end }} + {{- with .polling }} + polling: + enabled: {{ .enabled }} + type: {{ .type }} + {{- with .server }} + server: + ip: {{ .ip }} + port: {{ .port }} + {{- end }} + {{- with .clientList }} + clientList: +{{ toYaml . | indent 6 }} + {{- end }} + concurrency: {{ .concurrency }} + {{- end }} {{- end }} diff --git a/helm-charts/FATE/values.yaml b/helm-charts/FATE/values.yaml index b25f4ead1..d86bc2594 100644 --- a/helm-charts/FATE/values.yaml +++ b/helm-charts/FATE/values.yaml @@ -51,6 +51,15 @@ modules: nodeSelector: tolerations: affinity: + polling: + enabled: false + type: client + server: + ip: 192.168.9.1 + port: 9370 + # clientList: + # - partID: 9999 + # concurrency: 50 lbrollsite: include: true ip: rollsite @@ -147,6 +156,11 @@ modules: nodeSelector: tolerations: affinity: + subPath: "client" + existingClaim: "" + storageClass: "client" + accessMode: ReadWriteOnce + size: 1Gi mysql: include: true type: ClusterIP From 19ed33e219475820d7fc0250be0b54d1b115ef93 Mon Sep 17 00:00:00 2001 From: ChenLong Ma Date: Thu, 8 Jul 2021 15:45:36 +0800 Subject: [PATCH 2/4] add doc of polling Signed-off-by: ChenLong Ma --- docs/Use_polling.md | 50 +++++++++++++++++++ .../FATE_cluster_configuration.md | 30 ++++++----- helm-charts/FATE/values-template-example.yaml | 30 +++++------ 3 files changed, 83 insertions(+), 27 deletions(-) create mode 100644 docs/Use_polling.md diff --git a/docs/Use_polling.md b/docs/Use_polling.md new file mode 100644 index 000000000..372727e08 --- /dev/null +++ b/docs/Use_polling.md @@ -0,0 +1,50 @@ +# How to use KubeFATE to configure FATE polling + +FATE's polling is divided into server side and client side. + +**what's polling?** + +In Federated Learning scenario, a party (or site) will send and receive data from / to other parties (or sites). + +Normally, *Two-Way mode is recommended*. In this mode, a party (site) needs to listen to a public port and provide it to exchange or other direct connected parties (sites). + +In some specific cases where a party (or site) is not allowed or not willing to provide a public port, Polling mode can be used. In Polling mode, the pattern of sending data is the same as Two-Way mode. But when receiving data, this specific party (or site) will be acting as a polling client actively polls (i.e. fetches) data from the nearest RollSite. + +## server + +If you want to be the server side of polling, you can configure it like this: + +```bash +# cluster.yaml + +... +rollsite: + ... + polling: + enabled: true + type: server + clientList: # polling client list + - partID: 9999 + - partID: 10000 + concurrency: 60 +``` + + + +## client + +If you want to be the client side of polling, you can configure it like this: + +```bash +# cluster.yaml + +... +rollsite: + ... + polling: + enabled: true + type: server + server: + ip: 192.168.100.1 # polling server ip + port: 9370 # polling server port +``` \ No newline at end of file diff --git a/docs/configurations/FATE_cluster_configuration.md b/docs/configurations/FATE_cluster_configuration.md index 096ad57d5..78e49586b 100644 --- a/docs/configurations/FATE_cluster_configuration.md +++ b/docs/configurations/FATE_cluster_configuration.md @@ -65,18 +65,24 @@ ### rollsite mappings It is used to declare the `rollsite ` module in the FATE cluster to be deployed. -| Name | subitem | Type | Description | -| ------------ | --------- | --------- | ------------------------------------------------------------ | -| type | | scalars | Kubernetes ServiceTypes, default is NodePort. | -| nodePort | | scalars | The port used by `proxy` module's kubernetes service, default range: 30000-32767. | -| partyList | | sequences | If this FATE cluster is exchange cluster, partyList is all party's sequences of all parties proxy address. If this FATE cluster is one of participants, delete this configuration item. | -| partyList | partyId | scalars | Participant FATE cluster party ID. | -| partyList | partyIp | scalars | Participant FATE cluster IP. | -| partyList | partyPort | scalars | Participant FATE cluster port. | -| exchange | | mappings | FATE cluster `exchange` module's ip and port. | -| exchange | ip | mappings | FATE cluster `exchange` module's ip. . | -| exchange | port | mappings | FATE cluster `exchange` module's port. | -| nodeSelector | | mappings | kubernetes nodeSelector. | +| Name | subitem | Type | Description | +| ------------ | ----------- | --------- | ------------------------------------------------------------ | +| type | | scalars | Kubernetes ServiceTypes, default is NodePort. | +| nodePort | | scalars | The port used by `proxy` module's kubernetes service, default range: 30000-32767. | +| partyList | | sequences | If this FATE cluster is exchange cluster, partyList is all party's sequences of all parties proxy address. If this FATE cluster is one of participants, delete this configuration item. | +| partyList | partyId | scalars | Participant FATE cluster party ID. | +| partyList | partyIp | scalars | Participant FATE cluster IP. | +| partyList | partyPort | scalars | Participant FATE cluster port. | +| exchange | | mappings | FATE cluster `exchange` module's ip and port. | +| exchange | ip | mappings | FATE cluster `exchange` module's ip. . | +| exchange | port | mappings | FATE cluster `exchange` module's port. | +| nodeSelector | | mappings | kubernetes nodeSelector. | +| polling | | | rollsite support polling | +| polling | enabled | | enable polling | +| polling | type | | polling type (server/client) | +| polling | server | | if type choose client, you need a polling server. | +| polling | clientList | | if type choose server, this rollsite serve for clientList. | +| polling | concurrency | | if type choose server, polling client concurrency. | FATE cluster has two deployment modes: with exchange and without exchange. #### Exchange mode: diff --git a/helm-charts/FATE/values-template-example.yaml b/helm-charts/FATE/values-template-example.yaml index df062f8b8..76471a11f 100644 --- a/helm-charts/FATE/values-template-example.yaml +++ b/helm-charts/FATE/values-template-example.yaml @@ -36,7 +36,7 @@ backend: eggroll # rabbitmqUI: 9999.rabbitmq.kubefate.net # pulsarUI: 9999.pulsar.kubefate.net -rollsite: +# rollsite: # type: NodePort # nodePort: 30091 # exchange: @@ -54,15 +54,15 @@ rollsite: # value: "value" # effect: "NoSchedule" # affinity: - polling: - enabled: true - type: server - # server: - # ip: 192.168.100.1 - # port: 9370 - clientList: - - partID: 9999 - concurrency: 49 + # polling: + # enabled: true + # type: server + # # server: + # # ip: 192.168.100.1 + # # port: 9370 + # clientList: + # - partID: 9999 + # concurrency: 49 # lbrollsite: @@ -179,11 +179,11 @@ rollsite: # size: 1Gi -externalMysqlIp: mysql1 -externalMysqlPort: 33060 -externalMysqlDatabase: eggroll_meta1 -externalMysqlUser: fate1 -externalMysqlPassword: fate_dev1 +# externalMysqlIp: mysql1 +# externalMysqlPort: 33060 +# externalMysqlDatabase: eggroll_meta1 +# externalMysqlUser: fate1 +# externalMysqlPassword: fate_dev1 # servingIp: 192.168.0.1 From d54c52b1154ee5fd315ea3743df6c41ec9719b88 Mon Sep 17 00:00:00 2001 From: ChenLong Ma Date: Tue, 13 Jul 2021 15:14:53 +0800 Subject: [PATCH 3/4] update values.yaml Signed-off-by: ChenLong Ma --- helm-charts/FATE/values.yaml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/helm-charts/FATE/values.yaml b/helm-charts/FATE/values.yaml index d86bc2594..7641051b0 100644 --- a/helm-charts/FATE/values.yaml +++ b/helm-charts/FATE/values.yaml @@ -53,13 +53,17 @@ modules: affinity: polling: enabled: false - type: client - server: - ip: 192.168.9.1 - port: 9370 - # clientList: - # - partID: 9999 - # concurrency: 50 + + # type: client + # server: + # ip: 192.168.9.1 + # port: 9370 + + # type: server + # clientList: + # - partID: 9999 + # concurrency: 50 + lbrollsite: include: true ip: rollsite From 3c562ab5980fcbab43f268600fe0eece8ef2692a Mon Sep 17 00:00:00 2001 From: ChenLong Ma Date: Tue, 20 Jul 2021 14:04:16 +0800 Subject: [PATCH 4/4] fix helm lint of workflow Signed-off-by: ChenLong Ma --- helm-charts/FATE/templates/eggroll-config.yaml | 4 ++-- helm-charts/FATE/templates/python-spark.yaml | 4 ++-- helm-charts/FATE/templates/rollsite-module.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/helm-charts/FATE/templates/eggroll-config.yaml b/helm-charts/FATE/templates/eggroll-config.yaml index 7b454d6e1..39a9cb005 100644 --- a/helm-charts/FATE/templates/eggroll-config.yaml +++ b/helm-charts/FATE/templates/eggroll-config.yaml @@ -87,11 +87,11 @@ data: # {{ .Values.modules.rollsite.polling.enabled }} # {{ .Values.modules.rollsite.polling.type }} # - {{- if and .Values.modules.rollsite.polling.enabled ( eq .Values.modules.rollsite.polling.type "client" ) }} + {{- if and .Values.modules.rollsite.polling.enabled ( eq (print .Values.modules.rollsite.polling.type) "client" ) }} eggroll.rollsite.polling.client.enabled=true {{- end }} - {{- if and .Values.modules.rollsite.polling.enabled ( eq .Values.modules.rollsite.polling.type "server" ) }} + {{- if and .Values.modules.rollsite.polling.enabled ( eq (print .Values.modules.rollsite.polling.type) "server" ) }} eggroll.rollsite.polling.server.enabled=true eggroll.rollsite.polling.concurrency= {{ .Values.modules.rollsite.polling.concurrency | default 50 }} {{- end }} diff --git a/helm-charts/FATE/templates/python-spark.yaml b/helm-charts/FATE/templates/python-spark.yaml index 3546760ef..ce823c79c 100644 --- a/helm-charts/FATE/templates/python-spark.yaml +++ b/helm-charts/FATE/templates/python-spark.yaml @@ -351,9 +351,9 @@ spec: {{- end }} {{- if .Values.modules.python.serviceAccountName }} serviceAccountName: {{ .Values.modules.python.serviceAccountName }} -{{- else -}} +{{- else }} serviceAccountName: {{ template "serviceAccountName" . }} -{{- end -}} +{{- end }} restartPolicy: Always volumes: - name: eggroll-confs diff --git a/helm-charts/FATE/templates/rollsite-module.yaml b/helm-charts/FATE/templates/rollsite-module.yaml index 55b786736..3cd7154a3 100644 --- a/helm-charts/FATE/templates/rollsite-module.yaml +++ b/helm-charts/FATE/templates/rollsite-module.yaml @@ -29,7 +29,7 @@ data: "port": {{ .Values.exchange.partyPort }} {{- else }} - {{- if and .Values.modules.rollsite.polling.enabled ( eq .Values.modules.rollsite.polling.type "client" ) }} + {{- if and .Values.modules.rollsite.polling.enabled ( eq (print .Values.modules.rollsite.polling.type) "client" ) }} {{- with .Values.modules.rollsite.polling.server }} "ip": "{{ .ip }}", @@ -56,7 +56,7 @@ data: }, {{- end }} - {{- if and .Values.modules.rollsite.polling.enabled ( eq .Values.modules.rollsite.polling.type "server" ) }} + {{- if and .Values.modules.rollsite.polling.enabled ( eq (print .Values.modules.rollsite.polling.type) "server" ) }} {{- range .Values.modules.rollsite.polling.clientList}} "{{ .partID }}":