LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
fixupStage.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import lsst.pex.harness.stage as harnessStage
3 
4 from lsst.pex.logging import Log
5 
6 import lsst.pex.policy as pexPolicy
7 
8 class FixupStageParallel(harnessStage.ParallelProcessing):
9  """
10  Description:
11  This stage is used for cleaning up the clipboard in the PT1 unified
12  pipeline. It takes its inputKeys from the clipboard and then clears
13  the clipboard completely. It puts the objects that were in the
14  inputKeys back on the clipboard using names given in the outputKeys.
15  It may also do pipeline-specific tweaks to the objects.
16 
17  Policy Dictionary:
18  datarel/policy/FixupStageDictionary.paf
19  """
20  def setup(self):
21  self.log = Log(self.log, "FixupStage - parallel")
22 
23  policyFile = pexPolicy.DefaultPolicyFile("datarel",
24  "FixupStageDictionary.paf", "policy")
25  defPolicy = pexPolicy.Policy.createPolicy(policyFile,
26  policyFile.getRepositoryPath(), True)
27 
28  if self.policy is None:
30  self.policy.mergeDefaults(defPolicy.getDictionary())
31 
32  def process(self, clipboard):
33  """
34  Clear the clipboard of everything except inputKeys, which are remapped
35  to outputKeys.
36  """
37  self.log.log(Log.INFO, "Fixing up the clipboard")
38 
39  inputKeys = self.policy.get("inputKeys")
40  save = {}
41  for k in inputKeys.paramNames(True):
42  save[k] = clipboard.get(inputKeys.get(k))
43 
44  clipboard.close()
45 
46  outputKeys = self.policy.get("outputKeys")
47  for k in outputKeys.paramNames(True):
48  clipboard.put(outputKeys.get(k), save[k])
49 
50 class FixupStage(harnessStage.Stage):
51  parallelClass = FixupStageParallel
a container for holding hierarchical configuration data in memory.
Definition: Policy.h:169
a representation of a default Policy file that is stored as a file in the installation directory of a...
a place to record messages and descriptions of the state of processing.
Definition: Log.h:154