CREST client examples
Examples for CREST client usage.
Compile and setup CREST Command Line Client (CrestCmd)
- Clone CrestApi package:
$ git clone https://gitlab.cern.ch/mmineev/CrestApi.git
- Clone CrestCmd package:
$ git clone https://gitlab.cern.ch/mmineev/CrestCmd.git
- Create a "build" directory:
$ mkdir ./build
- Copy a common CMakeLists.txt:
$ cp ./CrestApi/CMakeLists.txt-parent ./CMakeLists.txt
- Setup:
$ source ./CrestApi/setup.sh
- Compilation:
$ cd ./build $ cmake -Wno-dev .. $ make
- Setup for executables:
$ source ./x86_64-centos7-gcc8-opt/setup.sh
- To set a CREST_SERVER_PATH variable (CREST Server URL) use the command:
$ export CREST_SERVER_PATH=http://crest-01.cern.ch:8090
(or run the script: $ source ../CrestCmd/scripts/crest-setup.sh)
Get the crestCmd command list
$ crestCmd get commands
host=crest-01.cern.ch port8090
Command List:
- Get list methods:
crestCmd get tagList [OPTIONS]
crestCmd get globalTagList [OPTIONS]
crestCmd get globalTagMap [OPTIONS]
crestCmd get iovList [OPTIONS]
- Get methods:
crestCmd get tag [OPTIONS] crestCmd get tagMetaInfo [OPTIONS] crestCmd get globalTag [OPTIONS] crestCmd get blob [OPTIONS] crestCmd get payloadMetaInfo [OPTIONS] crestCmd get payloadTagInfo [OPTIONS]
- Create methods:
crestCmd create tag [OPTIONS] crestCmd create tagMetaInfo [OPTIONS] crestCmd create globalTag [OPTIONS] crestCmd create globalTagMap [OPTIONS] crestCmd create iovAndPayload [OPTIONS]
- Remove methods:
crestCmd remove tag [OPTIONS] crestCmd remove globalTag [OPTIONS]
Create a Global Tag
$ crestCmd create globalTag --tagName CREST-test --description test --release 1 --scenario test --type t --workflow T --validity 0 host=crest-01.cern.ch port8090
tagName = CREST-test description = test type = t release = 1 scenario = test workflow = T validity = 0 insertionTime = snapshotTime = js = { "description": "test", "name": "CREST-test", "release": "1", "scenario": "test", "type": "t", "validity": "0", "workflow": "T" } Global tag was created.
Create a tag
$ crestCmd create tag --tagName LARAlign-RUN2-UPD4-test --description "run-lumi<address_header service_type="71" clid="254546453" />DetCondKeyTrans" --timeType run-lumi --payloadSpec PoolRef:String4k host=crest-01.cern.ch port8090 Tag was created.
Create Global Tag mapping
$ crestCmd create globalTagMap --globalTagName CREST-test --tagName LARAlign-RUN2-UPD4-test --label /LAR/Align --record None host=crest-01.cern.ch port8090 Global tag map was created.
Create tag meta info
$ crestCmd create tagMetaInfo --tagName LARAlign-RUN2-UPD4-test --description "{"dbname":"CONDBR2","nodeFullpath":"/LAR/Align","schemaName":"COOLONL_LAR"}" --chansize 1 --colsize 1 --tagInfo "{"channel_list":[{"0":""}],"node_description":"run-lumi<address_header service_type=\"71\" clid=\"254546453\" />DetCondKeyTrans","payload_spec":"PoolRef:String4k\”}"
Create IOVs and payloads
$ crestCmd create iovAndPayload --tagName LARAlign-RUN2-UPD4-test --payload "[DB=26B208DE-79E8-E611-9796-02163E019096][CNT=CollectionTree(DetCondKeyTrans//LAR/Align)][CLID=A6DA54AC-D54E-4B6C-8489-C6D015277AD0][TECH=00000202][OID=00000003-00000000]" --since 1146343951171584 --endtime 0 host=crest-01.cern.ch port8090
Get Global Tag mapping
$ crestCmd get globalTagMap --globalTagName CREST-test
host=crest-01.cern.ch port8090
global tag map(CREST-test)= [ { "globalTagName": "CREST-test", "label": "label", "record": "None", "tagName": "LARAlign-RUN2-UPD4-test" } ]
Get tag meta info
$ crestCmd get tagMetaInfo --tagName LARAlign-RUN2-UPD4-test host=crest-01.cern.ch port8090
tagMetaInfo(LARAlign-RUN2-UPD4-test)= [ { "chansize": 1, "colsize": 1, "description": "{"dbname":"CONDBR2","nodeFullpath":"/LAR/Align","schemaName":"COOLONL_LAR"}", "insertionTime": "2022-07-05T13:40:47+0000", "tagInfo": "{"channel_list":[{"0":""}],"node_description":"run-lumi<address_header service_type=\"71\" clid=\"254546453\" />DetCondKeyTrans","payload_spec":"PoolRef:String4k"}", "tagName": "LARAlign-RUN2-UPD4-test" } ]
Get payload meta info
$ crestCmd get payloadMetaInfo --hash ad19a1b4ebce65eebbe7b9fa1f454016e0eebb93a42b69e7f639737de0230382 host=crest-01.cern.ch port8090 payloadMetaInfo ( ad19a1b4ebce65eebbe7b9fa1f454016e0eebb93a42b69e7f639737de0230382 ) = [ { "data": null, "hash": "ad19a1b4ebce65eebbe7b9fa1f454016e0eebb93a42b69e7f639737de0230382", "insertionTime": "2022-07-05T13:30:58+0000", "objectType": "iovs", "size": 170, "streamerInfo": "eyJmaWxlbmFtZSI6ImFkMTlhMWI0ZWJjZTY1ZWViYmU3YjlmYTFmNDU0MDE2ZTBlZWJiOTNhNDJiNjllN2Y2Mzk3MzdkZTAyMzAzODIiLCJmb3JtYXQiOiJpb3ZzIiwiaW5zZXJ0aW9uRGF0ZSI6IlR1ZSBKdWwgMDUgMTM6MzA6NTggR01UIDIwMjIifQ==", "version": "default" } ]
Get tag list
$ crestCmd get tagList --name LAR host=crest-01.cern.ch port8090 Tag list : : [ { "description": "run-lumi<address_header service_type="71" clid="254546453" />DetCondKeyTrans", "endOfValidity": 0, "insertionTime": "2022-05-26T12:10:39+0000", "lastValidatedTime": 0, "modificationTime": "2022-05-26T12:10:39+0000", "name": "LARAlign-RUN2-UPD4-03", "payloadSpec": "PoolRef:String4k", "synchronization": "none", "timeType": "run-lumi" }, { "description": "run-lumi<address_header service_type="71" clid="254546453" />DetCondKeyTrans", "endOfValidity": 0, "insertionTime": "2022-07-04T15:50:19+0000", "lastValidatedTime": 0, "modificationTime": "2022-07-05T13:30:59+0000", "name": "LARAlign-RUN2-UPD4-test", "payloadSpec": "PoolRef:String4k", "synchronization": "none", "timeType": "run-lumi" }, ...
Get payload tag info
$ crestCmd get payloadTagInfo --tagName LAR payloadTagInfo(LAR)= [ { "avgvolume": 189.0, "niovs": 5, "tagname": "LARAlign-RUN2-UPD4-03", "totvolume": 945.0 }, { "avgvolume": 99.333336, "niovs": 3, "tagname": "LARAlign-RUN2-UPD4-test", "totvolume": 298.0 }, ...