本文整理汇总了Python中IMProv.IMProvNode.IMProvNode类的典型用法代码示例。如果您正苦于以下问题:Python IMProvNode类的具体用法?Python IMProvNode怎么用?Python IMProvNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IMProvNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
def save(self):
"""
_save_
Save the tfc by converting it into
an XML IMProv Object
"""
result = IMProvNode("storage-mapping")
for maping in self.lfnToPfn:
node = IMProvNode("lfn-to-pfn", None)
node.attrs.update(maping)
del node.attrs['path-match-regexp']
if not maping.get('chain', None):
del node.attrs['chain']
result.addNode(node)
for maping in self.pfnToLfn:
node = IMProvNode("pfn-to-lfn", None)
node.attrs.update(maping)
del node.attrs['path-match-regexp']
if not maping.get('chain', None):
del node.attrs['chain']
result.addNode(node)
return result
示例2: save
def save(self):
"""save to improv node"""
result = IMProvNode("Run", None, ID = str(self.run))
for lumi in self:
result.addNode(IMProvNode("LumiSection", None, ID = str(lumi)))
return result
示例3: save
def save(self, filename):
"""
_save_
Write this Configuration out as an XML file to the
file provided by the argument
Args --
- *filename* : Path where file will be created. Will overwrite any
existing file
"""
# //
# // Serialise the Task Tree
#//
if self._TaskTree == None:
msg = "Error: Task Tree is empty\n"
msg += "You must provide a set of ShREEKTasks to execute!\n"
raise ShREEKException(msg, ClassInstance = self)
taskNode = IMProvNode("ShREEKTaskTree")
self.addNode(taskNode)
taskNode.addNode(self._TaskTree.makeIMProv())
# //
# // Save Config to file as XML Document
#//
doc = IMProvDoc("ShREEKConfiguration")
doc.addNode(self)
handle = open(filename, "w")
handle.write(doc.makeDOMDocument().toprettyxml())
handle.close()
return
示例4: __init__
def __init__(self):
IMProvNode.__init__(self, self.__class__.__name__)
self.addNode(IMProvNode("ShREEKPlugins"))
self.addNode(IMProvNode("ShREEKMonitors"))
self.addNode(IMProvNode("ShREEKUpdators"))
self.addPluginModule("ShREEK.ShREEK_common")
self.addPluginModule("ShREEK.ControlPoints.ActionImpl")
self.addPluginModule("ShREEK.ControlPoints.CondImpl")
self._TaskTree = None
示例5: makeIMProv
def makeIMProv(self):
"""
_makeIMProv_
Make IMProv XML Node structure from this conditional
"""
result = IMProvNode(self.name, str(self.content).strip(), **self.attrs)
for child in self._Children:
result.addNode(child.makeIMProv())
return result
示例6: save
def save(self):
"""
_save_
Serialise this to XML compatible with PhEDEx injection
"""
result = IMProvNode("block")
result.attrs['name'] = self.fileblockName
result.attrs['is-open'] = self.isOpen
for lfn, checksums, size in self:
# checksums is a comma separated list of key:value pair
checksum = ",".join(["%s:%s" % (x, y) for x, y \
in checksums.items() \
if y not in (None, '')])
for lfn, checksums, size in self:
# checksums is a comma separated list of key:value pair
formattedChecksums = ",".join(["%s:%s" % (x.lower(), y) for x, y \
in checksums.items() \
if y not in (None, '')])
file = IMProvNode("file")
file.attrs['name'] = lfn
file.attrs['checksum'] = formattedChecksums
file.attrs['bytes'] = size
result.addNode(file)
return result
示例7: save
def save(self):
"""
_save_
Serialise self into IMProvNode structure
"""
result = IMProvNode(self.__class__.__name__)
for value in self.values():
result.addNode(value.save())
return result
示例8: save
def save(self):
"""
_save_
return IMProv structure of self
"""
result = IMProvNode("BulkSpecs")
for key, value in self.items():
result.addNode(IMProvNode("BulkSpec", value, ID=key))
return result
示例9: save
def save(self):
"""
_save_
Convert this instance into an IMProv structure
"""
result = IMProvNode("RunTable")
result.attrs['RunNumber'] = self['RunNumber']
for dataset in self.primaryDatasets.values():
result.addNode(dataset.save())
return result
示例10: save
def save(self):
"""self to improv"""
result = IMProvNode("Test", self["CfgUrl"],
Events = str(self['Events']),
Name = str(self['Name']),
)
if self['FactionSelected'] != None:
result.attrs['FractionSelected'] = str(self['FractionSelected'])
if self['InputDataset'] != None:
result.attrs['InputDataset'] = self['InputDataset']
return result
示例11: save
def save(self):
"""
_save_
convert this object to an improv Node
"""
result = IMProvNode("PrimaryDataset")
result.attrs['PrimaryName'] = self['PrimaryName']
result.attrs['RepackAlgorithm'] = self['RepackAlgorithm']
for tpath in self.triggerPaths.values():
result.addNode(tpath.save())
return result
示例12: addStageOutNode
def addStageOutNode(cmsRunNode, nodeName, *nodes):
"""
_addStageOutNode_
Given a cmsRun Node add a StageOut node to it with the name provided
"""
if not nodes:
nodes = [cmsRunNode.name]
stageOut = cmsRunNode.newNode(nodeName)
stageOut.type = "StageOut"
stageOut.application["Project"] = ""
stageOut.application["Version"] = ""
stageOut.application["Architecture"] = ""
stageOut.application["Executable"] = "RuntimeStageOut.py" # binary name
config = IMProvNode("StageOutConfiguration")
for node in nodes:
config.addNode(IMProvNode("StageOutFor", None, NodeName = str(node)))
config.addNode(IMProvNode("NumberOfRetries", None, Value = 3))
config.addNode(IMProvNode("RetryPauseTime", None, Value = 600))
stageOut.configuration = config.makeDOMElement().toprettyxml()
return
示例13: dictToNode
def dictToNode(dictRef):
results = []
for key, value in dictRef.items():
if type(value) == type({}):
keyNode = IMProvNode(str(key), None, Type = "Path")
for item in dictToNode(value):
keyNode.addNode(item)
results.append(keyNode)
if type(value) == type([]):
for item in value:
dataNode = IMProvNode(str(key), str(item), Type = "Data")
results.append(dataNode)
return results
示例14: persistRuns
def persistRuns(filename, *runTables):
"""
_persistRuns_
Util to save a list of RunTable instances to a file
"""
topNode = IMProvNode("Runs")
[ topNode.addNode(x.save()) for x in runTables ]
handle = open(filename, 'w')
handle.write(topNode.makeDOMElement().toprettyxml())
handle.close()
return
示例15: save
def save(self):
"""
_save_
Create IMProvNode repr of self
"""
result = IMProvNode("TriggerPath", None, Name = self['Name'])
for key, val in self.items():
if key == "Name":
continue
if val == None:
continue
result.addNode(IMProvNode(key, None, Value = str(val)))
return result