academy.exchange.cloud.config¶
Cloud exchange configuration file parsing.
LogConfig
pydantic-model
¶
Bases: BaseModel
Log config for exchange server.
Attributes:
-
level(int | str) –Console log verbosity.
-
logfile(str | None) –Base file name to write to.
-
logfile_level(int | str) –Verbosity of logs in file.
-
rotate(bool) –Weather to rotate logs or not.
-
rotation_interval_days(int) –How often in days to rotate logs.
-
backup_count(int) –How many previous log files to keep
Config:
extra:forbid
Fields:
-
level(int | str) -
logfile(str | None) -
logfile_level(int | str) -
rotate(bool) -
rotation_interval_days(int) -
backup_count(int)
init_logger
¶
init_logger() -> Logger
Initialize logger from this configuration.
Source code in academy/exchange/cloud/config.py
ExchangeAuthConfig
pydantic-model
¶
Bases: BaseModel
Exchange authentication configuration.
Attributes:
-
method(Literal['globus'] | None) –Authentication method.
-
kwargs(dict[str, Any]) –Arbitrary keyword arguments to pass to the authenticator. The kwargs are excluded from the
repr()of this class because they often contain secrets.
Config:
extra:forbid
Fields:
BackendConfig
¶
Bases: Protocol
Config for backend of storing messages.
get_backend
abstractmethod
¶
get_backend() -> MailboxBackend
PythonBackendConfig
pydantic-model
¶
Bases: BaseModel
Config for using PythonBackend.
Attributes:
-
message_size_limit_kb(int) –Maximum message size that can be sent. Bound by the SSE limit imposed by aiohttp.
Config:
extra:forbid
Fields:
get_backend
¶
get_backend() -> MailboxBackend
RedisBackendConfig
pydantic-model
¶
Bases: BaseModel
Config for RedisBackend.
Attributes:
-
hostname(str) –Redis host
-
port(int) –Redis port
-
message_size_limit_kb(int) –Maximum message size that can be sent. Bound by the SSE limit imposed by aiohttp.
-
mailbox_expiration_d(float) –Time till messages expire from mailbox.
-
gravestone_expiration_d(float) –Time till mailbox status is removed. After this, a mailbox may be recreated with the same id.
-
socket_timeout(float | None) –Time till connection to redis is automatically closed. Must be greater than
listen_timeout_sinExchangeServingConfig. -
kwargs(dict[str, Any]) –Any additional args to Redis
Config:
extra:forbid
Fields:
-
hostname(str) -
port(int) -
message_size_limit_kb(int) -
mailbox_expiration_d(float) -
gravestone_expiration_d(float) -
socket_timeout(float | None) -
kwargs(dict[str, Any]) -
kind(Literal['redis'])
get_backend
¶
get_backend() -> MailboxBackend
Construct an instance of the backend from the config.
Source code in academy/exchange/cloud/config.py
ExchangeServingConfig
pydantic-model
¶
Bases: BaseModel
Exchange serving configuration.
Attributes:
-
host(str) –Network interface the server binds to.
-
port(int) –Network port the server binds to.
-
certfile(str | None) –Certificate file (PEM format) use to enable TLS.
-
keyfile(str | None) –Private key file. If not specified, the key will be taken from the certfile.
-
listen_timeout_s(int) –Default timeout on listen and recv requests.
-
auth(ExchangeAuthConfig) –Authentication configuration.
-
backend(BackendConfigT) –Configured store for mailboxes.
-
logger(LogConfig) –Log configuration.
Config:
extra:forbid
Fields:
-
host(str) -
port(int) -
certfile(str | None) -
keyfile(str | None) -
listen_timeout_s(int) -
auth(ExchangeAuthConfig) -
backend(BackendConfigT) -
logger(LogConfig)
from_toml
classmethod
¶
Parse an TOML config file.
Example
Minimal config without SSL and without authentication.
Example
Serve with SSL and Globus Auth.
Note
Omitted values will be set to their defaults (if they are an optional value with a default).