flip.constants.flip_constants
FLIP Constants and Configuration.
- This module provides:
Environment-aware settings (DevSettings, ProdSettings)
Enumerations for resource types, model statuses, tasks, and events
Attributes
Classes
Base settings shared by both development and production environments. |
|
Development environment configuration. |
|
Production environment configuration. |
|
Proxy to provide lazy loading via attribute access. |
|
Types of imaging resources available in XNAT. |
|
Task names used in FLIP workflows. |
|
Event names used in FLIP workflows. |
|
fl_ctx property names FLIP components use to share round telemetry. |
|
Model job status values. |
|
Standard metric labels for FLIP metrics reporting. |
|
Metadata keys FLIP components attach to DXO meta. |
Functions
|
Get FlipConstants singleton instance. |
Module Contents
- class flip.constants.flip_constants._Common
Bases:
pydantic_settings.BaseSettingsBase settings shared by both development and production environments.
- LOCAL_DEV: bool = True
- MIN_CLIENTS: pydantic.PositiveInt = 1
- class flip.constants.flip_constants.DevSettings
Bases:
_CommonDevelopment environment configuration.
Used when LOCAL_DEV=true. Requires local paths for test data.
- LOCAL_DEV: bool = True
- DEV_DATAFRAME: str = ''
- DEV_IMAGES_DIR: str = ''
- class flip.constants.flip_constants.ProdSettings
Bases:
_CommonProduction environment configuration.
Used when LOCAL_DEV=false. Settings are grouped by which FL role uses them: - Server-only (fl-server on Central Hub): FLIP_API_INTERNAL_URL, INTERNAL_SERVICE_KEY* - Client-only (fl-client on trust side): DATA_ACCESS_API_URL, IMAGING_API_URL,
TRUST_INTERNAL_SERVICE_KEY*
Shared: IMAGES_DIR, NET_ID, UPLOADED_FEDERATED_DATA_BUCKET
- LOCAL_DEV: bool = False
- FLIP_API_INTERNAL_URL: pydantic.HttpUrl = 'http://localhost:8000'
- INTERNAL_SERVICE_KEY_HEADER: str = 'X-Internal-Service-Key'
- INTERNAL_SERVICE_KEY: str = ''
- SERVER_CHECKPOINT_ROOT: str = '/app/server-checkpoints'
- DATA_ACCESS_API_URL: pydantic.HttpUrl = 'http://localhost:8001'
- IMAGING_API_URL: pydantic.HttpUrl = 'http://localhost:8002'
- TRUST_INTERNAL_SERVICE_KEY_HEADER: str = 'X-Trust-Internal-Service-Key'
- TRUST_INTERNAL_SERVICE_KEY: str = ''
- IMAGES_DIR: str = ''
- NET_ID: str = 'default'
- UPLOADED_FEDERATED_DATA_BUCKET: str = 's3://default-bucket'
- classmethod _validate_s3_url(v: str) str
- flip.constants.flip_constants._flip_constants_instance: DevSettings | ProdSettings | None = None
- flip.constants.flip_constants.get_flip_constants() DevSettings | ProdSettings
Get FlipConstants singleton instance.
Lazy initialization ensures environment variables are only required when the instance is actually used, not at import time.
- class flip.constants.flip_constants._FlipConstantsProxy
Proxy to provide lazy loading via attribute access.
- __getattribute__(name: str) object
- flip.constants.flip_constants.FlipConstants
- class flip.constants.flip_constants.ResourceType
Bases:
enum.StrEnumTypes of imaging resources available in XNAT.
- DICOM = 'DICOM'
- NIFTI = 'NIFTI'
- SEGMENTATION = 'SEG'
- ALL = 'ALL'
- class flip.constants.flip_constants.FlipTasks
Bases:
enum.StrEnumTask names used in FLIP workflows.
- INIT_TRAINING = 'init_training'
- POST_VALIDATION = 'post_validation'
- CLEANUP = 'cleanup'
- INIT_TASK = 'init_task'
- POST_TASK = 'post_task'
- class flip.constants.flip_constants.FlipEvents
Event names used in FLIP workflows.
Note: This is a class with class attributes rather than an Enum because NVFLARE events are string constants.
- TRAINING_INITIATED = '_training_initiated'
- RESULTS_UPLOAD_STARTED = '_results_upload_started'
- RESULTS_UPLOAD_COMPLETED = '_results_upload_completed'
- SEND_RESULT = '_send_result'
- LOG_EXCEPTION = '_log_exception'
- ABORTED = '_aborted'
- TASK_INITIATED = '_task_initiated'
- class flip.constants.flip_constants.FlipProps
fl_ctx property names FLIP components use to share round telemetry.
Set (sticky, so they survive across NVFLARE contexts) by the FLIP ScatterAndGather controller as client results are accepted; read by ServerEventHandler when relaying ROUND_DONE to the hub as a ROUND_AGGREGATED event.
- ROUND_RETURNED = '_flip_round_returned'
- ROUND_EXPECTED = '_flip_round_expected'
- class flip.constants.flip_constants.ModelStatus
Bases:
enum.StrEnumModel job status values.
- PENDING = 'PENDING'
- INITIATED = 'INITIATED'
- PREPARED = 'PREPARED'
- RUNNING = 'RUNNING'
- RESULTS_UPLOADED = 'RESULTS_UPLOADED'
- ERROR = 'ERROR'
- STOPPED = 'STOPPED'
- RESULTS_UPLOAD_FAILED = 'RESULTS_UPLOAD_FAILED'