Fed-BioMed constants/enums
Attributes¶
CACHE_FOLDER_NAME module-attribute ¶
CACHE_FOLDER_NAME = 'cache'
Directory/folder name where cache files are saved
CERTS_FOLDER_NAME module-attribute ¶
CERTS_FOLDER_NAME = join(CONFIG_FOLDER_NAME, 'certs')
FOLDER name for Certs directory
CONFIG_FOLDER_NAME module-attribute ¶
CONFIG_FOLDER_NAME = 'etc'
Directory/folder name where configurations are saved
DB_FOLDER_NAME module-attribute ¶
DB_FOLDER_NAME = VAR_FOLDER_NAME
Directory/folder name where DB files are saved
DEFAULT_NODE_ALIAS module-attribute ¶
DEFAULT_NODE_ALIAS = 'Default Node Alias'
Default node alias used for identification
DEFAULT_NODE_NAME module-attribute ¶
DEFAULT_NODE_NAME = 'fbm-node'
Default node component folder name
DEFAULT_RESEARCHER_NAME module-attribute ¶
DEFAULT_RESEARCHER_NAME = 'fbm-researcher'
Default researcher component folder name
DOCS_FOLDER_NAME module-attribute ¶
DOCS_FOLDER_NAME = 'docs'
Directory/folder name used by default for documentation
MAX_MESSAGE_BYTES_LENGTH module-attribute ¶
MAX_MESSAGE_BYTES_LENGTH = 4000000 - getsizeof(bytes('', encoding='UTF-8'))
NODE_DATA_FOLDER module-attribute ¶
NODE_DATA_FOLDER = 'data'
Directory/folder name used by Nodes to save their specific dataset
NOTEBOOKS_FOLDER_NAME module-attribute ¶
NOTEBOOKS_FOLDER_NAME = 'notebooks'
Directory/folder name used by default for notebooks
TENSORBOARD_FOLDER_NAME module-attribute ¶
TENSORBOARD_FOLDER_NAME = 'runs'
Directory/folder name where tensorboard logs are saved
TMP_FOLDER_NAME module-attribute ¶
TMP_FOLDER_NAME = 'tmp'
Directory/folder name where temporary files are saved
TUTORIALS_FOLDER_NAME module-attribute ¶
TUTORIALS_FOLDER_NAME = 'tutorials'
Directory/folder name used by default for tutorials
VAR_FOLDER_NAME module-attribute ¶
VAR_FOLDER_NAME = 'var'
Directory/folder name where variable files are saved
Classes¶
ComponentType ¶
Bases: _BaseEnum
Enumeration class, used to characterize the type of component of the fedbiomed architecture
Attributes:
| Name | Type | Description |
|---|---|---|
RESEARCHER | Researcher component | |
NODE | Node component |
DataLoadingBlockTypes ¶
DataLoadingBlockTypes(*args)
Bases: _BaseEnum
Base class for typing purposes.
Concrete enumeration types should be defined within the scope of their implementation or application. To define a concrete enumeration type, one must subclass this class as follows:
class MyLoadingBlockTypes(DataLoadingBlockTypes, Enum):
MY_KEY: str 'myKey'
MY_OTHER_KEY: str 'myOtherKey'
Subclasses must respect the following conditions: - All fields must be str; - All field values must be unique.
Warning
This class must always be empty as it is not allowed to contain any fields!
Source code in fedbiomed/common/constants.py
def __init__(self, *args):
cls = self.__class__
if not isinstance(self.value, str):
raise ValueError(
"all fields of DataLoadingBlockTypes subclasses must be of str type"
)
if any(self.value == e.value for e in cls):
a = self.name
e = cls(self.value).name
raise ValueError(
f"duplicate values not allowed in DataLoadingBlockTypes and "
f"its subclasses: {a} --> {e}"
)
DatasetTypes ¶
Bases: _BaseEnum
Types of Datasets implemented in Fed-BioMed
ErrorNumbers ¶
Bases: _BaseEnum
List of all error messages types
Attributes¶
FB303 class-attribute instance-attribute ¶
FB303 = 'FB303: TrainingPlan class does not contain expected methods'
FB324 class-attribute instance-attribute ¶
FB324 = 'FB324: Node to node overlay communication error'
FB402 class-attribute instance-attribute ¶
FB402 = 'FB402: strategy method crashes or sends an error'
FB407 class-attribute instance-attribute ¶
FB407 = 'FB407: list of nodes became empty when training (all nodes failed training or did not answer)'
FB408 class-attribute instance-attribute ¶
FB408 = 'FB408: training failed on node or node did not answer during training'
FB410 class-attribute instance-attribute ¶
FB410 = 'FB410: bad type or value for experiment argument'
FB411 class-attribute instance-attribute ¶
FB411 = 'FB411: cannot train an experiment that is not fully defined'
FB413 class-attribute instance-attribute ¶
FB413 = 'FB413: cannot save or load breakpoint for experiment'
FB414 class-attribute instance-attribute ¶
FB414 = 'FB414: bad type or value for training arguments'
FB610 class-attribute instance-attribute ¶
FB610 = 'FB610: Torch based tabular dataset creation error'
FB611 class-attribute instance-attribute ¶
FB611 = 'FB611: Error while trying to evaluate using the specified metric'
HarmonizationStep ¶
HashingAlgorithms ¶
MessageType ¶
Bases: _BaseEnum
Types of messages received by researcher
Attributes:
| Name | Type | Description |
|---|---|---|
REPLY | reply messages (TrainReply, SearchReply, etc.) | |
LOG | 'log' message (LogMessage) | |
SCALAR | 'add_scalar' message (Scalar) |
Attributes¶
Functions¶
convert classmethod ¶
convert(type_)
Converts given text message to to MessageType instance
Source code in fedbiomed/common/constants.py
@classmethod
def convert(cls, type_):
"""Converts given text message to to MessageType instance"""
try:
return getattr(cls, type_.upper())
except AttributeError as exp:
raise FedbiomedError(f"There is no MessageType as {type_}") from exp
PreprocStep ¶
Bases: _BaseEnum
Abstract base enumeration class for dataset preprocessing steps
PreprocType ¶
ProcessTypes ¶
Bases: _BaseEnum
Enumeration class for Preprocess types
Attributes:
| Name | Type | Description |
|---|---|---|
DATA_LOADER | Preprocess for DataLoader | |
PARAMS | Preprocess for model parameters |
SAParameters ¶
SecaggElementTypes ¶
Bases: _BaseEnum
Enumeration class for secure aggregation element types
Attributes:
| Name | Type | Description |
|---|---|---|
SERVER_KEY | server key split between the parties | |
DIFFIE_HELLMAN | one pair of DH key for each node party, public key shared with other node parties |
SecureAggregationSchemes ¶
Stats ¶
TrainingPlanApprovalStatus ¶
Bases: _BaseEnum
Enumeration class for training plan approval status of a training plan on a node when training plan approval is active.
Attributes:
| Name | Type | Description |
|---|---|---|
APPROVED | training plan was accepted for this node, can be executed now | |
REJECTED | training plan was disapproved for this node, cannot be executed | |
PENDING | training plan is waiting for review and approval, cannot be executed yet |
TrainingPlanStatus ¶
Bases: _BaseEnum
Constant values for training plan type that will be saved into db
Attributes:
| Name | Type | Description |
|---|---|---|
REQUESTED | means training plan submitted in-application by the researcher | |
REGISTERED | means training plan added by a hospital/node | |
DEFAULT | means training plan is default training plan provided by Fed-BioMed |
TrainingPlans ¶
Bases: _BaseEnum
Enumeration class for Training plans