Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Running the Tool

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

Code Block
languagebash
themeMidnight
java -cp ./distribution/target/hps-distribution-3.7-SNAPSHOT-bin.jar org.hps.conditions.cli.CommandLineTool

...

Code Block
languagebash
themeMidnight
./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.

No Format
usage: CommandLineTool
Commands:
tag
run-summary
load
add
print
 -d,--detector <arg>     detector name
 -h,--help               print help
 -p,--connection <arg>   database connection properties file
 -r,--run <arg>          run number
 -t,--tag <arg>          conditions tag to use for filtering records
 -x,--xml <arg>          conditions XML configuration file

Much like the svn or cvs commands, this 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
-x--xml

conditions XML config file (experts only)

-h--helpprint help and exit-p--connection

connection properties file

must be provided to override the default read-only connection if you want to update the database

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

Code Block
languagebash
themeMidnight
conditions-cli.sh tag -p myconnection.prop -d HPS-dummy-detector -r 1234 [subcommand]

...

Here is a dummy example of using the tag command.

Code Block
languagebash
themeMidnight
conditions-cli.sh tag -s 42 -e 1001 -m LAST_CREATED -t test-tag-1

Tagging requires write access to the database so a connection properties file 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.

...

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

Code Block
languagebash
themeMidnight
conditions-cli.sh tag -p myconnection.prop -d HPS-dummy-detector -r 1234 run-summary

...

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

a all out collection records and not just summary information
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)-h--helpprint help and exit

Here is an example of using the load command.

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

...

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.

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

...

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

Code Block
languagebash
themeMidnight
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.

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

...