CLI Commands

The command line interface (CLI) allows certain management commands to be run on the command line. In addition to the commands below, you can also invoke invenio and flask CLI commands using the hepdata binary.

hepdata importer

Import from HepData website to a local instance.

hepdata importer [OPTIONS] COMMAND [ARGS]...

bulk-import-records

Populate the DB with records from HEPData.net (or another instance as specified by base_url)

Usage: hepdata importer bulk-import-records -u true -d 2020-01-01

hepdata importer bulk-import-records [OPTIONS]

Options

-d, --date <date>

Filter all records modified since some point in time, e.g. 2016-07-05 for the 5th July 2016.

-u, --update-existing <update_existing>

Whether to update records which already exist(defaults to False)

-b, --base-url <base_url>

Base URL from which to get data (defaults to https://hepdata.net)

-n, --n-latest <n_latest>

Get only the n most recently updated records

-e, --send-email <send_email>

Whether or not to send emails on finalising submissions

import-records

Populate the DB with specific records from HEPData.net (or another instance as specified by base_url)

Usage: hepdata importer import-records -i 'ins1262703' -rc False

hepdata importer import-records [OPTIONS]

Options

-i, --inspireids <inspireids>

A comma separated list of recids to load.

-rc, --recreate_index <recreate_index>

Whether or not to recreate the index before importing(defaults to False)

-u, --update-existing <update_existing>

Whether to update records which already exist(defaults to False)

-b, --base-url <base_url>

Base URL from which to get data (defaults to https://hepdata.net)

-e, --send-email <send_email>

Whether or not to send emails on finalising submissions

hepdata utils

Utils.

hepdata utils [OPTIONS] COMMAND [ARGS]...

clean-remaining-files

Deletes files that remain in data dir after cleanup and move-data-files have been run.

hepdata utils clean-remaining-files [OPTIONS]

cleanup-old-files

Deletes db entries and files that are no longer used

hepdata utils cleanup-old-files [OPTIONS]

create-mock-migrated-record

Populate the DB with a specific record which mimics a record migrated from hepdata.cedar.ac.uk. Accepts inspire ids 753951, 1299143, 1320775.

Usage: hepdata utils create-mock-migrated-record

hepdata utils create-mock-migrated-record [OPTIONS]

Options

-i, --inspire-id <inspire_id>

Inspire id to import

Options:

753951 | 1299143 | 1320775

-e, --send-email <send_email>

Whether or not to send emails on finalising submissions

execute

Execute a SQL query via SQLAlchemy Engine.

hepdata utils execute [OPTIONS]

Options

-q, --query <query>

SQL query to execute via SQLAlchemy Engine.

find-and-add-record-analyses

Finds analyses such as Rivet and MadAnalysis 5 and adds them to records.

hepdata utils find-and-add-record-analyses [OPTIONS]

Options

-e, --endpoint <endpoint>

Specific endpoint to update (e.g. “rivet” or “MadAnalysis”). Omit for all.

find-duplicates-and-remove

Will go through the application to find any duplicates then remove them.

hepdata utils find-duplicates-and-remove [OPTIONS]

Options

-b, --base-url <base_url>

Base URL from which to get data (defaults to https://hepdata.net)

get-data-path

Gets the file path where data files for the given record are stored.

hepdata utils get-data-path [OPTIONS]

Options

-r, --record-id <record_id>

Record id for which to get information

-i, --inspire-id <inspire_id>

Inspire id for which to get information

move-data-files

Move data files into new data file locations. Deletes converted files for all records.

hepdata utils move-data-files [OPTIONS]

Options

-r, --recids <recids>

Move data files for specific recids only.

reindex

hepdata utils reindex [OPTIONS]

Options

-rc, --recreate <recreate>

Whether or not to recreate the index mappings as well. This DELETES the entire index first.

-u, --update-mapping <update_mapping>

Whether or not to update the index mapping as well.

-s, --start <start>

Starting recid for the index operation.

-e, --end <end>

End recid for the index operation.

-b, --batch <batch>

Number of submissions to index at a time.

send-email

Send finalised email announcing that records have been added or revised (in case it wasn’t done automatically).

hepdata utils send-email [OPTIONS]

Options

-i, --inspireids <inspireids>

Specific Inspire IDs of records to send finalised email for.

send-tweet

Send tweet announcing that records have been added or revised (in case it wasn’t done automatically).

hepdata utils send-tweet [OPTIONS]

Options

-i, --inspireids <inspireids>

Specific INSPIRE IDs of records to be tweeted.

unload

Remove records given their HEPData IDs from the database. Removes all database entries and corresponding files.

hepdata utils unload [OPTIONS]

Options

-r, --recids <recids>

Unload specific recids from the system.

hepdata doi-utils

DOI utils.

hepdata doi-utils [OPTIONS] COMMAND [ARGS]...

register-doi

Register DOI for a single submission defined by the INSPIRE ID and version.

hepdata doi-utils register-doi [OPTIONS]

Options

-i, --inspire_id <inspire_id>

Specify inspire id of submission to generate the DOI for.

-v, --version <version>

Specify version of submission to generate the DOI for.

register-dois

Register DOIs for a comma-separated list of INSPIRE IDs.

hepdata doi-utils register-dois [OPTIONS]

Options

-i, --inspire_ids <inspire_ids>

Specify inspire ids of submissions to generate the DOIs for.

-s, --start_recid <start_recid>

Starting recid if looping over submissions.

-e, --end_recid <end_recid>

End recid if looping over submissions.

register-table-dois

Register DOIs for a comma-separated list of table DOIs.

hepdata doi-utils register-table-dois [OPTIONS]

Options

-t, --table_dois <table_dois>

Specify DOIs of individual tables.

hepdata converter

Converter utils.

hepdata converter [OPTIONS] COMMAND [ARGS]...

prefetch-converted-files

Goes through all HEPData submissions and creates their YAML, ROOT, CSV, and YODA representations. This avoids any wait time for users when trying to retrieve converted files. NOTE: Does not pre-fetch all individual files, since this would be too much and probably not necessary.

hepdata converter prefetch-converted-files [OPTIONS]

Options

-i, --inspire_ids <inspire_ids>

Specify INSPIRE IDs of submissions to generate the cached files for.

-f, --force <force>

Force re-creation of converted files.

-t, --targets <targets>

Specify file type of conversions as comma-separated string.

hepdata submissions

Submissions.

hepdata submissions [OPTIONS] COMMAND [ARGS]...

reindex

Reindexes HEPSubmissions and adds to the submission index.

hepdata submissions reindex [OPTIONS]

write-stats-to-files

Writes some statistics on number of submissions per Coordinator to files.

hepdata submissions write-stats-to-files [OPTIONS]

hepdata inspire

INSPIRE utils to update publication information.

hepdata inspire [OPTIONS] COMMAND [ARGS]...

cli-update-all-records-info

Update publication information from INSPIRE for all records.

hepdata inspire cli-update-all-records-info [OPTIONS]

cli-update-record-info

Update publication information from INSPIRE for a specific record.

hepdata inspire cli-update-record-info [OPTIONS]

Options

-i, --inspire_id <inspire_id>

Required Specify Inspire ID of record to update.

-e, --send_email <send_email>

Whether or not to send email about update.

cli-update-records-info-on

Update publication information from INSPIRE for all records updated on a certain date.

hepdata inspire cli-update-records-info-on [OPTIONS]

Options

-d, --date <date>

Required Specify date on which to update records.

cli-update-records-info-since

Update publication information from INSPIRE for all records updated since a certain date.

hepdata inspire cli-update-records-info-since [OPTIONS]

Options

-d, --date <date>

Required Specify date since when to update records.

hepdata fix

Group of commands for temporary fixes, e.g. to fix issues from old migrated files, or previous bugs.

To add a new fix command, create a new module in the fixes directory (in the same directory as the hepdata package) with a method annotated with @fix.command().

To see the list of available fix commands, use: hepdata fix --help

hepdata fix [OPTIONS] COMMAND [ARGS]...