Running the Tool

The conditions CommandLineTool can be run using the java command after Installing HPS Java.

java -cp ./distribution/target/hps-distribution-bin.jar org.hps.conditions.cli.CommandLineTool

This automatically generated run script may be used equivalently.

./distribution/target/appassembler/bin/conditions-cli.sh

In order to execute commands which update the conditions database, you will need to supply credentials for an account with the appropriate privileges.  This can be done by following the instructions in the conditions documentation.

Without any arguments the commands will print the basic usage information and then exit.

usage: CommandLineTool
Commands:
tag
run-summary
load
add
print
 -d,--detector <arg>     detector name
 -h,--help               print help
 -r,--run <arg>          run number
 -t,--tag <arg>          conditions tag to use for filtering records

Much like the git command, the conditions command line interface has sub-commands with their own command switches.

General Options Table

Short OptionLong OptionDescription
-d--detectorname of HPS Java detector to initialize
-r--runrun number for initialization (with detector)
-t--tagconditions tag for record filtering
-h--helpprint help and exit

These options should be provided before the sub-command, as in this example:

conditions-cli.sh -d HPS-dummy-detector -r 1234 [subcommand]

Options after the sub-command will be passed to that sub-command's parser and not processed as general options.

Commands

Tag Command

The tag command is used to make a conditions tag that can be used to filter records.

Tag  Options Table

Short OptionLong OptionDescription
-D--dont-promptdon't prompt before making tag (be careful!)
-t--tagname of tag
-s--run-startstart run number
-e--run-endend run number
-m--multipleaction for disambiguation of multiple valid records of the same type in the run
-h--helpprint help and exit

Here is a dummy example of using the tag command.

conditions-cli.sh tag -s 42 -e 1001 -m LAST_CREATED -t test-tag-1

Tagging requires write access to the database so connection properties must be provided to override the default read-only connection (see the documentation on the conditions system for details).

Run Summary Command

The run-summary command can print out conditions collections that will be used for a given run.

Run Summary Options Table

Short OptionLong OptionDescription
-a --allprint out collection records and not just summary information
-h--helpprint help and exit

To use this, command the -d and -r base options should be used to initialize the conditions system.

conditions-cli.sh -d HPS-dummy-detector -r 1234 run-summary

If this information is not provided then the conditions system cannot be initialized and an error will occur.

Load Command

The load command is used to insert new conditions collections into the database, without associating it with a run number (which is done using the add command).

Load Options Table

Short OptionLong OptionDescription
-h--helpprint help and exit
-f--fileCSV data to load (see below for format description)
-t--tabletarget table in the conditions database
-d--descriptiondescription in the log of this collection (can be left blank)

Here is an example of using the load command.

conditions-cli.sh load -d "adding new ECal calibrations" -f ecal_calibrations.txt -t ecal_calibrations

The data for formatting should be in CSV format similar to the following.

ecal_channel_id,pedestal,noise
1,123.40,3.45
[...]

The first row should contain column headers but the id and collection_id fields should always be omitted.

This command requires write access to the database so a connection properties file must be provided.

Add Command

The add command is used to associate an existing conditions collection with a range of run numbers via its collection ID.

Add Options Table

Short OptionLong OptionDescription
-c --collection

collection ID of the data

-r--run-startstarting run number
-e--run-end

ending run number

defaults to run start if not provided

-m--notesprovide notes about this conditions set
-t--tablename of conditions table in database
-u--useryour user name (computer account name is fine)
-h--helpprint help and exit

Here is an example of using the add command.

conditions-cli.sh add -c 1234 -s 5000 -e 5001 -m "ECal calibrations for 5000 and 5001" -t ecal_calibrations -u jeremym

This command requires write access to the database so a connection properties file must be provided.

The collection ID can be found by looking at the collection_id column in the individual data tables.  It is also printed out when using the load command to add new data.

Print Command

The print command is used to print out detailed collection information for a given run number.

Print Options Table

Short OptionLong OptionDescription
-h--help

print help and exit

-t--table

data table name

if not provided all collections for the run will be printed

-i--print-id

include the row ID in print outs

-f--file

instead of printing to screen write output to a CSV file

the -t option must also be provided or an error will occur

-H--no-headerdo not print collection header information
-h--helpprint help and exit

Here is an example of using print to show all collections from a run.

conditions-cli.sh -r 5000 -d HPS-EngRun2015-Nominal-v3 print

This command will save the given table data for the run to an output CSV file.

conditions-cli.sh -r 5000 -d HPS-EngRun2015-Nominal-v3 print -t ecal_calibrations -f ecal_calibrations_saved.txt

The print command requires that the base -r and -d options are provided to initialize the conditions system or an error will occur.

 

  • No labels