本文整理汇总了Python中lsst.pex.policy.Policy.getPolicyArray方法的典型用法代码示例。如果您正苦于以下问题:Python Policy.getPolicyArray方法的具体用法?Python Policy.getPolicyArray怎么用?Python Policy.getPolicyArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lsst.pex.policy.Policy
的用法示例。
在下文中一共展示了Policy.getPolicyArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _DataReadyComp
# 需要导入模块: from lsst.pex.policy import Policy [as 别名]
# 或者: from lsst.pex.policy.Policy import getPolicyArray [as 别名]
class _DataReadyComp(object):
def setup(self, policyDict="DataReady_dict.paf"):
deffile = DefaultPolicyFile("ctrl_sched", policyDict, "policies")
defpol = Policy.createPolicy(deffile, deffile.getRepositoryPath())
if not hasattr(self,"policy") or not self.policy:
self.policy = Policy()
self.policy.mergeDefaults(defpol.getDictionary())
# self.mode = self.policy.getString("mode")
# if self.mode not in "parallel serial":
# raise RuntimeError("Stage %s: Unsupported mode: %s" %
# (self.getName(), self.mode))
self.clipboardKeys = {}
self.clipboardKeys["completedDatasets"] = \
self.policy.getString("inputKeys.completedDatasets")
self.clipboardKeys["possibleDatasets"] = \
self.policy.getString("inputKeys.possibleDatasets")
self.dataclients = []
clpols = []
if self.policy.exists("datasets"):
clpols = self.policy.getPolicyArray("datasets")
for pol in clpols:
dstype = None
if pol.exists("datasetType"):
dstype = pol.getString("datasetType")
topic = pol.getString("dataReadyEvent")
reportAll = pol.getBool("reportAllPossible")
client = DataReadyClient(self.getRun(), self.getName(), topic,
self.getEventBrokerHost(), dstype,
reportAll)
self.dataclients.append(client)
def tellDataReady(self, clipboard):
"""
send an event reporting on the output datasets that have been
attempted by this pipeline.
@param clipboard the pipeline clipboard containing the output
datasets
"""
completed = clipboard.get(self.clipboardKeys["completedDatasets"])
possible = clipboard.get(self.clipboardKeys["possibleDatasets"])
for client in self.dataclients:
if not possible:
break
self.log.log(Log.DEBUG, "completed: " + str(completed))
possible = client.tellDataReady(possible, completed)
# update the possible list for the ones we have not reported
# on yet.
clipboard.put(self.clipboardKeys["possibleDatasets"], possible)