-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add self-description functionality and setup obscore config loading a…
…s a singleton
- Loading branch information
Showing
9 changed files
with
573 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!-- Delete the sections that don't apply --> | ||
|
||
### New features | ||
|
||
- Setup self-description when maxrec is set to 0 | ||
|
||
### Other changes | ||
|
||
- Move obscore config loading to a dependency run at startime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Dependency class for loading the Obscore configs.""" | ||
|
||
from lsst.dax.obscore import ExporterConfig | ||
|
||
from ..config import Config | ||
|
||
|
||
class ObscoreConfigDependency: | ||
"""Provides a mapping of label names to Obscore (Exporter) Configs as a | ||
dependency. | ||
""" | ||
|
||
def __init__(self) -> None: | ||
self._config_mapping: dict[str, ExporterConfig] | None = None | ||
|
||
async def initialize(self, config: Config) -> None: | ||
"""Initialize the dependency by processing the Butler Collections.""" | ||
self._config_mapping = {} | ||
for collection in config.butler_data_collections: | ||
exporter_config = collection.get_exporter_config() | ||
self._config_mapping[collection.label] = exporter_config | ||
|
||
async def __call__(self) -> dict[str, ExporterConfig]: | ||
"""Return the mapping of label names to ExporterConfigs.""" | ||
if self._config_mapping is None: | ||
raise RuntimeError("ExporterConfigDependency is not initialized") | ||
return self._config_mapping | ||
|
||
async def aclose(self) -> None: | ||
"""Clear the config mapping.""" | ||
self._config_mapping = None | ||
|
||
|
||
obscore_config_dependency = ObscoreConfigDependency() | ||
"""The dependency that will return the mapping of label names to | ||
Obscore Configs.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.