Skip to content

Commit

Permalink
switch to pydantic settings
Browse files Browse the repository at this point in the history
  • Loading branch information
hadim committed Jun 22, 2023
1 parent 494a78a commit ee83118
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions qcfractalcompute/qcfractalcompute/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def update_nested_dict(d, u):
return d


class PackageEnvironmentSettings(BaseModel):
class PackageEnvironmentSettings(BaseSettings):
"""
Environments with installed packages that can be used to run calculations
Expand All @@ -47,13 +47,13 @@ class PackageEnvironmentSettings(BaseModel):
[], description="List of paths to apptainer/singularity files to query for installed packages"
)

class Config(BaseModel.Config):
class Config(BaseSettings.Config):
case_insensitive = True
extra = "forbid"
env_prefix = "QCF_COMPUTE_ENVIRONMENTS_"


class ExecutorConfig(BaseModel):
class ExecutorConfig(BaseSettings):
type: str
queue_tags: List[str]
worker_init: List[str] = []
Expand All @@ -68,7 +68,7 @@ class ExecutorConfig(BaseModel):

environments: PackageEnvironmentSettings = PackageEnvironmentSettings()

class Config(BaseModel.Config):
class Config(BaseSettings.Config):
case_insensitive = True
extra = "forbid"

Expand Down Expand Up @@ -122,7 +122,7 @@ class FractalServerSettings(BaseSettings):
)
verify: Optional[bool] = Field(None, description="Use Server-side generated SSL certification or not.")

class Config(BaseModel.Config):
class Config(BaseSettings.Config):
case_insensitive = True
extra = "forbid"
env_prefix = "QCF_COMPUTE_SERVER_"
Expand Down Expand Up @@ -157,11 +157,11 @@ class FractalComputeConfig(BaseSettings):

parsl_run_dir: str = "parsl_run_dir"

server: FractalServerSettings = FractalServerSettings()
server: FractalServerSettings = Field(...)
environments: PackageEnvironmentSettings = PackageEnvironmentSettings()
executors: Dict[str, AllExecutorTypes] = Field(...)

class Config(BaseModel.Config):
class Config(BaseSettings.Config):
case_insensitive = True
extra = "forbid"
env_prefix = "QCF_COMPUTE_"
Expand Down

0 comments on commit ee83118

Please sign in to comment.