def datasets(args): if args.list: utils.pprint_json(utils.get_datasets()) elif args.show: ds = utils.get_datasets().get(args.show, None) if not ds: raise ValueError("Dataset not found.") utils.pprint_json(ds) elif args.search: search_datasets_for_string(args.search) elif args.download: ds_name, volume = args.download try: volume = float(volume) except ValueError: raise ValueError( "Volume has to be a valid number, not `{}`".format(volume)) if not utils.get_datasets().get(ds_name, False): raise ValueError("Dataset `{}` not found.".format(ds_name)) elif args.run_list: # is the given run list a subset of the full run list? user_run_list = [int(r.strip()) for r in args.run_list.split(",")] full_run_list = [ int(r.strip()) for r in utils.get_datasets().get(ds_name) ['run_list'].split(",") ] if not set(user_run_list).issubset(full_run_list): raise ValueError( "Run {} list is not a subset of this periods run list ({})!" .format(user_run_list, full_run_list)) utils.download_dataset(ds_name, volume, args.run_list)
def datasets(args): if args.list: _pprint_json(utils.get_datasets()) elif args.show: ds = utils.get_datasets().get(args.show, None) if not ds: raise ValueError("Dataset not found.") _pprint_json(ds) elif args.search: search_datasets_for_string(args.search) elif args.download: ds_name, volume = args.download try: volume = float(volume) except ValueError: raise ValueError("Volume has to be a valid number, not `{}`".format(volume)) if not utils.get_datasets().get(ds_name, False): raise ValueError("Dataset `{}` not found.".format(ds_name)) elif args.run_list: # is the given run list a subset of the full run list? user_run_list = [int(r.strip()) for r in args.run_list.split(",")] full_run_list = [int(r.strip()) for r in utils.get_datasets().get(ds_name)['run_list'].split(",")] if not set(user_run_list).issubset(full_run_list): raise ValueError("Run {} list is not a subset of this periods run list ({})!" .format(user_run_list, full_run_list)) utils.download_dataset(ds_name, volume, args.run_list)
def test_downloaded_something(self): utils.check_alien_token() utils.download_dataset("LHC10h_AOD160", 0.001)