Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Qing Wang <kingchin1218@gmail.com>
  • Loading branch information
jovany-wang committed Jul 27, 2023
1 parent 270546d commit f75c812
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
15 changes: 15 additions & 0 deletions fed/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2023 The RayFed Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


"""This module should be cached locally due to all configurations
Expand Down Expand Up @@ -115,6 +128,8 @@ class CrossSiloMessageConfig:
# (Optional) The address this party is going to listen on.
# If not provided, the `address` will be used.
listening_address: str = None
external_config: dict = None


def __json__(self):
return json.dumps(self.__dict__)
Expand Down
44 changes: 44 additions & 0 deletions fed/extenal/grpc_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@



"""This module should be cached locally due to all configurations
are mutable.
"""

import fed._private.compatible_utils as compatible_utils
import fed._private.constants as fed_constants
import cloudpickle
import json

from typing import Dict, List, Optional
from dataclasses import dataclass


@dataclass
class GrpcCrossSiloMessageConfig:
"""A class to store parameters used for GRPC communication
Attributes:
grpc_retry_policy: a dict descibes the retry policy for
cross silo rpc call. If None, the following default retry policy
will be used. More details please refer to
`retry-policy <https://github.com/grpc/proposal/blob/master/A6-client-retries.md#retry-policy>`_. # noqa
.. code:: python
{
"maxAttempts": 4,
"initialBackoff": "0.1s",
"maxBackoff": "1s",
"backoffMultiplier": 2,
"retryableStatusCodes": [
"UNAVAILABLE"
]
}
grpc_channel_options: A list of tuples to store GRPC channel options,
e.g. [
('grpc.enable_retries', 1),
('grpc.max_send_message_length', 50 * 1024 * 1024)
]
"""
grpc_channel_options: List = None
grpc_retry_policy: Dict[str, str] = None

0 comments on commit f75c812

Please sign in to comment.