当前位置: 首页>>代码示例>>Python>>正文


Python DataProvider.createInstance方法代码示例

本文整理汇总了Python中grid_control.datasets.DataProvider.createInstance方法的典型用法代码示例。如果您正苦于以下问题:Python DataProvider.createInstance方法的具体用法?Python DataProvider.createInstance怎么用?Python DataProvider.createInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在grid_control.datasets.DataProvider的用法示例。


在下文中一共展示了DataProvider.createInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getEntries

# 需要导入模块: from grid_control.datasets import DataProvider [as 别名]
# 或者: from grid_control.datasets.DataProvider import createInstance [as 别名]
	def getEntries(self, path, metadata, events, seList, objStore):
		datacachePath = os.path.join(objStore.get('GC_WORKDIR', ''), 'datacache.dat')
		source = utils.QM((self._source == '') and os.path.exists(datacachePath), datacachePath, self._source)
		if source and (source not in self._lfnMap):
			pSource = DataProvider.createInstance('ListProvider', createConfig(), source)
			for (n, fl) in imap(lambda b: (b[DataProvider.Dataset], b[DataProvider.FileList]), pSource.getBlocks()):
				self._lfnMap.setdefault(source, {}).update(dict(imap(lambda fi: (self.lfnTrans(fi[DataProvider.URL]), n), fl)))
		pList = set()
		for key in ifilter(lambda k: k in metadata, self._parentKeys):
			pList.update(imap(lambda pPath: self._lfnMap.get(source, {}).get(self.lfnTrans(pPath)), metadata[key]))
		metadata['PARENT_PATH'] = lfilter(identity, pList)
		yield (path, metadata, events, seList, objStore)
开发者ID:thomas-mueller,项目名称:grid-control,代码行数:14,代码来源:scanner_basic.py

示例2: discover_blocks

# 需要导入模块: from grid_control.datasets import DataProvider [as 别名]
# 或者: from grid_control.datasets.DataProvider import createInstance [as 别名]
def discover_blocks(options):
	# Get work directory, create dbs dump directory
	if os.path.isdir(options.args[0]):
		workDir = os.path.abspath(os.path.normpath(options.args[0]))
	else:
		workDir = getConfig(configFile = options.args[0]).getWorkPath()
	if not options.opts.tempdir:
		options.opts.tempdir = os.path.join(workDir, 'dbs')
	if not os.path.exists(options.opts.tempdir):
		os.mkdir(options.opts.tempdir)

	# get provider with dataset information
	if options.opts.input_file:
		provider = DataProvider.createInstance('ListProvider', getConfig(), options.opts.input_file, None)
	else:
		config = getConfig(configDict = {'dataset': options.config_dict})
		provider = DataProvider.createInstance('DBSInfoProvider', config, options.args[0], None)

	blocks = provider.getBlocks(show_stats = False)
	DataProvider.saveToFile(os.path.join(options.opts.tempdir, 'dbs.dat'), blocks)
	if options.opts.discovery:
		sys.exit(os.EX_OK)
	return blocks
开发者ID:Fra-nk,项目名称:grid-control,代码行数:25,代码来源:datasetDBS3Add.py

示例3: imap

# 需要导入模块: from grid_control.datasets import DataProvider [as 别名]
# 或者: from grid_control.datasets.DataProvider import createInstance [as 别名]
	selected = JobSelector.create(opts.job_selector, task = task)
	logging.info('Matching jobs: ' + str.join(' ', imap(str, jobDB.getJobsIter(selected))))
	if opts.job_reset_attempts:
		jobs_reset_attempts(jobDB, selected)
	if opts.job_force_state:
		jobs_force_state(opts, jobDB, selected)
	if opts.job_show_jdl:
		jobs_show_jdl(jobDB, selected)

########################################################
# DATASET INFOS

if opts.dataset_show_diff:
	if len(args) != 2:
		utils.exitWithUsage('%s <dataset source 1> <dataset source 2>' % sys.argv[0])
	a = DataProvider.createInstance('ListProvider', config, args[0], None)
	b = DataProvider.createInstance('ListProvider', config, args[1], None)
	(blocksAdded, blocksMissing, blocksChanged) = DataProvider.resyncSources(a.getBlocks(show_stats = False), b.getBlocks(show_stats = False))
	utils.printTabular([(DataProvider.Dataset, 'Dataset'), (DataProvider.BlockName, 'Block')], blocksMissing)

if opts.dataset_show_removed:
	if len(args) < 2:
		utils.exitWithUsage('%s <dataset source 1> <dataset source 2> ... <dataset source N> ' % sys.argv[0])
	removed = []
	oldDP = DataProvider.createInstance('ListProvider', config, args[0], None)
	for new in args[1:]:
		newDP = DataProvider.createInstance('ListProvider', config, new, None)
		(blocksAdded, blocksMissing, blocksChanged) = DataProvider.resyncSources(oldDP.getBlocks(show_stats = False), newDP.getBlocks(show_stats = False))
		for block in blocksMissing:
			tmp = dict(block)
			tmp[-1] = new
开发者ID:Fra-nk,项目名称:grid-control,代码行数:33,代码来源:debugTool.py

示例4: __init__

# 需要导入模块: from grid_control.datasets import DataProvider [as 别名]
# 或者: from grid_control.datasets.DataProvider import createInstance [as 别名]
	def __init__(self, config):
		InfoScanner.__init__(self, config)
		dsPath = config.get('source dataset path')
		self._source = DataProvider.createInstance('ListProvider', config, dsPath)
开发者ID:thomas-mueller,项目名称:grid-control,代码行数:6,代码来源:scanner_basic.py


注:本文中的grid_control.datasets.DataProvider.createInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。