本文整理汇总了Python中grid_control.parameters.psource_base.ParameterSource.resync方法的典型用法代码示例。如果您正苦于以下问题:Python ParameterSource.resync方法的具体用法?Python ParameterSource.resync怎么用?Python ParameterSource.resync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grid_control.parameters.psource_base.ParameterSource
的用法示例。
在下文中一共展示了ParameterSource.resync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resync
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import resync [as 别名]
def resync(self): # Quicker version than the general purpose implementation
result = ParameterSource.resync(self)
for psource in self._psourceList:
result = combineSyncResult(result, psource.resync())
oldMaxParameters = self._maxParameters
self._maxParameters = self.initMaxParameters()
return (result[0], result[1], oldMaxParameters != self._maxParameters)
示例2: resync
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import resync [as 别名]
def resync(self):
(result_redo, result_disable, result_sizeChange) = ParameterSource.resync(self)
if self.resyncEnabled() and self._dataProvider:
# Get old and new dataset information
old = DataProvider.loadFromFile(self.getDataPath('cache.dat')).getBlocks()
self._dataProvider.clearCache()
new = self._dataProvider.getBlocks()
self._dataProvider.saveToFile(self.getDataPath('cache-new.dat'), new)
# Use old splitting information to synchronize with new dataset infos
jobChanges = self._dataSplitter.resyncMapping(self.getDataPath('map-new.tar'), old, new)
if jobChanges:
# Move current splitting to backup and use the new splitting from now on
def backupRename(old, cur, new):
if self._keepOld:
os.rename(self.getDataPath(cur), self.getDataPath(old))
os.rename(self.getDataPath(new), self.getDataPath(cur))
backupRename( 'map-old-%d.tar' % time.time(), 'map.tar', 'map-new.tar')
backupRename('cache-old-%d.dat' % time.time(), 'cache.dat', 'cache-new.dat')
old_maxN = self._dataSplitter.getMaxJobs()
self._dataSplitter.importPartitions(self.getDataPath('map.tar'))
self._maxN = self._dataSplitter.getMaxJobs()
result_redo.update(jobChanges[0])
result_disable.update(jobChanges[1])
result_sizeChange = result_sizeChange or (old_maxN != self._maxN)
self.resyncFinished()
return (result_redo, result_disable, result_sizeChange)
示例3: resync
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import resync [as 别名]
def resync(self):
(result_redo, result_disable, result_sizeChange) = ParameterSource.resync(self)
if self.resyncEnabled():
(psource_redo, psource_disable, psource_sizeChange) = self._psource.resync()
self._pSpace = self.initPSpace()
for pNum, pInfo in enumerate(self._pSpace):
subNum, _ = pInfo # ignore lookupIndex
if subNum in psource_redo:
result_redo.add(pNum)
if subNum in psource_disable:
result_disable.add(pNum)
self.resyncFinished()
return (result_redo, result_disable, result_sizeChange or psource_sizeChange)