當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。