Federated Learning with Nats
SymetryML can use NATS (www.nats.io) as a backend queueing system to power a federation. The REST calls to create / join a federation
Create Nats Backed Federation
URL
This REST endpoint allows the user to create a new federation. The user who creates the federation also becomes its administrator. The body is a map that is encoded to a JSON string and then encrypted using the user secret key.
Federation Key Map Value
Key
Required / Optional
Value Description
fed_name
Required
The name of the federation.
fed_local_type
Optional
The type of project to use. Supported values: cpu
and gpu
. The default value is cpu
.
sync_sched
Required
nats_hosts
Required
Urls of hosts
fed_encrypt
Optional
Whether to encrypt or not the sync message. The default is false.
nats_sec_user
Optional
nats_sec_passwd
Optional
nats_sec_token
Optional
nats_sec_nkey_seed
Optional
When using nats NKEY authentication, this allows to specify the seed of the NKEY used. This is set by the federation administrator and will be shared with other peers when they join the federation.
nats_req_timeout
Optional
NATS request timeout in seconds, default is 30.
nats_stream_max_memory
Optional
NATS maximum memory used by underlying stream managing project sharing with other peers. The default is (1Gig, 1024 x 1024 x 1024 bytes).
Query Parameters
Parameter
Required / Optional
Description
pid
Required
Name of the new SymetryML project.
persist
Optional
Whether to persist or not the project
HTTP Responses
HTTP Status Code
HTTP Status Message
Description
201
CREATED
Success. {"statusCode":"CREATED","statusString":" + SYMETRYML Created with id:r1","values":{}}
409
CONFLICT
SymetryML project already exists. {"statusCode":"CONFLICT","statusString":" + Customer [c1] already have SYMETRYML with id[r1], ","values":{}}
HTTP Response Entity
None
Sample Request/Response Fed Create
Federated Learning Get Encrypted Federation Info
URL
Get Encrypted Body Key Map Value.
TDB new ResponseEntityKey.
Mandatory key
Required / Optional
Value Description
passwd
Required
Password to use to encrypt the federation information
fed_rest_host
Required
Hostname where admin can be reach at.
HTTP Responses
HTTP Status Code
HTTP Status Message
Description
200
OK
Success.
400
BAD REQUEST
SymetryML project does not exist. {"statusCode":"BAD_REQUEST","statusString":"Cannot Find SYMETRYML id[r5] for Customer id [c1]","values":{}
HTTP Response Entity
sync_sched
fed_name
fed_secret_key
nats_hosts
fed_req_token
Sample Request/Response
Decrypted Message Example:
Join a Nats Backed Federation
URL
This REST endpoint allows the user to join an existing federation. The body is a map that is encoded to a JSON string and then encrypted using the user secret key. This encryption is necessary in order to protect sensitive information like aws access key and aws secret key that are required to be passed as part of the body.
Federation Join Request Body
The request body is composed of 2 types of key/value pairs:
Those that relates to the new node to be created.
Mandatory Key / Value Pairs from Federation Admin
The following key value will be received as part of the password encrypted json message from the federation admin. They need to be added the the query body without modification.
Key
Mandatory / Optional
Description
sync_sched
Mandatory
fed_secret_key
Mandatory
The secret key used to encrypt info exchanged between nodes in a federation.
fed_name
Mandatory
The federation id.
fed_req_token
Mandatory
The token used to verify that a join request has not expired.
nats_hosts
Mandatory
The URL of the NATS service.
nats_sec_user
Optional
The user for NATS user/password communication security. Note: this is mandatory if nats_sec_token is not used.
nats_sec_passwd
Optional
The password for NATS user/password communication security. Note: this is mandatory if nats_sec_token is not used.
nats_sec_token
Optional
The token for NATS token communication security. Note: this is mandatory if nats_sec_user and nats_sec_passwd are not used.
Request Body Key / Value Pairs
Additional key / value pairs are needed in the request body
Mandatory key
Required / Optional
Value Description
fed_local_type
Optional
The type of project to use. Supported values: cpu
and gpu
. The default value is cpu
.
Query Parameters
Parameter
Required / Optional
Description
persist
Optional
Whether or not to persist the project. Defaults to true.
pid
Optional
Project name
HTTP Responses
HTTP Status Code
HTTP Status Message
Description
201
CREATED
Success. {"statusCode":"CREATED","statusString":" + Fed Project created with join","values":{}}
409
CONFLICT
SymetryML project already exists. {"statusCode":"CONFLICT","statusString":" + Customer [c1] already have SYMETRYML with id[r1], ","values":{}}
HTTP Response Entity
None
Sample Request/Response Fed Create Join
Last updated