Skip to content

Commit

Permalink
Add new log file output dataset type
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Jul 21, 2021
1 parent 3a4131f commit 84a3402
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/lsst/pipe/base/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ class to allow configuration of the connections class. This dynamically
saveMetadata = pexConfig.Field(
dtype=bool, default=True, optional=False,
doc="Flag to enable/disable metadata saving for a task, enabled by default.")
saveLogOutput = pexConfig.Field(
dtype=bool, default=True, optional=False,
doc="Flag to enable/disable saving of log output for a task, enabled by default.")


class ResourceConfig(pexConfig.Config):
Expand Down
15 changes: 15 additions & 0 deletions python/lsst/pipe/base/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ def metadataDatasetName(self) -> Optional[str]:
else:
return None

@property
def logOutputDatasetName(self) -> Optional[str]:
"""Name of a dataset type for log output from this task, `None` if
logs are not to be saved (`str`)
"""
if self.config.saveLogOutput:
return self.label + "_log"
else:
return None

def __str__(self):
rep = "TaskDef(" + self.taskName
if self.label:
Expand Down Expand Up @@ -775,6 +785,11 @@ def makeDatasetTypesSet(connectionType: str, freeze: bool = True) -> NamedValueS
# dimensions correspond to a task quantum
dimensions = registry.dimensions.extract(taskDef.connections.dimensions)
outputs |= {DatasetType(taskDef.metadataDatasetName, dimensions, "PropertySet")}
if taskDef.logOutputDatasetName is not None:
# Log output dimensions correspond to a task quantum.
dimensions = registry.dimensions.extract(taskDef.connections.dimensions)
outputs |= {DatasetType(taskDef.logOutputDatasetName, dimensions, "ButlerLogRecords")}

outputs.freeze()

return cls(
Expand Down

0 comments on commit 84a3402

Please sign in to comment.