gfw.common.config#
Defines the PipelineConfig class used to configure data pipeline executions.
It includes: - A dataclass PipelineConfig that stores date ranges and any unknown arguments. - A custom exception PipelineConfigError for handling invalid configuration inputs.
Intended for use in CLI-based or programmatic pipeline setups where date ranges and additional arguments need to be passed and validated.
Classes
Configuration object for data pipeline execution. |
Exceptions
Custom exception for pipeline configuration errors. |
- exception PipelineConfigError[source]#
Custom exception for pipeline configuration errors.
- add_note()#
Exception.add_note(note) – add a note to the exception
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class PipelineConfig(*, date_range, name='', version='0.1.0', jinja_folder='assets/queries', mock_bq_clients=False, unknown_parsed_args=<factory>, unknown_unparsed_args=())[source]#
Configuration object for data pipeline execution.
Note
This class is completely generic and independent of any specific pipeline framework.
- classmethod from_namespace(ns, **kwargs)[source]#
Creates a
PipelineConfiginstance from atypes.SimpleNamespace.- Parameters:
ns (SimpleNamespace) – Namespace containing attributes matching this
PipelineConfigfields.**kwargs (Any) – Any additional arguments to be passed to the class constructor.
- Returns:
A new
PipelineConfiginstance.- Return type:
- property parsed_date_range: tuple[date, date]#
Returns the parsed start and end dates as
dateobjects.- Raises:
PipelineConfigError – If any of the dates are not in valid ISO format.
- Returns:
A tuple containing parsed start and end dates.
- property jinja_env: Environment#
Returns a default jinja2 environment.
- property start_date: date#
Returns the start date of the configured range.
- Returns:
A
dateobject representing the start of the range.
- property end_date: date#
Returns the end date of the configured range.
- Returns:
A
dateobject representing the end of the range.
- property pre_hooks: Sequence[Callable[[Any], None]]#
Sequence of callables executed before pipeline run.