本文整理汇总了Python中EDPlugin.EDPlugin类的典型用法代码示例。如果您正苦于以下问题:Python EDPlugin类的具体用法?Python EDPlugin怎么用?Python EDPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EDPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: preProcess
def preProcess(self, _edObject=None):
EDPlugin.preProcess(self)
self.DEBUG("EDPluginAccumulatorv1_0.preProcess")
self.__semaphore.acquire()
for oneXsdItem in self.getDataInput().getItem(): #could be empty
self.__items.append(oneXsdItem.getValue())
for oneXsdQuery in self.getDataInput().getQuery(): #could be an empty list
query = []
for oneXsdItem in oneXsdQuery.getItem():
query.append(oneXsdItem.getValue())
if oneXsdQuery.getRemoveItems() is not None:
if oneXsdQuery.getRemoveItems().getValue() in [1, True, "true"]:
removeItems = True
elif oneXsdQuery.getRemoveItems().getValue() in [0, False, "false", None]:
removeItems = False
else:
removeItems = True
else:
removeItems = True
query.sort()
self.__queries[tuple(query)] = removeItems
self.__semaphore.release()
if self.getDataInput().getFlush() is not None:
if self.getDataInput().getFlush().getValue() in [1, True, "true"]:
self.flush = True
示例2: preProcess
def preProcess(self, _edObject=None):
EDPlugin.preProcess(self, _edObject)
EDVerbose.DEBUG("EDPluginWrapperForJobScheduler.preProcess")
# Construct python script for executing the plugin
strPythonWrapper = self.preparePythonWrapperScript()
self.__strPathToPythonWrapper = os.path.join(self.getWorkingDirectory(), self.__strPythonWrapperScriptName)
EDUtilsFile.writeFile(self.__strPathToPythonWrapper, strPythonWrapper)
示例3: preProcess
def preProcess(self, _edObject=None):
EDPlugin.preProcess(self)
self.DEBUG("EDPluginAccumulatorv1_0.preProcess")
with self.__class__._semaphore:
for oneXsdItem in self.dataInput.item: #could be empty
self._items.append(oneXsdItem.value)
for oneXsdQuery in self.dataInput.query: #could be an empty list
query = []
for oneXsdItem in oneXsdQuery.item:
query.append(oneXsdItem.value)
if oneXsdQuery.removeItems is not None:
if oneXsdQuery.removeItems.value in [1, True, "true"]:
removeItems = True
elif oneXsdQuery.removeItems.value in [0, False, "false", None]:
removeItems = False
else:
removeItems = True
else:
removeItems = True
query.sort()
self._queries[tuple(query)] = removeItems
if self.dataInput.flush is not None:
if self.dataInput.flush.value in [1, True, "true"]:
self.flush = True
示例4: __init__
def __init__(self):
"""
"""
EDPlugin.__init__(self)
self.setXSDataInputClass(XSDataInputAccumulator)
self.xsDataResult = XSDataResultAccumulator()
self.flush = False
示例5: preProcess
def preProcess(self, _edObject=None):
"""
preProcess of the plugin:
Ensure a CPU resource is available for the processing by acquiring a semaphore
"""
EDVerbose.DEBUG("Acquire semaphore nbCPU by plugin %s, currently value: %s" % (self.getPluginName(), EDUtilsParallel.getSemaphoreValue()))
EDUtilsParallel.semaphoreNbThreadsAcquire()
EDPlugin.preProcess(self, _edObject)
示例6: preProcess
def preProcess(self, _edObject=None):
EDPlugin.preProcess(self)
self.DEBUG("EDPluginWaitFile.preProcess")
self.__filename = self.getDataInput().getExpectedFile().getPath().getValue()
self.__expectedSize = self.getDataInput().getExpectedSize().getValue()
if self.getDataInput().getTimeOut():
self.__timeout = self.getDataInput().getTimeOut().getValue()
self.setTimeOut(self.getDataInput().getTimeOut().getValue() + EDPluginWaitFile.EXTRA_TIME)
示例7: __init__
def __init__ (self):
"""
"""
EDPlugin.__init__(self)
self.__strPluginToBeControlledName = None
self.__dictControlledPlugins = {}
self.__edActionCluster = None
self.__listOfLoadedPlugins = []
示例8: finallyProcess
def finallyProcess(self, _edObject=None):
"""
after processing of the plugin:
Release a CPU resource by releasing the semaphore
"""
EDVerbose.DEBUG("Release semaphore nbCPU by plugin %s, currently value: %s" % (self.getPluginName(), EDUtilsParallel.getSemaphoreValue()))
EDUtilsParallel.semaphoreNbThreadsRelease()
EDPlugin.finallyProcess(self, _edObject)
示例9: finallyProcess
def finallyProcess(self, _edObject=None):
"""
after processing of the plugin:
Release a CPU resource by releasing the semaphore
"""
self.DEBUG("Release semaphore nbCPU by plugin %s" % self.getPluginName())
EDUtilsParallel.semaphoreNbThreadsRelease()
EDPlugin.finallyProcess(self, _edObject)
示例10: preProcess
def preProcess(self, _edObject=None):
"""
preProcess of the plugin:
Ensure a CPU resource is available for the processing by acquiring a semaphore
"""
self.DEBUG("Acquire semaphore nbCPU by plugin %s" % self.getPluginName())
EDUtilsParallel.semaphoreNbThreadsAcquire()
EDPlugin.preProcess(self, _edObject)
示例11: __init__
def __init__(self):
"""
"""
EDPlugin.__init__(self)
self.setXSDataInputClass(XSDataInputWaitFile)
self.__filename = None
self.__exists = None
self.__filesize = None
self.__expectedSize = None
self.__timeout = self.DEFAULT_TIMEOUT
示例12: __init__
def __init__(self, _strNameOfPlugin):
EDPlugin.__init__(self)
self.__strNameOfPlugin = _strNameOfPlugin
EDFactoryPluginStatic.loadModule(_strNameOfPlugin)
self.__dictXMLDataInput = {}
self.__dictXMLDataOutput = {}
self.__strPythonWrapperScriptName = "pluginWrapperForJobScheduler.py"
self.__strPathToPythonWrapper = None
self.__edServerXMLRCP = EDServerXMLRCP.getInstance()
self.__edServerXMLRCP.registerPlugin(self)
self.__bFinished = False
示例13: postProcess
def postProcess(self, _edObject=None):
EDPlugin.postProcess(self)
self.DEBUG("EDPluginWaitFile.postProcess: Waited for %.3f s" % self.getRunTime())
xsDataResult = XSDataResultWaitFile()
if os.path.exists(self.__filename):
xsDataFile = XSDataFile()
xsDataFile.setPath(XSDataString(self.__filename))
xsDataResult.setActualFile(xsDataFile)
xsDataResult.setActualSize(XSDataInteger(os.path.getsize(self.__filename)))
xsDataResult.setTimedOut(XSDataBoolean(self.getRunTime() >= self.__timeout))
# Create some output data
self.setDataOutput(xsDataResult)
示例14: process
def process(self, _edObject=None):
EDPlugin.process(self)
self.DEBUG("EDPluginWaitFile.process")
self.DEBUG("EDPluginWaitFile Plugin TimeOut is set to: %s, internal TimeOut is %s" % (self.getTimeOut(), self.__timeout))
self.setTimeInit()
dirname = os.path.dirname(self.__filename)
while self.getRunTime() < self.__timeout:
if os.path.isdir(dirname):
fd = os.open(dirname, os.O_RDONLY)
os.fstat(fd)
os.close(fd)
if os.path.exists(self.__filename):
self.__filesize = os.path.getsize(self.__filename)
if self.__filesize >= self.__expectedSize:
break
time.sleep(EDPluginWaitFile.DELTA_TIME)
self.setTimeEnd()
示例15: configure
def configure(self):
"""
Gets the EDPluginControl parameters from the configuration file and stores them in class member attributes.
"""
EDPlugin.configure(self)
EDVerbose.DEBUG("EDPluginControl.configure")
strControlledPlugins = self.config.get("controlledPlugins", None)
if (strControlledPlugins != None):
pyListControlledPlugins = strControlledPlugins.split(",")
for strControlledPlugin in pyListControlledPlugins:
strControlledPluginName = self.getStringConfigurationParameterValue(strControlledPlugin)
if strControlledPluginName != None:
self.setControlledPluginName(strControlledPlugin, strControlledPluginName)
EDVerbose.DEBUG("EDPluginControl.configure: setting controlled plugin %s to specific plugin %s" % (strControlledPlugin, strControlledPluginName))
clusterSize = self.config.get("clusterSize", None)
if (clusterSize != None):
self.__iClusterSize = int(strClusterSize)
EDVerbose.DEBUG("EDPluginControl.configure: setting cluster size to %d" % self.__iClusterSize)