Skip to content

Commit

Permalink
Format AnalysisBaseConfig.connections.outputName on validate
Browse files Browse the repository at this point in the history
  • Loading branch information
taranu committed May 5, 2023
1 parent 71e7808 commit 12bd303
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion python/lsst/analysis/tools/interfaces/_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class AnalysisBaseConfig(PipelineTaskConfig, pipelineConnections=AnalysisBaseCon
atools = ConfigurableActionStructField[AnalysisTool](
doc="The analysis tools that are to be run by this task at execution"
)
# Temporarally alias these for backwards compatibility
# Temporarily alias these for backwards compatibility
plots = atools
metrics = atools
bands = ListField[str](
Expand All @@ -201,20 +201,30 @@ class AnalysisBaseConfig(PipelineTaskConfig, pipelineConnections=AnalysisBaseCon
in ("reference_package_timestamp", "run_timestamp", "current_timestamp", "dataset_timestamp"),
)

def _formatOutputName(self):
# Format the connection outputName with other connection values
# This should only be done once but it's unclear when/how
self.connections.outputName = self.connections.outputName.format(
**{k: v for k, v in self.connections.items() if k != "outputName"}
)

def freeze(self):
# Copy the meta configuration values to each of the configured tools
# only do this if the tool has not been further specialized
if not self._frozen:
for tool in self.atools:
for tag in self.metric_tags:
tool.metric_tags.insert(-1, tag)
self._formatOutputName()
super().freeze()

def validate(self):
super().validate()
# Validate that the required connections template is set.
if self.connections.outputName == "Placeholder": # type: ignore
raise RuntimeError("Connections class 'outputName' must have a config explicitly set")
elif not self._frozen:
self._formatOutputName()


class _StandinPlotInfo(dict):
Expand Down

0 comments on commit 12bd303

Please sign in to comment.