Search/Navigation:
Related:
SLAC/EPP/HPS Public
Jefferson Lab/Hall B/HPS Run Wiki
S30XL-LESA/LDMX
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.
Short Option | Long Option | Description |
---|---|---|
-d | --detector | name of HPS Java detector to initialize |
-r | --run | run number for initialization (with detector) |
-t | --tag | conditions tag for record filtering |
-h | --help | print 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.
The tag command is used to make a conditions tag that can be used to filter records.
Short Option | Long Option | Description |
---|---|---|
-D | --dont-prompt | don't prompt before making tag (be careful!) |
-t | --tag | name of tag |
-s | --run-start | start run number |
-e | --run-end | end run number |
-m | --multiple | action for disambiguation of multiple valid records of the same type in the run |
-h | --help | print 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).
The run-summary command can print out conditions collections that will be used for a given run.
Short Option | Long Option | Description |
---|---|---|
-a | --all | print out collection records and not just summary information |
-h | --help | print 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.
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).
Short Option | Long Option | Description |
---|---|---|
-h | --help | print help and exit |
-f | --file | CSV data to load (see below for format description) |
-t | --table | target table in the conditions database |
-d | --description | description 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.
The add command is used to associate an existing conditions collection with a range of run numbers via its collection ID.
Short Option | Long Option | Description |
---|---|---|
-c | --collection | collection ID of the data |
-r | --run-start | starting run number |
-e | --run-end | ending run number defaults to run start if not provided |
-m | --notes | provide notes about this conditions set |
-t | --table | name of conditions table in database |
-u | --user | your user name (computer account name is fine) |
-h | --help | print 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.
The print command is used to print out detailed collection information for a given run number.
Short Option | Long Option | Description |
---|---|---|
-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-header | do not print collection header information |
-h | --help | print 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.