Skip to content

Commit

Permalink
Merge pull request #78 from lsst/tickets/DM-26726
Browse files Browse the repository at this point in the history
DM-26726: Freeze Config prior to running the quantum
  • Loading branch information
timj committed Sep 24, 2020
2 parents 6a65c08 + 937b783 commit 57a37cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions python/lsst/ctrl/mpexec/singleQuantumExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ def execute(self, taskDef, quantum, butler):
# initialize global state
self.initGlobals(quantum, butler)

# Ensure that we are executing a frozen config
config.freeze()

task = self.makeTask(taskClass, config, butler)
self.runQuantum(task, quantum, taskDef, butler)

Expand Down Expand Up @@ -246,8 +249,7 @@ def runQuantum(self, task, quantum, taskDef, butler):
butlerQC = ButlerQuantumContext(butler, quantum)

# Get the input and output references for the task
connectionInstance = task.config.connections.ConnectionsClass(config=task.config)
inputRefs, outputRefs = connectionInstance.buildDatasetRefs(quantum)
inputRefs, outputRefs = taskDef.connections.buildDatasetRefs(quantum)

# Call task runQuantum() method. Any exception thrown by the task
# propagates to caller.
Expand Down
7 changes: 5 additions & 2 deletions python/lsst/ctrl/mpexec/taskFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def makeTask(self, taskClass, config, overrides, butler):
if overrides:
overrides.applyTo(config)
elif overrides is not None:
_LOG.waring("Both config and overrides are specified for task %s, overrides are ignored",
taskClass.__name__)
_LOG.warning("Both config and overrides are specified for task %s, overrides are ignored",
taskClass.__name__)

# if we don't have a butler, try to construct without initInputs;
# let PipelineTasks raise if that's impossible
Expand All @@ -86,6 +86,9 @@ def makeTask(self, taskClass, config, overrides, butler):
descriptorMap[name] = dsType
initInputs = {k: butler.get(v) for k, v in descriptorMap.items()}

# Freeze the config
config.freeze()

# make task instance
task = taskClass(config=config, initInputs=initInputs)

Expand Down

0 comments on commit 57a37cc

Please sign in to comment.