Ejemplo n.º 1
0
def discover_blocks(options):
    # Get work directory, create dbs dump directory
    if os.path.isdir(options.args[0]):
        work_dn = os.path.abspath(os.path.normpath(options.args[0]))
    else:
        work_dn = gc_create_config(config_file=options.args[0]).get_work_path()
    if not options.opts.tempdir:
        options.opts.tempdir = os.path.join(work_dn, 'dbs')
    if not os.path.exists(options.opts.tempdir):
        os.mkdir(options.opts.tempdir)

    # get provider with dataset information
    config = gc_create_config(config_dict={'dataset': options.config_dict},
                              load_old_config=False)
    if options.opts.input_file:
        provider = DataProvider.create_instance('ListProvider', config,
                                                'dataset',
                                                options.opts.input_file)
    else:
        provider = DataProvider.create_instance('DBSInfoProvider', config,
                                                'dataset', options.args[0])

    blocks = provider.get_block_list_cached(show_stats=False)
    DataProvider.save_to_file(os.path.join(options.opts.tempdir, 'dbs.dat'),
                              blocks)
    if options.opts.discovery:
        sys.exit(os.EX_OK)
    return blocks
Ejemplo n.º 2
0
def discover_blocks(options):
	# Get work directory, create dbs dump directory
	if os.path.isdir(options.args[0]):
		work_dn = os.path.abspath(os.path.normpath(options.args[0]))
	else:
		work_dn = gc_create_config(config_file=options.args[0]).get_work_path()
	if not options.opts.tempdir:
		options.opts.tempdir = os.path.join(work_dn, 'dbs')
	if not os.path.exists(options.opts.tempdir):
		os.mkdir(options.opts.tempdir)

	# get provider with dataset information
	config = gc_create_config(config_dict={'dataset': options.config_dict}, load_old_config=False)
	if options.opts.input_file:
		provider = DataProvider.create_instance('ListProvider',
			config, 'dataset', options.opts.input_file)
	else:
		provider = DataProvider.create_instance('DBSInfoProvider',
			config, 'dataset', options.args[0])

	blocks = provider.get_block_list_cached(show_stats=False)
	DataProvider.save_to_file(os.path.join(options.opts.tempdir, 'dbs.dat'), blocks)
	if options.opts.discovery:
		sys.exit(os.EX_OK)
	return blocks
Ejemplo n.º 3
0
	def __init__(self, config, datasource_name):
		InfoScanner.__init__(self, config, datasource_name)
		source_dataset_path = config.get('source dataset path')
		self._source = DataProvider.create_instance('ListProvider', config,
			'source dataset', source_dataset_path)
Ejemplo n.º 4
0
 def __init__(self, config, datasource_name):
     InfoScanner.__init__(self, config, datasource_name)
     source_dataset_path = config.get('source dataset path')
     self._source = DataProvider.create_instance('ListProvider', config,
                                                 'source dataset',
                                                 source_dataset_path)