Skip to main content

config

Dealing with interactions with configuration and environment variables.

Module

Functions

_get_environment

def _get_environment()> str:

Returns bitfount environment to be used from BITFOUNT_ENVIRONMENT variable.

The result is cached to avoid multiple warning messages. This means that changes to the BITFOUNT_ENVIRONMENT environment variable will not be detected whilst the library is running.

Returns str: PRODUCTION_ENVIRONMENT, STAGING_ENVIRONMENT, DEVELOPMENT_ENVIRONMENT or SANDBOX_ENVIRONMENT

configuration_schema

def configuration_schema()> dict[str, typing.Any]:

Generate a JSON schema for visible configuration.

get_gpu_metadata

def get_gpu_metadata()> tuple[typing.Optional[str], int]:

Retrieve details about GPUs if available.

Uses tools available in the appropriate backend, to find GPUs that are usable by the backend.

Returns: a tuple of GPU name and count.

refresh_configuration

def refresh_configuration()> None:

Hot-reloads configuration values.

Lets us refresh settings at runtime Avoiding having to restart everything to load in environment variables https://docs.pydantic.dev/latest/concepts/pydantic_settings/#in-place-reloading

Classes

Settings

class Settings(**values: Any):

All configurable settings.

Contains all of our configurable variables. Loads from .env.local or from environment variables.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

  • pydantic_settings.main.BaseSettings
  • pydantic.main.BaseModel

Variables

  • static default_batched_execution : bool
  • static default_torch_device : Optional[str]
  • static enable_data_cache : bool
  • static fast_load_maximum_number_of_files_to_load : int
  • static file_multiprocessing_enabled : bool
  • static handler_register_grace_period : int
  • static log_level : Literal['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG']
  • static logging : bitfount.config.LogSettings
  • static max_number_of_datasource_files : int
  • static model_computed_fields
  • static model_config : ClassVar[pydantic_settings.main.SettingsConfigDict]
  • static model_fields
  • static online_check_hard_limit : int
  • static online_check_soft_limit : int
  • static paths : bitfount.config.PathSettings
  • static pod_heartbeat_shutdown_timeout : int
  • static pod_vitals_handler_shutdown_timeout : int
  • static pod_vitals_port : int
  • static private : bitfount.config.PrivateSettings
  • static proxy_support : bool
  • static task_batch_size : int
  • static use_mps : bool