fedbiomed.common.constants
Module:fedbiomed.common.constants
Fed-BioMed constants/enums
Classes
ComponentType
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
Attributes
DEFAULT class-attribute
DEFAULT = 'default'
FLAMBY class-attribute
FLAMBY = 'flamby'
IMAGES class-attribute
IMAGES = 'images'
MEDICAL_FOLDER class-attribute
MEDICAL_FOLDER = 'medical-folder'
MEDNIST class-attribute
MEDNIST = 'mednist'
NONE class-attribute
NONE = 'none'
TABULAR class-attribute
TABULAR = 'csv'
TEST class-attribute
TEST = 'test'
ErrorNumbers
Bases: _BaseEnum
List of all error messages types
Attributes
FB100 class-attribute
FB100 = 'FB100: undetermined messaging server error'
FB101 class-attribute
FB101 = 'FB101: cannot connect to the messaging server'
FB102 class-attribute
FB102 = "FB102: messaging server does not answer in dedicated time"
FB103 class-attribute
FB103 = 'FB103: messaging call error'
FB104 class-attribute
FB104 = 'FB104: message exchange error'
FB200 class-attribute
FB200 = 'FB200: undetermined repository server error'
FB201 class-attribute
FB201 = 'FB201: server not reachable'
FB202 class-attribute
FB202 = 'FB202: server returns 404 error'
FB203 class-attribute
FB203 = 'FB203: server returns other 4xx or 500 error'
FB300 class-attribute
FB300 = 'FB300: undetermined node error'
FB301 class-attribute
FB301 = 'FB301: Protocol error'
FB302 class-attribute
FB302 = 'FB302: TrainingPlan class does not load'
FB303 class-attribute
FB303 = "FB303: TrainingPlan class does not contain expected methods"
FB304 class-attribute
FB304 = 'FB304: TrainingPlan method crashes'
FB305 class-attribute
FB305 = 'FB305: TrainingPlan loops indefinitely'
FB306 class-attribute
FB306 = 'FB306: bad URL (.py) for TrainingPlan'
FB307 class-attribute
FB307 = 'FB307: bad URL (.pt) for training params'
FB308 class-attribute
FB308 = 'FB308: bad training request ().json'
FB309 class-attribute
FB309 = 'FB309: bad model params (.pt)'
FB310 class-attribute
FB310 = 'FB310: bad data format'
FB311 class-attribute
FB311 = "FB311: receiving a new computation request during a running computation"
FB312 class-attribute
FB312 = 'FB312: Node stopped in SIGTERM signal handler'
FB313 class-attribute
FB313 = 'FB313: no dataset matching request'
FB314 class-attribute
FB314 = 'FB314: Node round error'
FB315 class-attribute
FB315 = 'FB315: Error while loading the data '
FB316 class-attribute
FB316 = 'FB316: Data loading plan error'
FB317 class-attribute
FB317 = 'FB317: FLamby package import error'
FB318 class-attribute
FB318 = 'FB318: Secure aggregation setup error'
FB319 class-attribute
FB319 = 'FB319: Command not found error'
FB320 class-attribute
FB320 = 'FB320: bad model type'
FB321 class-attribute
FB321 = 'FB321: Secure aggregation delete error'
FB400 class-attribute
FB400 = 'FB400: undetermined application error'
FB401 class-attribute
FB401 = 'FB401: aggregation crashes or returns an error'
FB402 class-attribute
FB402 = 'FB402: strategy method crashes or sends an error'
FB403 class-attribute
FB403 = 'FB403: bad URL (.pt) for model param'
FB404 class-attribute
FB404 = (
"FB404: bad model param (.pt) format for TrainingPlan"
)
FB405 class-attribute
FB405 = "FB405: received delayed answer for previous computation round"
FB406 class-attribute
FB406 = "FB406: list of nodes is empty at data lookup phase"
FB407 class-attribute
FB407 = "FB407: list of nodes became empty when training (no node has answered)"
FB408 class-attribute
FB408 = 'FB408: node did not answer during training'
FB409 class-attribute
FB409 = 'FB409: node sent Status=Error during training'
FB410 class-attribute
FB410 = 'FB410: bad type or value for experiment argument'
FB411 class-attribute
FB411 = "FB411: cannot train an experiment that is not fully defined"
FB412 class-attribute
FB412 = 'FB412: cannot do model checking for experiment'
FB413 class-attribute
FB413 = (
"FB413: cannot save or load breakpoint for experiment"
)
FB414 class-attribute
FB414 = 'FB414: bad type or value for training arguments'
FB415 class-attribute
FB415 = 'FB415: secure aggregation handling error'
FB500 class-attribute
FB500 = "FB500: undetermined node error, detected by server"
FB501 class-attribute
FB501 = 'FB501: node not reachable'
FB600 class-attribute
FB600 = 'FB600: environ error'
FB601 class-attribute
FB601 = 'FB601: message error'
FB602 class-attribute
FB602 = 'FB602: logger error'
FB603 class-attribute
FB603 = 'FB603: task queue error'
FB604 class-attribute
FB604 = 'FB604: repository error'
FB605 class-attribute
FB605 = 'FB605: training plan error'
FB606 class-attribute
FB606 = 'FB606: model manager error'
FB607 class-attribute
FB607 = 'FB607: data manager error'
FB608 class-attribute
FB608 = 'FB608: torch data manager error'
FB609 class-attribute
FB609 = 'FB609: scikit-learn data manager error'
FB610 class-attribute
FB610 = 'FB610: Torch based tabular dataset creation error'
FB611 class-attribute
FB611 = "FB611: Error while trying to evaluate using the specified metric"
FB612 class-attribute
FB612 = 'FB612: Torch based NIFTI dataset error'
FB613 class-attribute
FB613 = 'FB613: Medical Folder dataset error'
FB614 class-attribute
FB614 = 'FB614: data loading block error'
FB615 class-attribute
FB615 = 'FB615: data loading plan error'
FB616 class-attribute
FB616 = 'FB616: differential privacy controller error'
FB617 class-attribute
FB617 = 'FB617: FLamby dataset error'
FB618 class-attribute
FB618 = 'FB618: FLamby data transformation error'
FB999 class-attribute
FB999 = 'FB999: unknown error code sent by the node'
HashingAlgorithms
Bases: _BaseEnum
Enumeration class, used to characterize the hashing algorithms
Attributes
BLAKE2B class-attribute
BLAKE2B = 'BLAKE2B'
BLAKE2S class-attribute
BLAKE2S = 'BLAKE2S'
SHA256 class-attribute
SHA256 = 'SHA256'
SHA384 class-attribute
SHA384 = 'SHA384'
SHA3_256 class-attribute
SHA3_256 = 'SHA3_256'
SHA3_384 class-attribute
SHA3_384 = 'SHA3_384'
SHA3_512 class-attribute
SHA3_512 = 'SHA3_512'
SHA512 class-attribute
SHA512 = 'SHA512'
ProcessTypes
Bases: _BaseEnum
Enumeration class for Preprocess types
Attributes:
Name | Type | Description |
---|---|---|
DATA_LOADER | Preprocess for DataLoader | |
PARAMS | Preprocess for model parameters |
Attributes
DATA_LOADER class-attribute
DATA_LOADER = 0
PARAMS class-attribute
PARAMS = 1
SecaggElementTypes
Bases: _BaseEnum
Enumeration class for secure aggregation element types
Attributes:
Name | Type | Description |
---|---|---|
SERVER_KEY | int | server key split between the parties |
BIPRIME | int | biprime shared between the parties |
Attributes
BIPRIME class-attribute
BIPRIME: int = 1
SERVER_KEY class-attribute
SERVER_KEY: int = 0
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 |
Attributes
APPROVED class-attribute
APPROVED = 'Approved'
PENDING class-attribute
PENDING = 'Pending'
REJECTED class-attribute
REJECTED = 'Rejected'
Functions
str2enum(name)
str2enum(name)
Source code in fedbiomed/common/constants.py
def str2enum(name: str):
for e in TrainingPlanApprovalStatus:
if e.value == name:
return e
return None
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 |
Attributes
DEFAULT class-attribute
DEFAULT = 'default'
REGISTERED class-attribute
REGISTERED = 'registered'
REQUESTED class-attribute
REQUESTED = 'requested'
TrainingPlans
Bases: _BaseEnum
Enumeration class for Training plans
Attributes
SkLearnTrainingPlan class-attribute
SkLearnTrainingPlan = 'SkLearnTrainingPlan'
TorchTrainingPlan class-attribute
TorchTrainingPlan = 'TorchTrainingPlan'
UserRequestStatus
Bases: str
, _BaseEnum
Enumeration class, used to characterize the status for user registration requests
Attributes:
Name | Type | Description |
---|---|---|
NEW | New user registration | |
REJECTED | Rejected status |
Attributes
NEW class-attribute
NEW = 'NEW'
REJECTED class-attribute
REJECTED = 'REJECTED'
UserRoleType
Bases: int
, _BaseEnum
Enumeration class, used to characterize the type of component of the fedbiomed architecture
Attributes:
Name | Type | Description |
---|---|---|
ADMIN | User with Admin role | |
USER | Simple user |
Attributes
ADMIN class-attribute
ADMIN = 1
USER class-attribute
USER = 2