DataDiscoveryCLI#
- class coffea.dataset_tools.dataset_query.DataDiscoveryCLI[source]#
Bases:
objectSimplifies dataset query, replicas, filters, and uproot preprocessing with Dask. It can be accessed in a Python script or interpreter via this class, or from the command line (as in
python -m coffea.dataset_tools.dataset_query --help).Attributes Summary
Methods Summary
do_allowlist_sites([sites])Restrict the grid sites available for replicas query only to the requested list
do_blocklist_sites([sites])Exclude grid sites from the available sites for replicas query
Print the selected files replicas for the selected dataset
Print a list of the selected datasets
do_login([proxy])Login to the rucio client.
do_preprocess([output_file, step_size, ...])Perform preprocessing for concrete fileset extraction into a file, compressed with gzip.
do_query([query])Look for datasets with * wildcards (like in DAS)
List the results of the last dataset query
do_regex_sites([regex])Select sites with a regex for replica queries: e.g. "T[123]_(FR|IT|BE|CH|DE)_w+".
do_replicas([mode, selection])Query Rucio for replicas.
do_save([filename])Save the replica information in yaml format
do_select([selection, metadata])Selected the datasets from the list of query results.
do_sites_filters([ask_clear])Show the active sites filters (allowed, disallowed, and regex) and ask to clear them
load_dataset_definition(dataset_definition)Initialize the DataDiscoverCLI by querying a set of datasets defined in
dataset_definitionsand selected results and replicas following the options.Attributes Documentation
- as_dict#
Methods Documentation
- do_allowlist_sites(sites=None)[source]#
Restrict the grid sites available for replicas query only to the requested list
- do_blocklist_sites(sites=None)[source]#
Exclude grid sites from the available sites for replicas query
- do_login(proxy=None)[source]#
Login to the rucio client. Optionally a specific proxy file can be passed to the command. If the proxy file is not specified,
voms-proxy-infois used
- do_preprocess(output_file=None, step_size=None, align_to_clusters=None, scheduler_url=None, recalculate_steps=None, files_per_batch=None, file_exceptions=(<class 'OSError'>, ), save_form=None, uproot_options={}, step_size_safety_factor=0.5, allow_empty_datasets=False)[source]#
Perform preprocessing for concrete fileset extraction into a file, compressed with gzip.
- Parameters:
output_file (
strorNone, defaultNone) – Target prefix for the generated*_available.json.gzand*_all.json.gzfiles.step_size (
intorNone, defaultNone) – Chunk size (number of events) to process per step.align_to_clusters (
boolorNone, defaultNone) – Whether to align step boundaries to ROOT cluster boundaries. Mirrors thealign_clustersargument ofcoffea.dataset_tools.preprocess.scheduler_url (
strorNone, defaultNone) – Dask scheduler URL on which to run preprocessing.recalculate_steps (
boolorNone, defaultNone) – Recompute step definitions even if cached values are present.files_per_batch (
intorNone, defaultNone) – Number of files to send to each preprocessing task.file_exceptions (
tuple[type[BaseException],], default(OSError,)) – Exceptions that should trigger file skipping instead of aborting.save_form (
boolorNone, defaultNone) – Persist the Awkward form extracted during preprocessing alongside the output.uproot_options (
dict, default{}) – Keyword arguments forwarded touprootwhen opening files.step_size_safety_factor (
float, default0.5) – Multiplicative safety factor applied when estimating step sizes.allow_empty_datasets (
bool, defaultFalse) – Whether to keep datasets that produce zero valid chunks.
- do_regex_sites(regex=None)[source]#
Select sites with a regex for replica queries: e.g. “T[123]_(FR|IT|BE|CH|DE)_w+”
- do_replicas(mode=None, selection=None)[source]#
Query Rucio for replicas.
- Parameters:
mode (
strorNone, defaultNone) –- Selection strategy for preferred sites. Options:
None: ask the user about the mode
round-robin (take files randomly from available sites),
choose: ask the user to choose from a list of sites
first: take the first site from the rucio query
selection (
strorNone, defaultNone) – Indices (or the literal"all") identifying datasets on which to run the replica query.
- do_select(selection=None, metadata=None)[source]#
Selected the datasets from the list of query results. Input a list of indices also with range 4-6 or “all”.
- do_sites_filters(ask_clear=True)[source]#
Show the active sites filters (allowed, disallowed, and regex) and ask to clear them
- load_dataset_definition(dataset_definition, query_results_strategy='all', replicas_strategy='round-robin')[source]#
Initialize the DataDiscoverCLI by querying a set of datasets defined in
dataset_definitionsand selected results and replicas following the options.- Parameters:
dataset_definition (
dict[str,dict[Hashable,Any]]) – Mapping from dataset query string to metadata to attach to the selection.query_results_strategy (
str, default"all") – How to decide which datasets to select. If “manual”, user will be prompted for selectionreplicas_strategy (
str, default"round-robin") –- Options are:
”round-robin”: select randomly from the available sites for each file
”choose”: filter the sites with a list of indices for all the files
”first”: take the first result returned by rucio
”manual”: to be prompt for manual decision dataset by dataset
- Returns:
out_replicas – An uproot-readable fileset. At this point, the fileset is not fully preprocessed, but this can be done with do_preprocess().
- Return type:
FilesetSpecOptional