spark.core.config#
Attributes#
Classes#
Metaclass that automatically injects common methods into the class. |
|
Wrapper for fields that allow for Initializers | InitializersConfig to define the init() method. |
|
Metaclass that promotes class attributes to dataclass fields |
|
Base class for module configuration. |
|
Default class for module configuration. |
Module Contents#
- class spark.core.config.InitializableFieldMetaclass[source]#
Bases:
typeMetaclass that automatically injects common methods into the class.
- class spark.core.config.InitializableField(obj)[source]#
Wrapper for fields that allow for Initializers | InitializersConfig to define the init() method. The method init() is extensively used through Spark modules to initialize variables either from default values or from full fledge initializers.
- class spark.core.config.SparkMetaConfig[source]#
Bases:
abc.ABCMetaMetaclass that promotes class attributes to dataclass fields
- class spark.core.config.BaseSparkConfig(__skip_validation__=False, **kwargs)[source]#
Bases:
abc.ABCBase class for module configuration.
- Parameters:
__skip_validation__ (bool)
- diff(other)[source]#
Return differences from another config.
- Parameters:
other (BaseSparkConfig)
- Return type:
- validate(is_partial=False, errors=None, current_path=['main'])[source]#
Validates all fields in the configuration class.
- get_metadata()[source]#
Returns all the metadata in the configuration class, indexed by the attribute name.
- property class_ref: type[source]#
Returns the type of the associated Module/Initializer.
NOTE: It is recommended to set the __class_ref__ to the name of the associated module/initializer when defining custom configuration classes. The automatic class_ref solver is extremely brittle and likely to fail in many different custom scenarios.
- Return type:
- classmethod from_dict(dct)[source]#
Create config instance from dictionary.
- Parameters:
dct (dict)
- Return type:
- classmethod from_file(file_path, is_partial=False)[source]#
Create config instance from a .scfg file.
- Parameters:
- Return type:
- __iter__()[source]#
Custom iterator to simplify SparkConfig inspection across the entire ecosystem. This iterator excludes private fields.
- Output:
field_name: str, field name field_value: tp.Any, field value
- Return type:
Iterator[tuple[str, dataclasses.Field, Any]]