Skip to content

Commit

Permalink
Store output refs in quantum metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Jan 30, 2025
1 parent 39b6dfc commit b11c6dd
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions python/lsst/ctrl/mpexec/singleQuantumExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ def _execute(
task = self.taskFactory.makeTask(task_node, limited_butler, init_input_refs)
logInfo(None, "start", metadata=quantumMetadata) # type: ignore[arg-type]
try:
quantumMetadata["caveats"] = self.runQuantum(
caveats, outputsPut = self.runQuantum(
task, quantum, task_node, limited_butler, quantum_id=quantum_id
).value
)
except Exception as e:
_LOG.error(
"Execution of task '%s' on quantum %s failed. Exception %s: %s",
Expand All @@ -285,6 +285,11 @@ def _execute(
str(e),
)
raise
else:
quantumMetadata["caveats"] = caveats.value
# Stringify the UUID for easier compatibility with
# PropertyList.
quantumMetadata["outputs"] = [str(ref.id) for ref in outputsPut]
logInfo(None, "end", metadata=quantumMetadata) # type: ignore[arg-type]
fullMetadata = task.getFullMetadata()
fullMetadata["quantum"] = quantumMetadata
Expand Down Expand Up @@ -483,7 +488,7 @@ def runQuantum(
/,
limited_butler: LimitedButler,
quantum_id: uuid.UUID | None = None,
) -> QuantumSuccessCaveats:
) -> tuple[QuantumSuccessCaveats, list[DatasetRef]]:
"""Execute task on a single quantum.
Parameters
Expand All @@ -503,6 +508,9 @@ def runQuantum(
-------
flags : `QuantumSuccessCaveats`
Flags that describe qualified successes.
outputsPut : list[ `lsst.daf.butler.DatasetRef` ]
Record of all the datasets that were written by this quantum
being executed.
"""
flags = QuantumSuccessCaveats.NO_CAVEATS

Expand Down Expand Up @@ -556,7 +564,7 @@ def runQuantum(
flags |= QuantumSuccessCaveats.ALL_OUTPUTS_MISSING
if not butlerQC.outputsPut == butlerQC.allOutputs:
flags |= QuantumSuccessCaveats.ANY_OUTPUTS_MISSING
return flags
return flags, butlerQC.outputRefsPut

def writeMetadata(
self, quantum: Quantum, metadata: Any, task_node: TaskNode, /, limited_butler: LimitedButler
Expand Down

0 comments on commit b11c6dd

Please sign in to comment.