Configuration
Configuration schema and sources for DiracX.
Config Schema
schema
Attributes
T = TypeVar('T')
module-attribute
SerializableSet = Annotated[set[T], PlainSerializer(sorted, return_type=(list[T]), when_used='json-unless-none')]
module-attribute
Classes
BaseModel
pydantic-model
Bases: BaseModel
Config:
extra:forbidfrozen:True
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
model_config = ConfigDict(extra='forbid', frozen=True)
class-attribute
instance-attribute
Functions
legacy_adaptor(v)
pydantic-validator
Apply transformations to interpret the legacy DIRAC CFG format.
Source code in diracx-core/src/diracx/core/config/schema.py
UserConfig
pydantic-model
Bases: BaseModel
Fields:
-
PreferedUsername(str) -
DNs(list[str]) -
Email(EmailStr | None) -
Suspended(list[str]) -
Quota(int | None) -
CERNAccountType(str | None) -
PrimaryCERNAccount(str | None) -
CERNPersonId(int | None) -
AffiliationEnds(dict[str, date])
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
PreferedUsername
pydantic-field
DNs = []
pydantic-field
Email = None
pydantic-field
Suspended = []
pydantic-field
Quota = None
pydantic-field
CERNAccountType = None
pydantic-field
PrimaryCERNAccount = None
pydantic-field
CERNPersonId = None
pydantic-field
AffiliationEnds
pydantic-field
GroupConfig
pydantic-model
Bases: BaseModel
Fields:
-
AutoAddVOMS(bool) -
AutoUploadPilotProxy(bool) -
AutoUploadProxy(bool) -
JobShare(int) -
Properties(SerializableSet[SecurityProperty]) -
Quota(int | None) -
Users(SerializableSet[str]) -
AllowBackgroundTQs(bool) -
VOMSRole(str | None) -
AutoSyncVOMS(bool)
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
AutoAddVOMS = False
pydantic-field
AutoUploadPilotProxy = False
pydantic-field
AutoUploadProxy = False
pydantic-field
JobShare = 1000
pydantic-field
Properties
pydantic-field
Quota = None
pydantic-field
Users
pydantic-field
AllowBackgroundTQs = False
pydantic-field
VOMSRole = None
pydantic-field
AutoSyncVOMS = False
pydantic-field
IdpConfig
pydantic-model
Bases: BaseModel
Fields:
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
URL
pydantic-field
ClientID
pydantic-field
server_metadata_url
property
SupportInfo
pydantic-model
Bases: BaseModel
Fields:
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
Email = None
pydantic-field
Webpage = None
pydantic-field
Message = 'Please contact system administrator'
pydantic-field
RegistryConfig
pydantic-model
Bases: BaseModel
Fields:
-
IdP(IdpConfig) -
Support(SupportInfo) -
DefaultGroup(str) -
DefaultStorageQuota(float) -
DefaultProxyLifeTime(int) -
VOMSName(str | None) -
Users(MutableMapping[str, UserConfig]) -
Groups(MutableMapping[str, GroupConfig])
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
IdP
pydantic-field
Support
pydantic-field
DefaultGroup
pydantic-field
DefaultStorageQuota = 0
pydantic-field
DefaultProxyLifeTime = 12 * 60 * 60
pydantic-field
VOMSName = None
pydantic-field
Users
pydantic-field
Groups
pydantic-field
Functions
sub_from_preferred_username(preferred_username)
Get the user sub from the preferred username.
TODO: This could easily be cached or optimised
Source code in diracx-core/src/diracx/core/config/schema.py
DIRACConfig
pydantic-model
JobMonitoringConfig
pydantic-model
Bases: BaseModel
Fields:
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
GlobalJobsInfo = True
pydantic-field
JobSchedulingConfig
pydantic-model
Bases: BaseModel
Fields:
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
EnableSharesCorrection = False
pydantic-field
MaxRescheduling = 3
pydantic-field
ServicesConfig
pydantic-model
Bases: BaseModel
Fields:
-
Catalogs(MutableMapping[str, Any] | None) -
JobMonitoring(JobMonitoringConfig) -
JobScheduling(JobSchedulingConfig)
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
Catalogs = None
pydantic-field
JobMonitoring
pydantic-field
JobScheduling
pydantic-field
JobDescriptionConfig
pydantic-model
Bases: BaseModel
Fields:
-
DefaultCPUTime(int) -
DefaultPriority(int) -
MinCPUTime(int) -
MinPriority(int) -
MaxCPUTime(int) -
MaxPriority(int) -
MaxInputData(int) -
AllowedJobTypes(list[str])
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
DefaultCPUTime = 86400
pydantic-field
DefaultPriority = 1
pydantic-field
MinCPUTime = 100
pydantic-field
MinPriority = 0
pydantic-field
MaxCPUTime = 500000
pydantic-field
MaxPriority = 10
pydantic-field
MaxInputData = 100
pydantic-field
AllowedJobTypes = ['User', 'Test', 'Hospital']
pydantic-field
InputDataPolicyProtocolsConfig
pydantic-model
Bases: BaseModel
Fields:
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
Remote = []
pydantic-field
Local = []
pydantic-field
InputDataPolicyConfig
pydantic-model
Bases: BaseModel
Config:
extra:ignorefrozen:True
Fields:
-
Default(str) -
Download(str) -
Protocol(str) -
AllReplicas(bool) -
Protocols(InputDataPolicyProtocolsConfig) -
InputDataModule(str)
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
model_config = ConfigDict(extra='ignore', frozen=True)
class-attribute
instance-attribute
Default = 'Default = DIRAC.WorkloadManagementSystem.Client.InputDataByProtocol'
pydantic-field
Download = 'DIRAC.WorkloadManagementSystem.Client.DownloadInputData'
pydantic-field
Protocol = 'DIRAC.WorkloadManagementSystem.Client.InputDataByProtocol'
pydantic-field
AllReplicas = True
pydantic-field
Protocols
pydantic-field
InputDataModule = 'DIRAC.Core.Utilities.InputDataResolution'
pydantic-field
OperationsConfig
pydantic-model
Bases: BaseModel
Fields:
-
EnableSecurityLogging(bool) -
InputDataPolicy(InputDataPolicyConfig) -
JobDescription(JobDescriptionConfig) -
Services(ServicesConfig) -
SoftwareDistModule(str) -
Cloud(MutableMapping[str, Any] | None) -
DataConsistency(MutableMapping[str, Any] | None) -
DataManagement(MutableMapping[str, Any] | None) -
EMail(MutableMapping[str, Any] | None) -
GaudiExecution(MutableMapping[str, Any] | None) -
Hospital(MutableMapping[str, Any] | None) -
JobScheduling(MutableMapping[str, Any] | None) -
JobTypeMapping(MutableMapping[str, Any] | None) -
LogFiles(MutableMapping[str, Any] | None) -
LogStorage(MutableMapping[str, Any] | None) -
Logging(MutableMapping[str, Any] | None) -
Matching(MutableMapping[str, Any] | None) -
MonitoringBackends(MutableMapping[str, Any] | None) -
NagiosConnector(MutableMapping[str, Any] | None) -
Pilot(MutableMapping[str, Any] | None) -
Productions(MutableMapping[str, Any] | None) -
Shares(MutableMapping[str, Any] | None) -
Shifter(MutableMapping[str, Any] | None) -
SiteSEMappingByProtocol(MutableMapping[str, Any] | None) -
TransformationPlugins(MutableMapping[str, Any] | None) -
Transformations(MutableMapping[str, Any] | None) -
ResourceStatus(MutableMapping[str, Any] | None)
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
EnableSecurityLogging = False
pydantic-field
InputDataPolicy
pydantic-field
JobDescription
pydantic-field
Services
pydantic-field
SoftwareDistModule = 'LocalSoftwareDist'
pydantic-field
Cloud = None
pydantic-field
DataConsistency = None
pydantic-field
DataManagement = None
pydantic-field
EMail = None
pydantic-field
GaudiExecution = None
pydantic-field
Hospital = None
pydantic-field
JobScheduling = None
pydantic-field
JobTypeMapping = None
pydantic-field
LogFiles = None
pydantic-field
LogStorage = None
pydantic-field
Logging = None
pydantic-field
Matching = None
pydantic-field
MonitoringBackends = None
pydantic-field
NagiosConnector = None
pydantic-field
Pilot = None
pydantic-field
Productions = None
pydantic-field
Shares = None
pydantic-field
Shifter = None
pydantic-field
SiteSEMappingByProtocol = None
pydantic-field
TransformationPlugins = None
pydantic-field
Transformations = None
pydantic-field
ResourceStatus = None
pydantic-field
ResourcesComputingConfig
pydantic-model
Bases: BaseModel
Config:
extra:ignorefrozen:True
Fields:
Validators:
-
legacy_adaptor -
legacy_adaptor_os_compatibility→OSCompatibility -
ensure_self_compatibility→OSCompatibility
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
model_config = ConfigDict(extra='ignore', frozen=True)
class-attribute
instance-attribute
OSCompatibility = {}
pydantic-field
Functions
legacy_adaptor_os_compatibility(v)
pydantic-validator
Apply transformations to interpret the legacy DIRAC CFG format.
Source code in diracx-core/src/diracx/core/config/schema.py
ensure_self_compatibility(v)
pydantic-validator
Ensure platforms are compatible with themselves.
Source code in diracx-core/src/diracx/core/config/schema.py
ResourcesConfig
pydantic-model
Bases: BaseModel
Config:
extra:ignorefrozen:True
Fields:
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
model_config = ConfigDict(extra='ignore', frozen=True)
class-attribute
instance-attribute
Computing
pydantic-field
Config
pydantic-model
Bases: BaseModel
Fields:
-
DIRAC(DIRACConfig) -
Operations(MutableMapping[str, OperationsConfig]) -
Registry(MutableMapping[str, RegistryConfig]) -
Resources(ResourcesConfig) -
LocalSite(Any) -
LogLevel(Any) -
MCTestingDestination(Any) -
Systems(Any | None) -
WebApp(Any) -
_hexsha(str) -
_modified(datetime)
Validators:
Source code in diracx-core/src/diracx/core/config/schema.py
Attributes
DIRAC
pydantic-field
Operations
pydantic-field
Registry
pydantic-field
Resources
pydantic-field
LocalSite = None
pydantic-field
LogLevel = None
pydantic-field
MCTestingDestination = None
pydantic-field
Systems = None
pydantic-field
WebApp = None
pydantic-field
Functions
ensure_operations_defaults(v)
pydantic-validator
Merge the Defaults entry into the VO-specific config under Operations.
Source code in diracx-core/src/diracx/core/config/schema.py
Functions
Config Sources
sources
This module implements the logic of the configuration server side.
This is where all the backend abstraction and the caching logic takes place.
Attributes
DEFAULT_CONFIG_FILE = 'default.yml'
module-attribute
DEFAULT_GIT_BRANCH = 'master'
module-attribute
DEFAULT_CS_REV_CACHE_SOFT_TTL = 5
module-attribute
DEFAULT_CS_REV_CACHE_HARD_TTL = 60 * 60
module-attribute
DEFAULT_CS_CONTENT_HARD_TTL = 15
module-attribute
logger = logging.getLogger(__name__)
module-attribute
ConfigSourceUrl = Annotated[AnyUrlWithoutHost, BeforeValidator(_apply_default_scheme)]
module-attribute
Classes
AnyUrlWithoutHost
ConfigSource
Abstract class for the configuration source.
This class takes care of the expected caching and locking logic. Subclasses are responsible for implementing the actual logic to find revisions and reading the configuration.
Source code in diracx-core/src/diracx/core/config/sources.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
Attributes
scheme
instance-attribute
Functions
latest_revision()
abstractmethod
Must return: * a unique hash as a string, representing the last version * a datetime object corresponding to when the version dates.
read_raw(hexsha, modified)
abstractmethod
Return the Config object that corresponds to the
specific hash
The modified parameter is just added as a attribute to the config.
create()
classmethod
create_from_url(*, backend_url)
classmethod
Factory method to produce a concrete instance depending on the backend URL scheme.
Source code in diracx-core/src/diracx/core/config/sources.py
read_config()
Load the configuration from the backend with appropriate caching.
:raises: diracx.core.exceptions.NotReadyError if the config is being loaded still :raises: git.exc.BadName if version does not exist
Source code in diracx-core/src/diracx/core/config/sources.py
read_config_non_blocking()
async
Load the configuration from the backend with appropriate caching.
:raises: diracx.core.exceptions.NotReadyError if the config is being loaded still :raises: git.exc.BadName if version does not exist
Source code in diracx-core/src/diracx/core/config/sources.py
BaseGitConfigSource
Bases: ConfigSource
Base class for the git based config source.
Source code in diracx-core/src/diracx/core/config/sources.py
Attributes
repo_location
instance-attribute
scheme = 'basegit'
class-attribute
instance-attribute
remote_url = self.extract_remote_url(backend_url)
instance-attribute
git_branch = self.get_git_branch_from_url(backend_url)
instance-attribute
Functions
latest_revision()
Source code in diracx-core/src/diracx/core/config/sources.py
read_raw(hexsha, modified)
:param: hexsha commit hash
Source code in diracx-core/src/diracx/core/config/sources.py
extract_remote_url(backend_url)
Extract the base URL without the 'git+' prefix and query parameters.
Source code in diracx-core/src/diracx/core/config/sources.py
get_git_branch_from_url(backend_url)
Extract the branch from the query parameters.
LocalGitConfigSource
Bases: BaseGitConfigSource
The configuration is stored on a local git repository When running on multiple servers, the filesystem must be shared.
Source code in diracx-core/src/diracx/core/config/sources.py
Attributes
scheme = 'git+file'
class-attribute
instance-attribute
repo_location = Path(backend_url.path)
instance-attribute
RemoteGitConfigSource
Bases: BaseGitConfigSource
Use a remote directory as a config source.