ATLAS Offline Software
Functions | Variables
crest_example.cxx File Reference

Main file. More...

#include <iostream>
#include <fstream>
#include <iomanip>
#include <nlohmann/json.hpp>
#include <CrestApi/CrestApiExt.h>
#include <filesystem>
#include <CrestApi/picosha2.h>
#include "CxxUtils/checker_macros.h"
Include dependency graph for crest_example.cxx:

Go to the source code of this file.

Functions

void print_path ()
 
bool createDirTree (const std::string &full_path)
 
void testCreateTag (const std::string &tagname)
 
void testCreateTag2 ()
 
void testCreateTagF (const std::string &tagname)
 
void testListTags ()
 
void testListTagsParams ()
 
void testListTagsParams (const std::string &name)
 
void testFindTag (const std::string &tagname)
 
void testRemoveTag (const std::string &tagname)
 
void testUpdateTag (const std::string &tagname)
 
void testUpdateTagSpecification (const std::string &tagname)
 
void testCreateGlobalTag (const std::string &tagname)
 
void testFindGlobalTag (const std::string &tagname)
 
void testListGlobalTags ()
 
void testListGlobalTagsAsString ()
 
void testListGlobalTagsParams (const std::string &name, int size, int page)
 
void testRemoveGlobalTag (const std::string &tagname)
 
void testUpdateGlobalTag (const std::string &tagname)
 
void testFindGlobalTagAsString (const std::string &tagname)
 
void testCreateRunLumiInfo ()
 
void testCreateRunLumiInfo2 ()
 
void testListRunLumiInfo ()
 
void testFindGlobalTagMap (const std::string &mapname)
 
void testCreateGlobalTagMap (const std::string &globaltag, const std::string &tagname)
 
void testGetJson ()
 
void testStorePayload (const std::string &tagname)
 
void testStorePayloadDump (const std::string &tagname)
 
void testFindAllIovs (const std::string &tagname)
 
void testFindAllIovsParams (const std::string &tagname, int size, int page)
 
void testFindAllIovsFS (const std::string &tagname)
 
void testFindAllIovsFSPlus (const std::string &tagname, int size, int page)
 
void testSelectIovsParams (const std::string &tagname, long since, long until)
 
void testSelectIovsFS (const std::string &tagname, long since, long until)
 
void testSelectIovs (const std::string &tagname)
 
void testSelectIovs (const std::string &tagname, long since, long until, long snapshot)
 
void testSelectGroups (const std::string &tagname)
 
void testCreateTagMetaInfo (const std::string &tagname)
 
void testCreateTagMetaInfo2Args (const std::string &tagname)
 
void testCreateTagMetaInfo2 (const std::string &tagname)
 
void testCreateTagMetaInfoDetailed (const std::string &tagname)
 
void testGetTagMetaInfo (const std::string &tagname)
 
void testUpdateTagMetainfo (const std::string &tagname)
 
void testCreateTagMetaInfoIOVDbSvc (const std::string &tagname)
 
void testGetTagMetaInfoIOVDbSvc (const std::string &tagname)
 
void testConvertTagMetaInfo2CREST ()
 
void testListPayloadTagInfo ()
 
void testListPayloadTagInfo (const std::string &tagname)
 
void testGetBlobInStream (const std::string &hash)
 
void testGetBlob (const std::string &hash)
 
void testGetPayloadAsJson (const std::string &hash)
 
void testGetPayloadAsString (const std::string &hash)
 
void testGetPayloadMetaInfoAsString (const std::string &hash)
 
void testGetPayloadMetaInfo (const std::string &hash)
 
void testCreateTagMetaInfoDetailedFs (const std::string &tagname)
 
void testGetTagMetaInfoFs (const std::string &tagname)
 
void testUpdateTagMetaInfoFs (const std::string &tagname)
 
void testFindTagFs (const std::string &tagname)
 
void testCreateTagFs (const std::string &tagname)
 
void testStoreBatchPayloadsFs (const std::string &tagname)
 
void testCreateGlobalTagFs (const std::string &tagname)
 
void testFindGlobalTagFs (const std::string &tagname)
 
void testCreateGlobalTagMapFs (const std::string &globaltag, const std::string &tagname)
 
void testFindGlobalTagMapFs (const std::string &tagname)
 
void testGetHash (const std::string &str)
 
void hashCalculationTest (const std::string &str)
 
void testCreateGlobalTag (const std::string &tagname, const std::string &description)
 
void testCreateGlobalTagMap (const std::string &globaltag, const std::string &tagname, const std::string &record, const std::string &label)
 
void testGetDateAndTime ()
 
void testGetPayloadAsStringFS (const std::string &hash)
 
void testGetPayloadAsJsonFS (const std::string &hash)
 
void testGetPayloadMetaInfoAsStringFS (const std::string &hash)
 
void testGetPayloadMetaInfoAsJsonFS (const std::string &hash)
 
void testGetBlobInStreamFS (const std::string &hash)
 
void testGetBlobFS (const std::string &hash)
 
void testReturnJArray ()
 
void testStoreBatchPayloads (const std::string &tagname)
 
void testStoreBatchPayloadsB (const std::string &tagname)
 
void testTagAndStoreBatchFsNItems (const std::string &tagname, int n)
 
void testTagAndStoreBatchFs (const std::string &tagname)
 
void testTagAndStoreBatchFsB (const std::string &tagname)
 
void testGetSize (const std::string &tagname)
 
void testGetSizeFS (const std::string &tagname)
 
void test01 ()
 
void testGetTagDataInfo (const std::string &tagname)
 
void testGetFirstLetters (const std::string &str)
 
void testCreateIOV (const std::string &tagname1, const std::string &tagname2)
 
void testStoreBatchIOVs (const std::string &tagname1, const std::string &tagname2)
 
void testGetMgmtInfo ()
 
void testGetCrestVersion ()
 
void testGetClientVersion ()
 
void testGetMajorVersion ()
 
void testCheckCrestVersion ()
 
void testGetCrestVersion2 ()
 
void testCheckCrestVersion2 ()
 
void testConstructor ()
 
void testRemoveTagFromGlobalTagMap (const std::string &global_tag)
 
void testStoreBatchPayloadsFiles (const std::string &tagname)
 
void testStoreData (const std::string &tagname)
 
void testStoreDataArray (const std::string &tagname)
 
void testCreateGlobalTagMap2 (const std::string &globaltag, const std::string &tagname)
 
void testSelectGroups2 (const std::string &tagname, int groupsize)
 
int main (int argc, char *argv[])
 

Variables

 ATLAS_NO_CHECK_FILE_THREAD_SAFETY
 
std::string SURL = "http://crest-01.cern.ch:8090"
 

Detailed Description

Main file.

This file contains the examples for the CREST C++ Client Library. Main part of the examples is commented. Pl testCreateGlobalTagMapFsease uncomment the code you need. Check and correct (if it is necessary) the CREST Server parameters in CrestClient instances.

Definition in file crest_example.cxx.

Function Documentation

◆ createDirTree()

bool createDirTree ( const std::string &  full_path)

Definition at line 33 of file crest_example.cxx.

33  {
34  size_t pos = 0;
35  bool ret_val = true;
36 
37  while (ret_val == true && pos != std::string::npos) {
38  pos = full_path.find('/', pos + 1);
39  ret_val = std::filesystem::create_directory(full_path.substr(0, pos));
40  }
41 
42  return ret_val;
43 }

◆ hashCalculationTest()

void hashCalculationTest ( const std::string &  str)

Definition at line 1481 of file crest_example.cxx.

1481  {
1482  std::cout << "Hash(" << str << ") = ";
1483  std::string hash_hex_str = picosha2::hash256_hex_string(str.begin(), str.end());
1484  std::cout << hash_hex_str << std::endl;
1485 }

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 2559 of file crest_example.cxx.

2559  {
2560  if (argc == 2) {
2561 
2562  SURL = argv[1];
2563  print_path();
2564 
2565  // TO RUN TEST UNCOMMENT IT!
2566  // (and check parameters!)
2567 
2568  std::string tagname = "test_tag_01"; // write your tag name
2569 
2570  // Test: tag crestion, tag reading and removing.
2571 
2572  // testRemoveTag(tagname); // remove tag if it exist
2576 
2577  // Test: tag creation, IOVs and payloads storing.
2578  /*
2579  testRemoveTag(tagname);
2580  testCreateTag(tagname);
2581  testFindAllIovs(tagname);
2582  testStoreBatchPayloadsB(tagname); // new test
2583  // testStoreBatchPayloads(tagname); // old test
2584  testFindTag(tagname);
2585  testFindAllIovs(tagname);
2586  testRemoveTag(tagname);
2587  */
2588 
2589 
2590  // Test: tag and global tag creation.
2591  /*
2592  testRemoveTag(tagname);
2593  testCreateTag(tagname);
2594  testCreateGlobalTag("MvG_TEST_01");
2595  testFindGlobalTag("MvG_TEST_01");
2596  testCreateGlobalTagMap("MvG_TEST_01",tagname);
2597  testFindGlobalTagMap("MvG_TEST_01");
2598 
2599  testRemoveGlobalTag("MvG_TEST_01");
2600  testFindGlobalTag("MvG_TEST_01");
2601  testFindGlobalTagMap("MvG_TEST_01");
2602  */
2603 
2604 
2605  // Test: tag meta info creation.
2606  /*
2607  testRemoveTag(tagname);
2608  testCreateTag(tagname);
2609  testCreateTagMetaInfo(tagname);
2610  // testCreateTagMetaInfo2(tagname); // variant 2
2611  testGetTagMetaInfo(tagname);
2612  testUpdateTagMetainfo(tagname);
2613  testGetTagMetaInfo(tagname);
2614  testRemoveTag(tagname);
2615  */
2616 
2617 
2618  } else {
2619  std::cout << "CREST Server path not found" << std::endl;
2620  std::cout << "Please, run this program with a server path:" << std::endl;
2621  std::cout << "crest_example http://crest-undertow-api.web.cern.ch" << std::endl;
2622  }
2623  std::cout << "Test ended" << std::endl;
2624  return 0;
2625 }

◆ print_path()

void print_path ( )

Definition at line 29 of file crest_example.cxx.

29  {
30  std::cout << SURL << std::endl;
31 }

◆ test01()

void test01 ( )

Definition at line 1909 of file crest_example.cxx.

1909  {
1910  map<std::string, std::string> m;
1911  m["key1"] = "val1";
1912 
1913  map <std::string, std::string> :: iterator it = m.begin();
1914  cout << "Map Listing 1: " << endl;
1915  for (int i = 0; it != m.end(); ++it, ++i) { // Output
1916  cout << i << ") key: " << it->first << ", value: " << it->second << endl;
1917  }
1918 
1919  bool rewrite = true;
1920  CrestClient myCrestClient = CrestClient(rewrite);
1921  nlohmann::json iovs = myCrestClient.findAllIovsFs("MvG_01");
1922  std::cout << "IOV List = " << std::endl << iovs.dump(4) << std::endl;
1923 
1924  int length = iovs.size();
1925  std::cout << "IOV number = " << length << std::endl;
1926  for (int i = 0; i < length; i++) {
1927  std::cout << "item (" << i << ") = " << std::endl << iovs[i].dump(4) << std::endl;
1928 
1929  auto r = iovs[i].find("payloadHash");
1930  if (r != iovs[i].end()) {
1931  std::string hash = iovs[i].value("payloadHash", "NONE");
1932  std::cout << "hash = " << hash << std::endl;
1933  std::cout << "iov = " << iovs[i].dump() << std::endl;
1934  m[hash] = iovs[i].dump();
1935  }
1936  }
1937 
1938  it = m.begin();
1939  cout << "Map Listing 2: " << endl;
1940  for (int i = 0; it != m.end(); ++it, ++i) { // Output
1941  cout << i << ") key: " << it->first << ", value: " << it->second << endl;
1942  }
1943 }

◆ testCheckCrestVersion()

void testCheckCrestVersion ( )

Definition at line 2295 of file crest_example.cxx.

2295  {
2296  std::cout << std::endl << "test: checkCrestVersion" << std::endl;
2297  CrestClient myCrestClient = CrestClient(SURL,false);
2298 
2299  try {
2300  myCrestClient.checkCrestVersion();
2301  std::cout << "test is OK." << std::endl;
2302  }
2303  catch (const std::exception& e) {
2304  std::cout << std::endl << "test: checkCrestVersion (failed)" << std::endl;
2305  std::cout << e.what() << std::endl;
2306  }
2307 }

◆ testCheckCrestVersion2()

void testCheckCrestVersion2 ( )

Definition at line 2326 of file crest_example.cxx.

2326  {
2327  std::cout << std::endl << "test: checkCrestVersion2" << std::endl;
2328  CrestClient myCrestClient = CrestClient(SURL,false);
2329 
2330  try {
2331  myCrestClient.checkCrestVersion2();
2332  std::cout << "test is OK." << std::endl;
2333  }
2334  catch (const std::exception& e) {
2335  std::cout << std::endl << "test: checkCrestVersion2 (failed)" << std::endl;
2336  std::cout << e.what() << std::endl;
2337  }
2338 }

◆ testConstructor()

void testConstructor ( )

Definition at line 2340 of file crest_example.cxx.

2340  {
2341  std::cout << std::endl << "test: testConstructor" << std::endl;
2342  CrestClient myCrestClient = CrestClient(SURL,false);
2343 
2344 }

◆ testConvertTagMetaInfo2CREST()

void testConvertTagMetaInfo2CREST ( )

Definition at line 1023 of file crest_example.cxx.

1023  {
1024  std::cout << std::endl << "test: convertTagMetaInfo2CREST" << std::endl;
1025  CrestClient myCrestClient = CrestClient(SURL,false);
1026 
1027  std::string tagname = "test_MvG4";
1028 
1029  nlohmann::json channel1 = {{"0", "ATLAS_PREFERRED0"}};
1030  nlohmann::json channel2 = {{"1", "ATLAS_PREFERRED1"}};
1031 
1032  nlohmann::json chanList = nlohmann::json::array({channel1, channel2});
1033 
1034  nlohmann::json tagInfo =
1035  {
1036  {"channel_list", chanList},
1037  {"node_description", "description of the node"},
1038  {"payload_spec",
1039  "AlgorithmID:UInt32,LBAvInstLumi:Float,LBAvEvtsPerBX:Float,LumiType:UInt32,Valid:UInt32,BunchInstLumi:Blob64k"}
1040  };
1041 
1042  std::cout << std::endl << "tagInfo = " << std::endl
1043  << tagInfo.dump(4) << std::endl;
1044 
1045  try{
1046  nlohmann::json res = myCrestClient.convertTagMetaInfo2CREST(tagInfo);
1047  std::cout << std::endl
1048  << "Tag Meta Info in CREST format = " << res.dump(4) << std::endl;
1049  }
1050  catch (const std::exception& e) {
1051  std::cout << std::endl << "test: convertTagMetaInfo2CREST (failed)" << std::endl;
1052  std::cerr << e.what() << std::endl;
1053  }
1054 }

◆ testCreateGlobalTag() [1/2]

void testCreateGlobalTag ( const std::string &  tagname)

Definition at line 266 of file crest_example.cxx.

266  {
267  std::cout << std::endl << "test: createGlobalTag" << std::endl;
268  CrestClient myCrestClient = CrestClient(SURL,false);
269 
270  nlohmann::json js =
271  {
272  {"name", tagname},
273  {"validity", 0},
274  {"description", "test"},
275  {"release", "1"},
276  {"insertionTime", "2018-12-18T11:32:58.081+0000"},
277  {"snapshotTime", "2018-12-18T11:32:57.952+0000"},
278  {"scenario", "test"},
279  {"workflow", "M"},
280  {"type", "t"},
281  {"snapshotTimeMilli", "null"},
282  {"insertionTimeMilli", "null"}
283  };
284 
285  try {
286  myCrestClient.createGlobalTag(js);
287  std::cout << std::endl << "test: createGlobalTag (success) " << std::endl;
288  }
289  catch (const std::exception& e) {
290  std::cout << std::endl << "test: createGlobalTag (failed)" << std::endl;
291  std::cout << e.what() << std::endl;
292  }
293 }

◆ testCreateGlobalTag() [2/2]

void testCreateGlobalTag ( const std::string &  tagname,
const std::string &  description 
)

Definition at line 1489 of file crest_example.cxx.

1489  {
1490  std::cout << std::endl << "test: createGlobalTag (2 parameters)" << std::endl;
1491  CrestClient myCrestClient = CrestClient(SURL,false);
1492 
1493  try {
1494  myCrestClient.createGlobalTag(tagname, description);
1495  std::cout << std::endl << "test: createGlobalTag (success) (2 parameters)" << std::endl;
1496  }
1497  catch (const std::exception& e) {
1498  std::cout << std::endl << "test: createGlobalTag (failed) (2 parameters)" << std::endl;
1499  std::cout << e.what() << std::endl;
1500  }
1501 }

◆ testCreateGlobalTagFs()

void testCreateGlobalTagFs ( const std::string &  tagname)

Definition at line 1384 of file crest_example.cxx.

1384  {
1385  std::cout << std::endl << "test: createGlobalTagFs" << std::endl;
1386 
1387  bool rewrite = true;
1388  CrestClient myCrestClient = CrestClient(rewrite);
1389 
1390  nlohmann::json js =
1391  {
1392  {"name", tagname},
1393  {"validity", 0},
1394  {"description", "test"},
1395  {"release", "1"},
1396  {"insertionTime", "2018-12-18T11:32:58.081+0000"},
1397  {"snapshotTime", "2018-12-18T11:32:57.952+0000"},
1398  {"scenario", "test"},
1399  {"workflow", "M"},
1400  {"type", "t"},
1401  {"snapshotTimeMilli", "null"},
1402  {"insertionTimeMilli", "null"}
1403  };
1404 
1405  try {
1406  myCrestClient.createGlobalTagFs(js);
1407  std::cout << std::endl << "test: createGlobalTagFs (success) " << std::endl;
1408  }
1409  catch (const std::exception& e) {
1410  std::cout << std::endl << "test: createGlobalTagFs (failed)" << std::endl;
1411  std::cout << e.what() << std::endl;
1412  }
1413 }

◆ testCreateGlobalTagMap() [1/2]

void testCreateGlobalTagMap ( const std::string &  globaltag,
const std::string &  tagname 
)

Definition at line 539 of file crest_example.cxx.

539  {
540  std::cout << std::endl << "test: createGlobalTagMap" << std::endl;
541  CrestClient myCrestClient = CrestClient(SURL,false);
542 
543  nlohmann::json js =
544  {
545  {"globalTagName", globaltag},
546  {"record", "testing2"},
547  {"label", "test2"},
548  {"tagName", tagname}
549  };
550 
551  try{
552  myCrestClient.createGlobalTagMap(js);
553  std::cout << std::endl << "test: createGlobalTagMap (success) " << std::endl;
554  }
555  catch (const std::exception& e) {
556  std::cout << std::endl << "test: createGlobalTagMap (failed)" << std::endl;
557  std::cout << e.what() << std::endl;
558  }
559 }

◆ testCreateGlobalTagMap() [2/2]

void testCreateGlobalTagMap ( const std::string &  globaltag,
const std::string &  tagname,
const std::string &  record,
const std::string &  label 
)

Definition at line 1504 of file crest_example.cxx.

1505  {
1506  std::cout << std::endl << "test: createGlobalTagMap (all parameters)" << std::endl;
1507  CrestClient myCrestClient = CrestClient(SURL,false);
1508 
1509  nlohmann::json js =
1510  {
1511  {"globalTagName", globaltag},
1512  {"record", record},
1513  {"label", label},
1514  {"tagName", tagname}
1515  };
1516 
1517  try{
1518  myCrestClient.createGlobalTagMap(js);
1519  std::cout << std::endl << "test: createGlobalTagMap (all parameters) (success) " << std::endl;
1520  }
1521  catch (const std::exception& e) {
1522  std::cout << std::endl << "test: createGlobalTagMap (all parameters) (failed)" << std::endl;
1523  std::cout << e.what() << std::endl;
1524  }
1525 }

◆ testCreateGlobalTagMap2()

void testCreateGlobalTagMap2 ( const std::string &  globaltag,
const std::string &  tagname 
)

Definition at line 2521 of file crest_example.cxx.

2521  {
2522  std::cout << std::endl << "test: createGlobalTagMap" << std::endl;
2523  CrestClient myCrestClient = CrestClient(SURL,false);
2524 
2525  nlohmann::json js =
2526  {
2527  {"globalTagName", globaltag},
2528  {"record", "testing3"},
2529  {"label", "test3"},
2530  {"tagName", tagname}
2531  };
2532 
2533  try{
2534  myCrestClient.createGlobalTagMap(js);
2535  std::cout << std::endl << "test: createGlobalTagMap (success) " << std::endl;
2536  }
2537  catch (const std::exception& e) {
2538  std::cout << std::endl << "test: createGlobalTagMap (failed)" << std::endl;
2539  std::cout << e.what() << std::endl;
2540  }
2541 }

◆ testCreateGlobalTagMapFs()

void testCreateGlobalTagMapFs ( const std::string &  globaltag,
const std::string &  tagname 
)

Definition at line 1433 of file crest_example.cxx.

1433  {
1434  std::cout << std::endl << "test: createGlobalTagMapFs" << std::endl;
1435  bool rewrite = true;
1436  CrestClient myCrestClient = CrestClient(rewrite);
1437 
1438  nlohmann::json js =
1439  {
1440  {"globalTagName", globaltag},
1441  {"record", "testing2"},
1442  {"label", "test2"},
1443  {"tagName", tagname}
1444  };
1445 
1446  try{
1447  myCrestClient.createGlobalTagMapFs(js);
1448  std::cout << std::endl << "test: createGlobalTagMapFs (success) " << std::endl;
1449  }
1450  catch (const std::exception& e) {
1451  std::cout << std::endl << "test: createGlobalTagMapFs (failed)" << std::endl;
1452  std::cout << e.what() << std::endl;
1453  }
1454 }

◆ testCreateIOV()

void testCreateIOV ( const std::string &  tagname1,
const std::string &  tagname2 
)

Definition at line 1977 of file crest_example.cxx.

1977  {
1978  std::cout << std::endl << "test: createIOV" << std::endl;
1979 
1980  CrestClient myCrestClient = CrestClient(SURL,false);
1981 
1982  nlohmann::json js =
1983  {
1984  {"description", "none"},
1985  {"endOfValidity", 0},
1986  {"insertionTime", "2018-12-06T11:18:35.641+0000"},
1987  {"lastValidatedTime", 0},
1988  {"modificationTime", "2018-12-06T11:18:35.641+0000"},
1989  {"name", tagname1},
1990  {"payloadSpec", "stave: Int32, eta: Int32, mag: Float, base: Float, free: Float"},
1991  {"synchronization", "none"},
1992  {"timeType", "time"}
1993  };
1994 
1995  std::cout << "tag 1 = " << std::endl << js.dump(4) << std::endl;
1996 
1997  try{
1998  myCrestClient.createTag(js);
1999  std::cout << std::endl << "Tag " << tagname1 << " created" << std::endl;
2000  }
2001  catch (const std::exception& e) {
2002  std::cout << std::endl << "ERROR: tag " << tagname1 << " creation failed" << std::endl;
2003  std::cout << e.what() << std::endl;
2004  exit(0);
2005  }
2006 
2007  js["name"] = tagname2;
2008 
2009  std::cout << "tag 2 = " << std::endl << js.dump(4) << std::endl;
2010 
2011  try{
2012  myCrestClient.createTag(js);
2013  std::cout << std::endl << "Tag " << tagname2 << " created" << std::endl;
2014  }
2015  catch (const std::exception& e) {
2016  std::cout << std::endl << "ERROR: tag " << tagname2 << " creation failed" << std::endl;
2017  std::cout << e.what() << std::endl;
2018  exit(0);
2019  }
2020 
2021  // payloads and IOVs:
2022 
2023  uint64_t endtime = 200;
2024  std::string d1 = "\"" + myCrestClient.getDateAndTime() + "_A\"";
2025  std::string d2 = "\"" + myCrestClient.getDateAndTime() + "_B\"";
2026 
2027  std::string str = "[{\"data\":" + d1 + ",\"since\":100},{\"data\":" + d2 + ",\"since\":150}]";
2028  nlohmann::json js2 = myCrestClient.getJson(str);
2029 
2030  try {
2031  myCrestClient.storeBatchPayloads(tagname1, endtime, js2);
2032  std::cout << std::endl << "2 IOVs created in tag " << tagname1 << std::endl;
2033  }
2034  catch (const std::exception& e) {
2035  std::cout << std::endl << "ERROR: payloads and IOVs were not created." << std::endl;
2036  std::cerr << e.what() << std::endl;
2037  exit(0);
2038  }
2039 
2040  // copy the data to tag 2:
2041 
2042  try{
2043  nlohmann::json iovList = myCrestClient.findAllIovs(tagname1);
2044  std::cout << std::endl << "IOV list for tag " << tagname1 << " =" << std::endl;
2045  std::cout << iovList.dump(4) << std::endl;
2046 
2047  int listSize = iovList.size();
2048 
2049  for (int j = 0; j < listSize; j++) {
2050 
2051  nlohmann::json iov = iovList[j];
2052  nlohmann::json newIov = iov;
2053 
2054  newIov["tagName"] = tagname2;
2055 
2056  try{
2057  myCrestClient.createIov(newIov);
2058  }
2059  catch (const std::exception& e) {
2060  std::cout << "ERROR: Cannot write the IOV for the tag \"" << tagname2 << "\"" << std::endl;
2061  std::cerr << e.what() << std::endl;
2062  exit(0);
2063  }
2064 
2065  } // j
2066  }
2067  catch (const std::exception& e) {
2068  std::cout << std::endl << "ERROR: cannot get IOV list for tag " << tagname1 << std::endl;
2069  std::cerr << e.what() << std::endl;
2070  exit(0);
2071  }
2072 
2073  try{
2074  nlohmann::json iovList = myCrestClient.findAllIovs(tagname2);
2075  std::cout << std::endl << "IOV list for tag " << tagname2 << " =" << std::endl;
2076  std::cout << iovList.dump(4) << std::endl;
2077  }
2078  catch (const std::exception& e) {
2079  std::cout << std::endl << "ERROR: cannot get IOV list for tag " << tagname2 << std::endl;
2080  std::cerr << e.what() << std::endl;
2081  exit(0);
2082  }
2083 
2084 }

◆ testCreateRunLumiInfo()

void testCreateRunLumiInfo ( )

Definition at line 428 of file crest_example.cxx.

428  {
429  std::cout << std::endl << "test: createRunLumiInfo" << std::endl;
430  CrestClient myCrestClient = CrestClient(SURL,false);
431 
432  std::string str =
433  "{\"since\":\"10\",\"run\":\"7777771\",\"lb\":\"62\",\"starttime\":\"10\",\"endtime\":\"200\"}";
434  nlohmann::json js = myCrestClient.getJson(str);
435  std::cout << "run-lumi = " << std::endl
436  << js.dump(4) << std::endl;
437 
438  try{
439  myCrestClient.createRunLumiInfo(js);
440  std::cout << std::endl << "test: createRunLumiInfo (success) = " << std::endl;
441  }
442  catch (const std::exception& e) {
443  std::cout << std::endl << "test: createRunLumiInfo (failed)" << std::endl;
444  std::cout << e.what() << std::endl;
445  }
446 }

◆ testCreateRunLumiInfo2()

void testCreateRunLumiInfo2 ( )

Definition at line 448 of file crest_example.cxx.

448  {
449  std::cout << std::endl << "test: createRunLumiInfo2" << std::endl;
450  CrestClient myCrestClient = CrestClient(SURL,false);
451 
452  nlohmann::json jsRes =
453  {
454  {"since", 0},
455  {"runNumber", 0},
456  {"lb", 0},
457  {"starttime", 0},
458  {"endtime", 10}
459  };
460 
461  nlohmann::json jsFilter =
462  {
463  {"name", "test"},
464  {"additionalProp1", "test1"},
465  {"additionalProp2", "test2"},
466  {"additionalProp3", "test3"}
467  };
468 
469  nlohmann::json jsPage =
470  {
471  {"size", 10},
472  {"totalElements", 0},
473  {"totalPages", 0},
474  {"number", 0}
475  };
476 
478  jsRes
479  };
480 
481  nlohmann::json jsRM =
482  {
483  {"size", 1},
484  {"datatype", "string"},
485  {"format", "RunLumiSetDto"},
486  {"page", jsPage},
487  {"filter", jsFilter},
488  {"resources", res}
489  };
490 
491  std::cout << "run-lumi = " << std::endl
492  << jsRM.dump(4) << std::endl;
493 
494  try{
495  myCrestClient.createRunLumiInfo(jsRM);
496  std::cout << std::endl << "test: createRunLumiInfo (success)" << std::endl;
497  }
498  catch (const std::exception& e) {
499  std::cout << std::endl << "test: createRunLumiInfo (failed)" << std::endl;
500  std::cout << e.what() << std::endl;
501  }
502 }

◆ testCreateTag()

void testCreateTag ( const std::string &  tagname)

Definition at line 49 of file crest_example.cxx.

49  {
50  std::cout << std::endl << "test: createTag" << std::endl;
51  CrestClient myCrestClient = CrestClient(SURL,false);
52 
53  nlohmann::json js =
54  {
55  {"description", "none"},
56  {"endOfValidity", 0},
57  {"insertionTime", "2018-12-06T11:18:35.641+0000"},
58  {"lastValidatedTime", 0},
59  {"modificationTime", "2018-12-06T11:18:35.641+0000"},
60  {"name", tagname},
61  {"payloadSpec", "stave: Int32, eta: Int32, mag: Float, base: Float, free: Float"},
62  {"synchronization", "none"},
63  {"timeType", "time"}
64  };
65 
66  try{
67  myCrestClient.createTag(js);
68  std::cout << std::endl << "test: createTag (success)" << std::endl;
69  }
70  catch (const std::exception& e) {
71  std::cout << std::endl << "test: createTag (failed)" << std::endl;
72  std::cout << e.what() << std::endl;
73  }
74 }

◆ testCreateTag2()

void testCreateTag2 ( )

Definition at line 76 of file crest_example.cxx.

76  {
77  std::cout << std::endl << "test: createTag2" << std::endl;
78  CrestClient myCrestClient = CrestClient(SURL,false);
79 
80  // real tag creation example:
81  // curl --header "Content-Type: application/json" --request POST --data
82  // '{"name":"CaloSwClusterCorrections.00-RUN2-02-11-clcon-dummy","description":"<timeStamp>run-lumi</timeStamp><addrHeader><address_header
83  // service_type=\"71\" clid=\"250904980\"
84  // /></addrHeader><typeName>CaloRec::ToolConstants</typeName><fullrep/>","timeType":"run-lumi","payloadSpec":"PoolRef:String4k"}'
85  // http://crest-01.cern.ch:8090/crestapi/tags
86 
87  nlohmann::json js =
88  {
89  {"name", "CaloSwClusterCorrections.00-RUN2-02-11-clcon-dummy"},
90  {"description",
91  "<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"250904980\" /></addrHeader><typeName>CaloRec::ToolConstants</typeName><fullrep/>"},
92  {"timeType", "run-lumi"},
93  {"payloadSpec", "PoolRef:String4k"}
94  };
95 
96  try{
97  myCrestClient.createTag(js);
98  std::cout << std::endl << "test: createTag2 (success)" << std::endl;
99  }
100  catch (const std::exception& e) {
101  std::cout << std::endl << "test: createTag2 (failed)" << std::endl;
102  std::cout << e.what() << std::endl;
103  }
104 }

◆ testCreateTagF()

void testCreateTagF ( const std::string &  tagname)

Definition at line 108 of file crest_example.cxx.

108  {
109  std::cout << std::endl << "test: createTagF" << std::endl;
110 
111  bool rewrite = true;
112  std::string path = "/tmp/cresttest/crest_dump";
114  std::filesystem::create_directories(path);
115  CrestClient myCrestClient = CrestClient(rewrite, path);
116 
117  nlohmann::json js =
118  {
119  {"description", "none"},
120  {"endOfValidity", 0},
121  {"insertionTime", "2018-12-06T11:18:35.641+0000"},
122  {"lastValidatedTime", 0},
123  {"modificationTime", "2018-12-06T11:18:35.641+0000"},
124  {"name", tagname},
125  {"payloadSpec", "stave: Int32, eta: Int32, mag: Float, base: Float, free: Float"},
126  {"synchronization", "none"},
127  {"timeType", "time"}
128  };
129 
130  try{
131  myCrestClient.createTag(js);
132  std::cout << std::endl << "test: createTagF (success)" << std::endl;
133  }
134  catch (const std::exception& e) {
135  std::cout << std::endl << "test: createTagF (failed)" << std::endl;
136  std::cout << e.what() << std::endl;
137  }
138 }

◆ testCreateTagFs()

void testCreateTagFs ( const std::string &  tagname)

Definition at line 1331 of file crest_example.cxx.

1331  {
1332  std::cout << std::endl << "test: createTagFs" << std::endl;
1333 
1334  bool rewrite = true;
1335  CrestClient myCrestClient = CrestClient(rewrite);
1336 
1337  nlohmann::json js =
1338  {
1339  {"description", "none"},
1340  {"endOfValidity", 0},
1341  {"insertionTime", "2018-12-06T11:18:35.641+0000"},
1342  {"lastValidatedTime", 0},
1343  {"modificationTime", "2018-12-06T11:18:35.641+0000"},
1344  {"name", tagname},
1345  {"payloadSpec", "stave: Int32, eta: Int32, mag: Float, base: Float, free: Float"},
1346  {"synchronization", "none"},
1347  {"timeType", "time"}
1348  };
1349 
1350  try{
1351  myCrestClient.createTag(js);
1352  std::cout << std::endl << "test: createTagFs (success)" << std::endl;
1353  }
1354  catch (const std::exception& e) {
1355  std::cout << std::endl << "test: createTagFs (failed)" << std::endl;
1356  std::cout << e.what() << std::endl;
1357  }
1358 }

◆ testCreateTagMetaInfo()

void testCreateTagMetaInfo ( const std::string &  tagname)

Definition at line 811 of file crest_example.cxx.

811  {
812  std::cout << std::endl << "test: createTagMetainfo" << std::endl;
813  CrestClient myCrestClient = CrestClient(SURL,false);
814 
815  nlohmann::json js =
816  {
817  {"tagName", tagname},
818  {"description", "desc-01"},
819  {"tagInfo", "taginf-01"},
820  {"chansize", 0},
821  {"colsize", 0}
822  };
823 
824  try{
825  myCrestClient.createTagMetaInfo(js);
826  std::cout << std::endl << "test: createTagMetaInfo (success)" << std::endl;
827  }
828  catch (const std::exception& e) {
829  std::cout << std::endl << "test: createTagMetaInfo (failed)" << std::endl;
830  std::cerr << e.what() << std::endl;
831  }
832 }

◆ testCreateTagMetaInfo2()

void testCreateTagMetaInfo2 ( const std::string &  tagname)

Definition at line 871 of file crest_example.cxx.

871  {
872  std::cout << std::endl << "test: createTagMetainfo2" << std::endl;
873  CrestClient myCrestClient = CrestClient(SURL,false);
874 
875  nlohmann::json js =
876  {
877  {"chansize", 1},
878  {"colsize", 0},
879  {"description",
880  "<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"1238547719\" /></addrHeader><typeName>CondAttrListCollection</typeName>"},
881  {"insertionTime", "Fri Nov 13 16:31:10 2020"},
882  {"tagName", tagname}
883  };
884 
885  try{
886  myCrestClient.createTagMetaInfo(js);
887  std::cout << std::endl << "test: createTagMetaInfo (success)" << std::endl;
888  }
889  catch (const std::exception& e) {
890  std::cout << std::endl << "test: createTagMetaInfo (failed)" << std::endl;
891  std::cerr << e.what() << std::endl;
892  }
893 }

◆ testCreateTagMetaInfo2Args()

void testCreateTagMetaInfo2Args ( const std::string &  tagname)

Definition at line 836 of file crest_example.cxx.

836  {
837  std::cout << std::endl << "test: createTagMetainfo" << std::endl;
838  CrestClient myCrestClient = CrestClient(SURL,false);
839 
840  nlohmann::json js =
841  {
842  {"tagName", tagname},
843  {"description", "desc-01"},
844  {"tagInfo", "taginf-01"},
845  {"chansize", 0},
846  {"colsize", 0},
847  {"insertionTime", "2019-03-14T13:29:25.286Z"}
848  };
849 
850  try{
851  std::cout << "test A:" << std::endl;
852  myCrestClient.createTagMetaInfo(tagname, js);
853  std::cout << "test: createTagMetaInfo (success)" << std::endl;
854  }
855  catch (const std::exception& e) {
856  std::cout << std::endl << "test: createTagMetaInfo (failed)" << std::endl;
857  std::cerr << e.what() << std::endl;
858  }
859  try{
860  std::cout << "test B:" << std::endl;
861  myCrestClient.createTagMetaInfo("test", js);
862  std::cout << "test: createTagMetaInfo (success)" << std::endl;
863  }
864  catch (const std::exception& e) {
865  std::cout << std::endl << "test: createTagMetaInfo (failed)" << std::endl;
866  std::cerr << e.what() << std::endl;
867  }
868 }

◆ testCreateTagMetaInfoDetailed()

void testCreateTagMetaInfoDetailed ( const std::string &  tagname)

Definition at line 896 of file crest_example.cxx.

896  {
897  std::cout << std::endl << "test: createTagMetainfoDetailed" << std::endl;
898  CrestClient myCrestClient = CrestClient(SURL,false);
899 
900  nlohmann::json channel = {{"0", "ATLAS_PREFERRED"}};
901 
902  std::cout << std::endl << "channel = " << std::endl
903  << channel.dump(4) << std::endl;
904 
906 
907  nlohmann::json tagInfo =
908  {
909  {"channel_list", chanList},
910  {"node_description", "description of the node"},
911  {"payload_spec", "payload specification"}
912  };
913 
914  std::cout << std::endl << "TagInfo = " << std::endl
915  << tagInfo.dump(4) << std::endl;
916 
917  std::cout << std::endl << "TagInfo = " << std::endl
918  << tagInfo.dump() << std::endl;
919 
920  nlohmann::json js =
921  {
922  {"tagName", tagname},
923  {"description", "none"},
924  {"chansize", 1},
925  {"colsize", 6},
926  {"tagInfo", tagInfo.dump()},
927  {"insertionTime", "2020-12-04"}
928  };
929 
930 
931  try{
932  myCrestClient.createTagMetaInfo(js);
933  std::cout << std::endl << "test: createTagMetaInfoDetailed (success)" << std::endl;
934  }
935  catch (const std::exception& e) {
936  std::cout << std::endl << "test: createTagMetaInfoDetailed (failed)" << std::endl;
937  std::cerr << e.what() << std::endl;
938  }
939 }

◆ testCreateTagMetaInfoDetailedFs()

void testCreateTagMetaInfoDetailedFs ( const std::string &  tagname)

Definition at line 1204 of file crest_example.cxx.

1204  {
1205  std::cout << std::endl << "test: createTagMetainfoDetailedFs" << std::endl;
1206 
1207  CrestClient myCrestClient = CrestClient(true);
1208 
1209  nlohmann::json channel = {{"0", "ATLAS_PREFERRED"}};
1210 
1211  std::cout << std::endl << "channel = " << std::endl
1212  << channel.dump(4) << std::endl;
1213 
1215 
1216  nlohmann::json tagInfo =
1217  {
1218  {"channel_list", chanList},
1219  {"node_description", "description of the node"},
1220  {"payload_spec", "payload specification"}
1221  };
1222 
1223  std::cout << std::endl << "TagInfo = " << std::endl
1224  << tagInfo.dump(4) << std::endl;
1225 
1226  std::cout << std::endl << "TagInfo = " << std::endl
1227  << tagInfo.dump() << std::endl;
1228 
1229  nlohmann::json js =
1230  {
1231  {"tagName", tagname},
1232  {"description", "none"},
1233  {"chansize", 1},
1234  {"colsize", 6},
1235  {"tagInfo", tagInfo.dump()},
1236  {"insertionTime", "2020-12-04"}
1237  };
1238 
1239 
1240  try{
1241  myCrestClient.createTagMetaInfo(js);
1242  std::cout << std::endl << "test: createTagMetaInfoDetailedFs (success)" << std::endl;
1243  }
1244  catch (const std::exception& e) {
1245  std::cout << std::endl << "test: createTagMetaInfoDetailedFs (failed)" << std::endl;
1246  std::cerr << e.what() << std::endl;
1247  }
1248 }

◆ testCreateTagMetaInfoIOVDbSvc()

void testCreateTagMetaInfoIOVDbSvc ( const std::string &  tagname)

Definition at line 980 of file crest_example.cxx.

980  {
981  std::cout << std::endl << "test: createTagMetainfoIOVDbSvc" << std::endl;
982  CrestClient myCrestClient = CrestClient(SURL,false);
983  std::string description = "meta tag description";
984 
985  nlohmann::json channel1 = {{"0", "ATLAS_PREFERRED0"}};
986  nlohmann::json channel2 = {{"1", "ATLAS_PREFERRED1"}};
987 
988  nlohmann::json chanList = nlohmann::json::array({channel1, channel2});
989 
990  nlohmann::json tagInfo =
991  {
992  {"channel_list", chanList},
993  {"node_description", "description of the node"},
994  {"payload_spec",
995  "AlgorithmID:UInt32,LBAvInstLumi:Float,LBAvEvtsPerBX:Float,LumiType:UInt32,Valid:UInt32,BunchInstLumi:Blob64k"}
996  };
997 
998  try{
999  myCrestClient.createTagMetaInfoIOVDbSvc(tagname, tagInfo, description);
1000  std::cout << std::endl << "test: createTagMetaInfoIOVDbSvc (success)" << std::endl;
1001  }
1002  catch (const std::exception& e) {
1003  std::cout << std::endl << "test: createTagMetaInfoIOVDbSvc (failed)" << std::endl;
1004  std::cerr << e.what() << std::endl;
1005  }
1006 }

◆ testFindAllIovs()

void testFindAllIovs ( const std::string &  tagname)

Definition at line 650 of file crest_example.cxx.

650  {
651  std::cout << std::endl << "test: findAllIovs" << std::endl;
652  CrestClient myCrestClient = CrestClient(SURL,false);
653 
654  try{
655  nlohmann::json tag_info = myCrestClient.findAllIovs(tagname);
656  std::cout << std::endl << "test: findAllIovs (result) =" << std::endl;
657  std::cout << tag_info.dump(4) << std::endl;
658  }
659  catch (const std::exception& e) {
660  std::cout << std::endl << "test: findAllIovs (failed)" << std::endl;
661  std::cerr << e.what() << std::endl;
662  }
663 }

◆ testFindAllIovsFS()

void testFindAllIovsFS ( const std::string &  tagname)

Definition at line 685 of file crest_example.cxx.

685  {
686  std::cout << std::endl << "test: findAllIovsFS" << std::endl;
687 
688  CrestClient myCrestClient = CrestClient(true);
689 
690  try{
691  nlohmann::json tag_info = myCrestClient.findAllIovsFs(tagname);
692  std::cout << std::endl << "test: findAllIovsFS (result) =" << std::endl;
693  std::cout << tag_info.dump(4) << std::endl;
694  }
695  catch (const std::exception& e) {
696  std::cout << std::endl << "test: findAllIovsFS (failed)" << std::endl;
697  std::cerr << e.what() << std::endl;
698  }
699 }

◆ testFindAllIovsFSPlus()

void testFindAllIovsFSPlus ( const std::string &  tagname,
int  size,
int  page 
)

Definition at line 703 of file crest_example.cxx.

703  {
704  std::cout << std::endl << "test: findAllIovsFSPlus" << std::endl;
705  CrestClient myCrestClient = CrestClient(true);
706 
707  try{
708  nlohmann::json tag_info = myCrestClient.findAllIovsFs(tagname, size, page);
709  std::cout << std::endl << "test: findAllIovsFSPlus (result) =" << std::endl;
710  std::cout << tag_info.dump(4) << std::endl;
711  }
712  catch (const std::exception& e) {
713  std::cout << std::endl << "test: findAllIovsFSPlus (failed)" << std::endl;
714  std::cerr << e.what() << std::endl;
715  }
716 }

◆ testFindAllIovsParams()

void testFindAllIovsParams ( const std::string &  tagname,
int  size,
int  page 
)

Definition at line 665 of file crest_example.cxx.

665  {
666  std::cout << std::endl << "test: findAllIovs with additional parameters" << std::endl;
667  CrestClientExt myCrestClient = CrestClientExt(SURL);
668 
669  try{
670  nlohmann::json iov_list_1 = myCrestClient.findAllIovsParams(tagname, size, page);
671  nlohmann::json iov_list_2 = myCrestClient.findAllIovsParams(tagname, _page = page, _size = size);
672 
673  std::cout << std::endl << "test: findAllIovs (result A) =" << std::endl;
674  std::cout << iov_list_1.dump(4) << std::endl;
675 
676  std::cout << std::endl << "test: findAllIovs (result B) =" << std::endl;
677  std::cout << iov_list_2.dump(4) << std::endl;
678  }
679  catch (const std::exception& e) {
680  std::cout << std::endl << "test: findAllIovs with additional parameters (failed)" << std::endl;
681  std::cerr << e.what() << std::endl;
682  }
683 }

◆ testFindGlobalTag()

void testFindGlobalTag ( const std::string &  tagname)

Definition at line 295 of file crest_example.cxx.

295  {
296  std::cout << std::endl << "test: findGlobalTag" << std::endl;
297  CrestClient myCrestClient = CrestClient(SURL,false);
298 
299  try {
300  nlohmann::json tag_info = myCrestClient.findGlobalTag(tagname);
301  std::cout << std::endl << "test: findGlobalTag (result) = " << std::endl
302  << tag_info.dump(4) << std::endl;
303  }
304  catch (const std::exception& e) {
305  std::cout << std::endl << "test: findGlobalTag (failed)" << std::endl;
306  std::cout << e.what() << std::endl;
307  }
308 }

◆ testFindGlobalTagAsString()

void testFindGlobalTagAsString ( const std::string &  tagname)

Definition at line 409 of file crest_example.cxx.

409  {
410  std::cout << std::endl << "test: findGlobalTagAsString" << std::endl;
411  CrestClient myCrestClient = CrestClient(SURL,false);
412 
413  try {
414  nlohmann::json tag_info = myCrestClient.findGlobalTagAsString(tagname);
415  std::cout << std::endl << "test: findGlobalTagAsString (result) = " << std::endl
416  << tag_info.dump(4) << std::endl;
417  }
418  catch (const std::exception& e) {
419  std::cout << std::endl << "test: findGlobalTagAsString (failed)" << std::endl;
420  std::cout << e.what() << std::endl;
421  }
422 }

◆ testFindGlobalTagFs()

void testFindGlobalTagFs ( const std::string &  tagname)

Definition at line 1415 of file crest_example.cxx.

1415  {
1416  std::cout << std::endl << "test: findGlobalTagFs" << std::endl;
1417  bool rewrite = true;
1418  CrestClient myCrestClient = CrestClient(rewrite);
1419 
1420  try {
1421  nlohmann::json tag_info = myCrestClient.findGlobalTagFs(tagname);
1422  std::cout << std::endl << "test: findGlobalTagFs (result) = " << std::endl
1423  << tag_info.dump(4) << std::endl;
1424  }
1425  catch (const std::exception& e) {
1426  std::cout << std::endl << "test: findGlobalTagFs (failed)" << std::endl;
1427  std::cout << e.what() << std::endl;
1428  }
1429 }

◆ testFindGlobalTagMap()

void testFindGlobalTagMap ( const std::string &  mapname)

Definition at line 523 of file crest_example.cxx.

523  {
524  std::cout << std::endl << "test: findGlobalTagMap" << std::endl;
525  CrestClient myCrestClient = CrestClient(SURL,false);
526 
527  try{
528  nlohmann::json tag_info = myCrestClient.findGlobalTagMap(mapname);
529  std::cout << std::endl << "test: findGlobalTagMap (result) = "
530  << tag_info.dump(4) << std::endl;
531  }
532  catch (const std::exception& e) {
533  std::cout << std::endl << "test: findGlobalTagMap (failed)" << std::endl;
534  std::cout << e.what() << std::endl;
535  }
536 }

◆ testFindGlobalTagMapFs()

void testFindGlobalTagMapFs ( const std::string &  tagname)

Definition at line 1456 of file crest_example.cxx.

1456  {
1457  std::cout << std::endl << "test: findGlobalTagMapFs" << std::endl;
1458  bool rewrite = true;
1459  CrestClient myCrestClient = CrestClient(rewrite);
1460 
1461  try {
1462  nlohmann::json tag_info = myCrestClient.findGlobalTagMapFs(tagname);
1463  std::cout << std::endl << "test: findGlobalTagMapFs (result) = " << std::endl
1464  << tag_info.dump(4) << std::endl;
1465  }
1466  catch (const std::exception& e) {
1467  std::cout << std::endl << "test: findGlobalTagMapFs (failed)" << std::endl;
1468  std::cout << e.what() << std::endl;
1469  }
1470 }

◆ testFindTag()

void testFindTag ( const std::string &  tagname)

Definition at line 200 of file crest_example.cxx.

200  {
201  std::cout << std::endl << "test: findTag" << std::endl;
202  CrestClient myCrestClient = CrestClient(SURL,false);
203 
204  try {
205  nlohmann::json tag_info = myCrestClient.findTag(tagname);
206  std::cout << std::endl << "test: findTag (result) =" << std::endl
207  << tag_info.dump(4) << std::endl;
208  }
209  catch (const std::exception& e) {
210  std::cout << std::endl << "test: findTag (failed)" << std::endl;
211  std::cout << e.what() << std::endl;
212  }
213 }

◆ testFindTagFs()

void testFindTagFs ( const std::string &  tagname)

Definition at line 1314 of file crest_example.cxx.

1314  {
1315  std::cout << std::endl << "test: findTagFs" << std::endl;
1316  CrestClient myCrestClient = CrestClient(true);
1317 
1318  std::cout << std::endl << "test: findTagFs" << std::endl;
1319 
1320  try {
1321  nlohmann::json tag_info = myCrestClient.findTag(tagname);
1322  std::cout << std::endl << "test: findTagFs (result) =" << std::endl
1323  << tag_info.dump(4) << std::endl;
1324  }
1325  catch (const std::exception& e) {
1326  std::cout << std::endl << "test: findTagFs (failed)" << std::endl;
1327  std::cout << e.what() << std::endl;
1328  }
1329 }

◆ testGetBlob()

void testGetBlob ( const std::string &  hash)

Definition at line 1117 of file crest_example.cxx.

1117  {
1118  std::cout << std::endl << "test: getBlob" << std::endl;
1119  CrestClient myCrestClient = CrestClient(SURL,false);
1120 
1121  try{
1122  string tag_info7 = myCrestClient.getBlob(hash);
1123  std::cout << std::endl << "test: getBlob (result) =" << std::endl;
1124  std::cout << tag_info7 << std::endl;
1125  std::cout << std::endl << "test: getBlob" << std::endl;
1126  }
1127  catch (const std::exception& e) {
1128  std::cout << std::endl << "test: getBlob (failed)" << std::endl;
1129  std::cerr << e.what() << std::endl;
1130  }
1131 }

◆ testGetBlobFS()

void testGetBlobFS ( const std::string &  hash)

Definition at line 1628 of file crest_example.cxx.

1628  {
1629  std::cout << std::endl << "test: getBlobFs" << std::endl;
1630  CrestClient myCrestClient = CrestClient(true);
1631 
1632  try {
1633  std::string info = myCrestClient.getBlobFs(hash);
1634  std::cout << std::endl << "test: getBlobFs (result) =" << std::endl
1635  << info << std::endl;
1636  }
1637  catch (const std::exception& e) {
1638  std::cout << std::endl << "test: getBlobFs (failed)" << std::endl;
1639  std::cout << e.what() << std::endl;
1640  }
1641 }

◆ testGetBlobInStream()

void testGetBlobInStream ( const std::string &  hash)

Definition at line 1095 of file crest_example.cxx.

1095  {
1096  std::cout << std::endl << "test: getBlobInStream" << std::endl;
1097  CrestClient myCrestClient = CrestClient(SURL,false);
1098 
1099  try{
1100  remove("data.txt");
1101 
1102  std::ofstream out8; // stream for writing
1103  out8.open("data.txt"); // open the file to write
1104  if (out8.is_open()) {
1105  myCrestClient.getBlobInStream(hash, out8);
1106  std::cout << std::endl << "test: getBlobInStream test finished." << std::endl;
1107  std::cout << std::endl << "The blob for hash \"" << hash
1108  << "\" was written in the file \"data.txt\"." << std::endl;
1109  }
1110  }
1111  catch (const std::exception& e) {
1112  std::cout << std::endl << "test: getBlobInStream (failed)" << std::endl;
1113  std::cerr << e.what() << std::endl;
1114  }
1115 }

◆ testGetBlobInStreamFS()

void testGetBlobInStreamFS ( const std::string &  hash)

Definition at line 1605 of file crest_example.cxx.

1605  {
1606  std::cout << std::endl << "test: getBlobInStreamFs" << std::endl;
1607  CrestClient myCrestClient = CrestClient(true);
1608 
1609  try{
1610  remove("data.txt");
1611 
1612  std::ofstream out8; // stream for writing
1613  out8.open("data.txt"); // open the file to write
1614  if (out8.is_open()) {
1615  string tag_info8 = myCrestClient.getBlobInStreamFs(hash, out8);
1616  std::cout << std::endl << "test: getBlobInStreamFs (result) =" << std::endl;
1617  std::cout << tag_info8 << std::endl;
1618  std::cout << "blob is in the file data.txt" << std::endl;
1619  std::cout << std::endl << "test: getBlobInStreamFs" << std::endl;
1620  }
1621  }
1622  catch (const std::exception& e) {
1623  std::cout << std::endl << "test: getBlobInStreamFs (failed)" << std::endl;
1624  std::cerr << e.what() << std::endl;
1625  }
1626 }

◆ testGetClientVersion()

void testGetClientVersion ( )

Definition at line 2229 of file crest_example.cxx.

2229  {
2230  std::cout << std::endl << "test: getClientVersion" << std::endl;
2231  CrestClient myCrestClient = CrestClient(SURL,false);
2232 
2233  try {
2234  std::string version = myCrestClient.getClientVersion();
2235  std::cout << std::endl << "test: CrestApi version = "
2236  << version << std::endl;
2237  }
2238  catch (const std::exception& e) {
2239  std::cout << std::endl << "test: getClientVersion (failed)" << std::endl;
2240  std::cout << e.what() << std::endl;
2241  }
2242 }

◆ testGetCrestVersion()

void testGetCrestVersion ( )

Definition at line 2214 of file crest_example.cxx.

2214  {
2215  std::cout << std::endl << "test: getCrestVersion" << std::endl;
2216  CrestClient myCrestClient = CrestClient(SURL,false);
2217 
2218  try {
2219  std::string version = myCrestClient.getCrestVersion();
2220  std::cout << std::endl << "test: CREST server version = "
2221  << version << std::endl;
2222  }
2223  catch (const std::exception& e) {
2224  std::cout << std::endl << "test: getCrestVersion (failed)" << std::endl;
2225  std::cout << e.what() << std::endl;
2226  }
2227 }

◆ testGetCrestVersion2()

void testGetCrestVersion2 ( )

Definition at line 2311 of file crest_example.cxx.

2311  {
2312  std::cout << std::endl << "test: getCrestVersion2" << std::endl;
2313  CrestClient myCrestClient = CrestClient(SURL,false);
2314 
2315  try {
2316  std::string version = myCrestClient.getCrestVersion2();
2317  std::cout << std::endl << "test: CREST server version = "
2318  << version << std::endl;
2319  }
2320  catch (const std::exception& e) {
2321  std::cout << std::endl << "test: getCrestVersion2 (failed)" << std::endl;
2322  std::cout << e.what() << std::endl;
2323  }
2324 }

◆ testGetDateAndTime()

void testGetDateAndTime ( )

Definition at line 1529 of file crest_example.cxx.

1529  {
1530  std::cout << std::endl << "test: getDateAndTime" << std::endl;
1531  CrestClient myCrestClient = CrestClient(SURL,false);
1532 
1533  try{
1534  std::string time = myCrestClient.getDateAndTime();
1535  std::cout << std::endl << "now = " << time << std::endl;
1536  }
1537  catch (const std::exception& e) {
1538  std::cout << std::endl << "test: getDateAndTime (failed)" << std::endl;
1539  std::cerr << e.what() << std::endl;
1540  }
1541 }

◆ testGetFirstLetters()

void testGetFirstLetters ( const std::string &  str)

Definition at line 1960 of file crest_example.cxx.

1960  {
1961  std::cout << std::endl << "test: getFirstLetters" << std::endl;
1962  CrestClient myCrestClient = CrestClient(SURL,false);
1963 
1964  std::cout << "string to test = " << str << std::endl;
1965 
1966  try{
1967  std::string str2 = myCrestClient.getFirstLetters(str);
1968  std::cout << std::endl << "test: getFirstLetters (result) = " << str2 << std::endl;
1969  }
1970  catch (const std::exception& e) {
1971  std::cout << std::endl << "test: getFirstLetters (failed)" << std::endl;
1972  std::cerr << e.what() << std::endl;
1973  }
1974 }

◆ testGetHash()

void testGetHash ( const std::string &  str)

Definition at line 1474 of file crest_example.cxx.

1474  {
1475  std::cout << std::endl << "test: getHash" << std::endl;
1476  CrestClient myCrestClient = CrestClient(SURL,false);
1477 
1478  std::cout << myCrestClient.getHash(str) << std::endl;
1479 }

◆ testGetJson()

void testGetJson ( )

Definition at line 565 of file crest_example.cxx.

565  {
566  std::cout << std::endl << "test: getJson" << std::endl;
567  CrestClient myCrestClient = CrestClient(SURL,false);
568 
569  std::string stra =
570  "{\"tagName\":\"IndetBeampos-nominal\",\"since\":0,\"insertionTime\":\"2019-02-21T13:52:06.222+0000\",\"payloadHash\":\"de9afd9a5bb526d175265d1e66520ac1e7a81816cc3081925625759583e9107f\"}";
571  std::string strb = "test";
572 
573  try{
574  std::cout << myCrestClient.getJson(stra).dump(4) << std::endl;
575  }
576  catch (const std::exception& e) {
577  std::cout << std::endl << "test: getJson for string stra (failed)" << std::endl;
578  std::cout << e.what() << std::endl;
579  }
580 
581  try{
582  std::cout << myCrestClient.getJson(strb).dump(4) << std::endl;
583  }
584  catch (const std::exception& e) {
585  std::cout << std::endl << "test: getJson for string strb (failed)" << std::endl;
586  std::cout << e.what() << std::endl;
587  }
588 
589  std::cout << "getJson test ended" << std::endl;
590 }

◆ testGetMajorVersion()

void testGetMajorVersion ( )

Definition at line 2244 of file crest_example.cxx.

2244  {
2245  std::cout << std::endl << "test: getMajorVersion" << std::endl;
2246  CrestClient myCrestClient = CrestClient(SURL,false);
2247 
2248  std::string A = "4.1"; // good version
2249  std::string B = "abracadabra"; // wrong version
2250  std::string C = ".2"; // wrong version
2251  std::string D = "aaa.2"; // wrong version
2252 
2253  try {
2254  int versionA = myCrestClient.getMajorVersion(A);
2255  std::cout << std::endl << "test: major version (" << A << ") = "
2256  << versionA << std::endl;
2257  }
2258  catch (const std::exception& e) {
2259  std::cout << std::endl << "test: getMajorVersion (failed)" << std::endl;
2260  std::cout << e.what() << std::endl;
2261  }
2262 
2263  try {
2264  int versionB = myCrestClient.getMajorVersion(B);
2265  std::cout << std::endl << "test: major version (" << B << ") = "
2266  << versionB << std::endl;
2267  }
2268  catch (const std::exception& e) {
2269  std::cout << std::endl << "test: getMajorVersion (failed)" << std::endl;
2270  std::cout << e.what() << std::endl;
2271  }
2272 
2273  try {
2274  int versionC = myCrestClient.getMajorVersion(C);
2275  std::cout << std::endl << "test: major version (" << C << ") = "
2276  << versionC << std::endl;
2277  }
2278  catch (const std::exception& e) {
2279  std::cout << std::endl << "test: getMajorVersion (failed)" << std::endl;
2280  std::cout << e.what() << std::endl;
2281  }
2282 
2283  try {
2284  int versionD = myCrestClient.getMajorVersion(D);
2285  std::cout << std::endl << "test: major version (" << D << ") = "
2286  << versionD << std::endl;
2287  }
2288  catch (const std::exception& e) {
2289  std::cout << std::endl << "test: getMajorVersion (failed)" << std::endl;
2290  std::cout << e.what() << std::endl;
2291  }
2292 }

◆ testGetMgmtInfo()

void testGetMgmtInfo ( )

Definition at line 2199 of file crest_example.cxx.

2199  {
2200  std::cout << std::endl << "test: getMgmtInfo" << std::endl;
2201  CrestClient myCrestClient = CrestClient(SURL,false);
2202 
2203  try {
2204  nlohmann::json tag_info = myCrestClient.getMgmtInfo();
2205  std::cout << std::endl << "test: getMgmtInfo (result) =" << std::endl
2206  << tag_info.dump(4) << std::endl;
2207  }
2208  catch (const std::exception& e) {
2209  std::cout << std::endl << "test: getMgmtInfo (failed)" << std::endl;
2210  std::cout << e.what() << std::endl;
2211  }
2212 }

◆ testGetPayloadAsJson()

void testGetPayloadAsJson ( const std::string &  hash)

Definition at line 1133 of file crest_example.cxx.

1133  {
1134  std::cout << std::endl << "test: getPayloadAsJson" << std::endl;
1135  CrestClient myCrestClient = CrestClient(SURL,false);
1136 
1137  try{
1138  nlohmann::json info26 = myCrestClient.getPayloadAsJson(hash);
1139  std::cout << std::endl << "test: getPayloadAsJson (result) =" << std::endl;
1140  std::cout << info26.dump(4) << std::endl;
1141  std::cout << std::endl << "test: getPayloadAsJson" << std::endl;
1142  }
1143  catch (const std::exception& e) {
1144  std::cout << std::endl << "test: getPayloadAsJson (failed)" << std::endl;
1145  std::cerr << e.what() << std::endl;
1146  }
1147 }

◆ testGetPayloadAsJsonFS()

void testGetPayloadAsJsonFS ( const std::string &  hash)

Definition at line 1560 of file crest_example.cxx.

1560  {
1561  std::cout << std::endl << "test: getPayloadAsJsonFS" << std::endl;
1562  CrestClient myCrestClient = CrestClient(true);
1563 
1564  try {
1565  nlohmann::json info = myCrestClient.getPayloadAsJsonFS(hash);
1566  std::cout << std::endl << "test: getPayloadAsJsonFS (result) =" << std::endl
1567  << info.dump(4) << std::endl;
1568  }
1569  catch (const std::exception& e) {
1570  std::cout << std::endl << "test: getPayloadAsJsonFS (failed)" << std::endl;
1571  std::cout << e.what() << std::endl;
1572  }
1573 }

◆ testGetPayloadAsString()

void testGetPayloadAsString ( const std::string &  hash)

Definition at line 1149 of file crest_example.cxx.

1149  {
1150  std::cout << std::endl << "test: getPayloadAsString" << std::endl;
1151  CrestClient myCrestClient = CrestClient(SURL,false);
1152 
1153  try{
1154  std::string info27 = myCrestClient.getPayloadAsString(hash);
1155  std::cout << std::endl << "test: getPayloadAsString (result) =" << std::endl;
1156  std::cout << info27 << std::endl;
1157  std::cout << std::endl << "test: getPayloadAsString" << std::endl;
1158  }
1159  catch (const std::exception& e) {
1160  std::cout << std::endl << "test: getPayloadAsString (failed)" << std::endl;
1161  std::cerr << e.what() << std::endl;
1162  }
1163 }

◆ testGetPayloadAsStringFS()

void testGetPayloadAsStringFS ( const std::string &  hash)

Definition at line 1545 of file crest_example.cxx.

1545  {
1546  std::cout << std::endl << "test: getPayloadAsStringFS" << std::endl;
1547  CrestClient myCrestClient = CrestClient(true);
1548 
1549  try {
1550  std::string info = myCrestClient.getPayloadAsStringFS(hash);
1551  std::cout << std::endl << "test: getPayloadAsStringFS (result) =" << std::endl
1552  << info << std::endl;
1553  }
1554  catch (const std::exception& e) {
1555  std::cout << std::endl << "test: getPayloadAsStringFS (failed)" << std::endl;
1556  std::cout << e.what() << std::endl;
1557  }
1558 }

◆ testGetPayloadMetaInfo()

void testGetPayloadMetaInfo ( const std::string &  hash)

Definition at line 1181 of file crest_example.cxx.

1181  {
1182  std::cout << std::endl << "test: getPayloadMetaInfo" << std::endl;
1183  CrestClient myCrestClient = CrestClient(SURL,false);
1184 
1185  try{
1186  nlohmann::json info14 = myCrestClient.getPayloadMetaInfo(hash);
1187  std::cout << std::endl << "test: getPayloadMetaInfo (result) =" << std::endl;
1188  std::cout << info14.dump(4) << std::endl;
1189  std::cout << std::endl << "test: getPayloadMetaInfo" << std::endl;
1190  }
1191  catch (const std::exception& e) {
1192  std::cout << std::endl << "test: getPayloadMetaInfo (failed)" << std::endl;
1193  std::cerr << e.what() << std::endl;
1194  }
1195 }

◆ testGetPayloadMetaInfoAsJsonFS()

void testGetPayloadMetaInfoAsJsonFS ( const std::string &  hash)

Definition at line 1590 of file crest_example.cxx.

1590  {
1591  std::cout << std::endl << "test: getPayloadMetaInfoAsJsonFS" << std::endl;
1592  CrestClient myCrestClient = CrestClient(true);
1593 
1594  try {
1596  std::cout << std::endl << "test: getPayloadMetaInfoAsJsonFS (result) =" << std::endl
1597  << info.dump(4) << std::endl;
1598  }
1599  catch (const std::exception& e) {
1600  std::cout << std::endl << "test: getPayloadMetaInfoAsJsonFS (failed)" << std::endl;
1601  std::cout << e.what() << std::endl;
1602  }
1603 }

◆ testGetPayloadMetaInfoAsString()

void testGetPayloadMetaInfoAsString ( const std::string &  hash)

Definition at line 1165 of file crest_example.cxx.

1165  {
1166  std::cout << std::endl << "test: getPayloadMetaInfoAsString" << std::endl;
1167  CrestClient myCrestClient = CrestClient(SURL,false);
1168 
1169  try{
1170  std::string info15 = myCrestClient.getPayloadMetaInfoAsString(hash);
1171  std::cout << std::endl << "test: getPayloadMetaInfoAsString (result) =" << std::endl;
1172  std::cout << info15 << std::endl;
1173  std::cout << std::endl << "test: getPayloadMetaInfoAsString" << std::endl;
1174  }
1175  catch (const std::exception& e) {
1176  std::cout << std::endl << "test: getPayloadMetaInfoAsString (failed)" << std::endl;
1177  std::cerr << e.what() << std::endl;
1178  }
1179 }

◆ testGetPayloadMetaInfoAsStringFS()

void testGetPayloadMetaInfoAsStringFS ( const std::string &  hash)

Definition at line 1575 of file crest_example.cxx.

1575  {
1576  std::cout << std::endl << "test: getPayloadMetaInfoAsStringFS" << std::endl;
1577  CrestClient myCrestClient = CrestClient(true);
1578 
1579  try {
1580  std::string info = myCrestClient.getPayloadMetaInfoAsStringFS(hash);
1581  std::cout << std::endl << "test: getPayloadMetaInfoAsStringFS (result) =" << std::endl
1582  << info << std::endl;
1583  }
1584  catch (const std::exception& e) {
1585  std::cout << std::endl << "test: getPayloadMetaInfoAsStringFS (failed)" << std::endl;
1586  std::cout << e.what() << std::endl;
1587  }
1588 }

◆ testGetSize()

void testGetSize ( const std::string &  tagname)

Definition at line 1875 of file crest_example.cxx.

1875  {
1876  std::cout << std::endl << "test: getSize" << std::endl;
1877  CrestClient myCrestClient = CrestClient(SURL,false);
1878 
1879  try {
1880  int info = myCrestClient.getSize(tagname);
1881  std::cout << std::endl << "test: getSize (result) = "
1882  << info << std::endl;
1883  }
1884  catch (const std::exception& e) {
1885  std::cout << std::endl << "test: getSize (failed)" << std::endl;
1886  std::cout << e.what() << std::endl;
1887  }
1888 }

◆ testGetSizeFS()

void testGetSizeFS ( const std::string &  tagname)

Definition at line 1890 of file crest_example.cxx.

1890  {
1891  std::cout << std::endl << "test: getSizeFS" << std::endl;
1892 
1893  bool rewrite = true;
1894  CrestClient myCrestClient = CrestClient(rewrite);
1895 
1896  try {
1897  int info = myCrestClient.getSizeFS(tagname);
1898  std::cout << std::endl << "test: getSizeFS (result) = "
1899  << info << std::endl;
1900  }
1901  catch (const std::exception& e) {
1902  std::cout << std::endl << "test: getSizeFS (failed)" << std::endl;
1903  std::cout << e.what() << std::endl;
1904  }
1905 }

◆ testGetTagDataInfo()

void testGetTagDataInfo ( const std::string &  tagname)

Definition at line 1947 of file crest_example.cxx.

1947  {
1948  bool rewrite = true;
1949  CrestClient myCrestClient = CrestClient(rewrite);
1950 
1951  try{
1952  myCrestClient.getTagDataInfo(tagname);
1953  }
1954  catch (const std::exception& e) {
1955  std::cout << std::endl << "test: testGetTagDataInfo (failed)" << std::endl;
1956  std::cout << e.what() << std::endl;
1957  }
1958 }

◆ testGetTagMetaInfo()

void testGetTagMetaInfo ( const std::string &  tagname)

Definition at line 941 of file crest_example.cxx.

941  {
942  std::cout << std::endl << "test: getTagMetaInfo" << std::endl;
943  CrestClient myCrestClient = CrestClient(SURL,false);
944 
945  try{
946  nlohmann::json js = myCrestClient.getTagMetaInfo(tagname);
947  std::cout << std::endl << "test: getTagMetaInfo (result) =" << std::endl
948  << js.dump(4) << std::endl;
949  }
950  catch (const std::exception& e) {
951  std::cout << std::endl << "test: getTagMetaInfo (failed)" << std::endl;
952  std::cerr << e.what() << std::endl;
953  }
954 }

◆ testGetTagMetaInfoFs()

void testGetTagMetaInfoFs ( const std::string &  tagname)

Definition at line 1250 of file crest_example.cxx.

1250  {
1251  std::cout << std::endl << "test: getTagMetaInfoFs" << std::endl;
1252 
1253  CrestClient myCrestClient = CrestClient(true);
1254 
1255  try{
1256  nlohmann::json js = myCrestClient.getTagMetaInfo(tagname);
1257  std::cout << std::endl << "test: getTagMetaInfoFs (result) =" << std::endl
1258  << js.dump(4) << std::endl;
1259  }
1260  catch (const std::exception& e) {
1261  std::cout << std::endl << "test: getTagMetaInfoFs (failed)" << std::endl;
1262  std::cerr << e.what() << std::endl;
1263  }
1264 }

◆ testGetTagMetaInfoIOVDbSvc()

void testGetTagMetaInfoIOVDbSvc ( const std::string &  tagname)

Definition at line 1008 of file crest_example.cxx.

1008  {
1009  std::cout << std::endl << "test: getTagMetaInfoIOVDbSvc" << std::endl;
1010  CrestClient myCrestClient = CrestClient(SURL,false);
1011 
1012  try{
1013  nlohmann::json js68 = myCrestClient.getTagMetaInfoIOVDbSvc(tagname);
1014  std::cout << std::endl << "test: getTagMetaInfoIOVDbSvc (result) = " << std::endl
1015  << js68.dump(4) << std::endl;
1016  }
1017  catch (const std::exception& e) {
1018  std::cout << std::endl << "test: getTagMetaInfoIOVDbSvc (failed)" << std::endl;
1019  std::cerr << e.what() << std::endl;
1020  }
1021 }

◆ testListGlobalTags()

void testListGlobalTags ( )

Definition at line 310 of file crest_example.cxx.

310  {
311  std::cout << std::endl << "test: listGlobalTags" << std::endl;
312  CrestClient myCrestClient = CrestClient(SURL,false);
313 
314  try{
315  nlohmann::json tag_info9 = myCrestClient.listGlobalTags();
316  std::cout << std::endl << "test: listGlobalTags (result) = "
317  << tag_info9.dump(4) << std::endl;
318  }
319  catch (const std::exception& e) {
320  std::cout << std::endl << "test: listGlobalTags (failed)" << std::endl;
321  std::cout << e.what() << std::endl;
322  }
323 }

◆ testListGlobalTagsAsString()

void testListGlobalTagsAsString ( )

Definition at line 325 of file crest_example.cxx.

325  {
326  std::cout << std::endl << "test: listGlobalTagsAsString" << std::endl;
327  CrestClient myCrestClient = CrestClient(SURL,false);
328 
329  try{
330  nlohmann::json tag_info9 = myCrestClient.listGlobalTagsAsString();
331  std::cout << std::endl << "test: listGlobalTagsAsString (result) = "
332  << tag_info9.dump(4) << std::endl;
333  }
334  catch (const std::exception& e) {
335  std::cout << std::endl << "test: listGlobalTagsAsString (failed)" << std::endl;
336  std::cout << e.what() << std::endl;
337  }
338 }

◆ testListGlobalTagsParams()

void testListGlobalTagsParams ( const std::string &  name,
int  size,
int  page 
)

Definition at line 340 of file crest_example.cxx.

340  {
341  std::cout << std::endl << "test: listGlobalTagsParams with additional parameters" << std::endl;
342  CrestClientExt myCrestClient = CrestClientExt(SURL);
343 
344  try{
345  nlohmann::json list_1 = myCrestClient.listGlobalTagsParams(name, size, page);
346  nlohmann::json list_2 = myCrestClient.listGlobalTagsParams(_name = name, _size = size, _page = page);
347  nlohmann::json list_3 = myCrestClient.listGlobalTagsParams(_name = "", _size = size, _page = page);
348 
349 
350  std::cout << std::endl << "test: listGlobalTagsParams (result A) =" << std::endl;
351  std::cout << list_1.dump(4) << std::endl;
352 
353 
354  std::cout << std::endl << "test: listGlobalTagsParams (result B) =" << std::endl;
355  std::cout << list_2.dump(4) << std::endl;
356 
357 
358  std::cout << std::endl << "test: listGlobalTagsParams (result C) =" << std::endl;
359  std::cout << list_3.dump(4) << std::endl;
360  }
361  catch (const std::exception& e) {
362  std::cout << std::endl << "test: listGlobalTagsParams with additional parameters (failed)" << std::endl;
363  std::cerr << e.what() << std::endl;
364  }
365 }

◆ testListPayloadTagInfo() [1/2]

void testListPayloadTagInfo ( )

Definition at line 1060 of file crest_example.cxx.

1060  {
1061  std::cout << std::endl << "test: listPayloadTagInfo" << std::endl;
1062  CrestClient myCrestClient = CrestClient(SURL,false);
1063 
1064  try {
1065  nlohmann::json tag_list = myCrestClient.listPayloadTagInfo();
1066  std::cout << std::endl << "test: listPayloadTagInfo (result) =" << std::endl
1067  << tag_list.dump(4) << std::endl;
1068  }
1069  catch (const std::exception& e) {
1070  std::cout << std::endl << "test: listPayloadTagInfo (failed)" << std::endl;
1071  std::cerr << e.what() << std::endl;
1072  }
1073 }

◆ testListPayloadTagInfo() [2/2]

void testListPayloadTagInfo ( const std::string &  tagname)

Definition at line 1075 of file crest_example.cxx.

1075  {
1076  std::cout << std::endl << "test: listPayloadTagInfo with tag " << tagname << std::endl;
1077  CrestClient myCrestClient = CrestClient(SURL,false);
1078 
1079  try {
1081  std::cout << std::endl << "test: listPayloadTagInfo (result) =" << std::endl
1082  << tag_list.dump(4) << std::endl;
1083  }
1084  catch (const std::exception& e) {
1085  std::cout << std::endl << "test: listPayloadTagInfo (failed)" << std::endl;
1086  std::cerr << e.what() << std::endl;
1087  }
1088 }

◆ testListRunLumiInfo()

void testListRunLumiInfo ( )

Definition at line 504 of file crest_example.cxx.

504  {
505  std::cout << std::endl << "test: listRunLumiInfo" << std::endl;
506  CrestClient myCrestClient = CrestClient(SURL,false);
507 
508  try{
509  nlohmann::json info16 = myCrestClient.listRunLumiInfo();
510  std::cout << std::endl << "test: listRunLumiInfo (success) = " << std::endl;
511  std::cout << info16.dump(4) << std::endl;
512  }
513  catch (const std::exception& e) {
514  std::cout << std::endl << "test: listRunLumiInfo (failed)" << std::endl;
515  std::cout << e.what() << std::endl;
516  }
517 }

◆ testListTags()

void testListTags ( )

Definition at line 140 of file crest_example.cxx.

140  {
141  std::cout << std::endl << "test: listTag" << std::endl;
142  CrestClient myCrestClient = CrestClient(SURL,false);
143 
144  try {
145  nlohmann::json tag_list = myCrestClient.listTags();
146  std::cout << std::endl << "test: listTags (result) =" << std::endl
147  << tag_list.dump(4) << std::endl;
148  }
149  catch (const std::exception& e) {
150  std::cout << std::endl << "test: listTags (failed)" << std::endl;
151  std::cout << e.what() << std::endl;
152  }
153 }

◆ testListTagsParams() [1/2]

void testListTagsParams ( )

Definition at line 155 of file crest_example.cxx.

155  {
156  std::cout << std::endl << "test: listTagsParams" << std::endl;
157  CrestClientExt myCrestClient = CrestClientExt(SURL);
158 
159  try{
160  // variants how to call this method:
161  // myCrestClient.listTagsParams();
162  // nlohmann::json res = myCrestClient.listTagsParams(100,200);
163 
164  nlohmann::json res = myCrestClient.listTagsParams(_page = 3, _size = 5);
165 
166  std::cout << std::endl << "test: listTagsParams (result) ="
167  << "result = " << res.dump(4) << std::endl;
168  }
169  catch (const std::exception& e) {
170  std::cout << std::endl << "test: listTagsParams (failed)" << std::endl;
171  std::cerr << e.what() << std::endl;
172  }
173 }

◆ testListTagsParams() [2/2]

void testListTagsParams ( const std::string &  name)

Definition at line 175 of file crest_example.cxx.

175  {
176  std::cout << std::endl << "test: listTagsParams" << std::endl;
177  CrestClientExt myCrestClient = CrestClientExt(SURL);
178 
179  try{
180  // variants how to call this method:
181  // nlohmann::json res = myCrestClient.listTagsParams();
182  // nlohmann::json res = myCrestClient.listTagsParams("",100,200);
183 
184  nlohmann::json res1 = myCrestClient.listTagsParams(_page = 3, _size = 5);
185 
186  std::cout << "test: listTagsParams (A) = "
187  << std::endl << res1.dump(4) << std::endl;
188 
189  nlohmann::json res2 = myCrestClient.listTagsParams(_name = name, _page = 0, _size = 5);
190 
191  std::cout << "test: listTagsParams (B) = "
192  << std::endl << res2.dump(4) << std::endl;
193  }
194  catch (const std::exception& e) {
195  std::cout << std::endl << "test: listTagsParams (failed)" << std::endl;
196  std::cerr << e.what() << std::endl;
197  }
198 }

◆ testRemoveGlobalTag()

void testRemoveGlobalTag ( const std::string &  tagname)

Definition at line 367 of file crest_example.cxx.

367  {
368  std::cout << std::endl << "test: removeGlobalTag" << std::endl;
369  CrestClient myCrestClient = CrestClient(SURL,false);
370 
371  try{
372  myCrestClient.removeGlobalTag(tagname);
373  std::cout << std::endl << "test: removeGlobalTag (success)" << std::endl;
374  }
375  catch (const std::runtime_error& e) {
376  std::cout << std::endl << "test: removeGlobalTag (failed)" << std::endl;
377  }
378 }

◆ testRemoveTag()

void testRemoveTag ( const std::string &  tagname)

Definition at line 215 of file crest_example.cxx.

215  {
216  std::cout << std::endl << "test: removeTag" << std::endl;
217  CrestClient myCrestClient = CrestClient(SURL,false);
218 
219  try {
220  myCrestClient.removeTag(tagname);
221  std::cout << std::endl << "test: removeTag (success)" << std::endl;
222  }
223  catch (const std::exception& e) {
224  std::cout << std::endl << "test: removeTag (failed)" << std::endl;
225  std::cout << e.what() << std::endl;
226  }
227 }

◆ testRemoveTagFromGlobalTagMap()

void testRemoveTagFromGlobalTagMap ( const std::string &  global_tag)

Definition at line 2347 of file crest_example.cxx.

2347  {
2348  std::cout << std::endl << "test: removeTagFromGlobalTagMap" << std::endl;
2349  CrestClient myCrestClient = CrestClient(SURL,false);
2350 
2351  try{
2352  nlohmann::json tagMap = myCrestClient.findGlobalTagMap(global_tag);
2353  std::cout << std::endl << "test: GlobalTagMap (initial) = "
2354  << tagMap.dump(4) << std::endl;
2355 
2356  int n = tagMap.size();
2357  std::cout << n << " tags will be deleted:\n";
2358 
2359 
2360  for (int i = 0; i < n; i++){
2361  nlohmann::json j = tagMap[i];
2362 
2363  std::string tag = "";
2364  std::string label = "";
2365 
2366  auto subjectIdIter1 = j.find("tagName");
2367  if (subjectIdIter1 != j.end()){
2368  std::string tag = j["tagName"];
2369  std::cout << "tag name = " << tag << std::endl;
2370  }
2371 
2372  auto subjectIdIter2 = j.find("label");
2373  if (subjectIdIter2 != j.end()){
2374  label = j["label"];
2375  std::cout << "label = " << label << std::endl;
2376  }
2377 
2378  try{
2379  myCrestClient.removeTagFromGlobalTagMap(global_tag,tag,label);
2380  std::cout << tag << " removed.\n";
2381  }
2382  catch (const std::exception& e) {
2383  std::cout << std::endl << "Cannot remove tag " << tag << std::endl;
2384  std::cout << e.what() << std::endl;
2385  } // try
2386  } // for
2387 
2388  }
2389  catch (const std::exception& e) {
2390  std::cout << std::endl << "test: findGlobalTagMap (failed)" << std::endl;
2391  std::cout << e.what() << std::endl;
2392  }
2393 
2394  // Result:
2395  try{
2396  nlohmann::json tagMap = myCrestClient.findGlobalTagMap(global_tag);
2397  std::cout << std::endl << "test: GlobalTagMap (result) = "
2398  << tagMap.dump(4) << std::endl;
2399  }
2400  catch (const std::exception& e) {
2401  std::cout << std::endl << "test: tRemoveTagFromGlobalTagMap (failed)" << std::endl;
2402  std::cout << e.what() << std::endl;
2403  }
2404 
2405 }

◆ testReturnJArray()

void testReturnJArray ( )

Definition at line 1643 of file crest_example.cxx.

1643  {
1644  std::cout << std::endl << "test: returnJArray" << std::endl;
1645  CrestClient myCrestClient = CrestClient(SURL,false);
1646 
1647  nlohmann::json js = {
1648  {"name", "test"}
1649  };
1650 
1651  try {
1652  nlohmann::json res = myCrestClient.returnJArray(js);
1653  std::cout << std::endl << "test: returnJArray (result) =" << std::endl
1654  << res.dump(4) << std::endl;
1655  }
1656  catch (const std::exception& e) {
1657  std::cout << std::endl << "test: returnJArray (failed)" << std::endl;
1658  std::cout << e.what() << std::endl;
1659  }
1660 }

◆ testSelectGroups()

void testSelectGroups ( const std::string &  tagname)

Definition at line 789 of file crest_example.cxx.

789  {
790  std::cout << std::endl << "test: selectGroups" << std::endl;
791  CrestClient myCrestClient = CrestClient(SURL,false);
792 
793  try{
794  nlohmann::json tag_info = myCrestClient.selectGroups(tagname);
795  std::cout << std::endl << "test: selectGroups (result) =" << std::endl;
796  std::cout << tag_info.dump(4) << std::endl;
797  }
798  catch (const std::exception& e) {
799  std::cout << std::endl << "test: selectGroups (failed)" << std::endl;
800  std::cerr << e.what() << std::endl;
801  }
802 }

◆ testSelectGroups2()

void testSelectGroups2 ( const std::string &  tagname,
int  groupsize 
)

Definition at line 2543 of file crest_example.cxx.

2543  {
2544  std::cout << std::endl << "test: selectGroups2" << std::endl;
2545  CrestClient myCrestClient = CrestClient(SURL,false);
2546 
2547  try{
2548  nlohmann::json tag_info = myCrestClient.selectGroups(tagname, groupsize);
2549  std::cout << std::endl << "test: selectGroups2 (result) =" << std::endl;
2550  std::cout << tag_info.dump(4) << std::endl;
2551  }
2552  catch (const std::exception& e) {
2553  std::cout << std::endl << "test: selectGroups2 (failed)" << std::endl;
2554  std::cerr << e.what() << std::endl;
2555  }
2556 }

◆ testSelectIovs() [1/2]

void testSelectIovs ( const std::string &  tagname)

Definition at line 759 of file crest_example.cxx.

759  {
760  std::cout << std::endl << "test: selectIovs" << std::endl;
761  CrestClient myCrestClient = CrestClient(SURL,false);
762 
763  try{
764  nlohmann::json tag_info = myCrestClient.selectIovs(tagname);
765  std::cout << std::endl << "test: selectIovs (result) =" << std::endl;
766  std::cout << tag_info.dump(4) << std::endl;
767  }
768  catch (const std::exception& e) {
769  std::cout << std::endl << "test: selectIovs (failed)" << std::endl;
770  std::cerr << e.what() << std::endl;
771  }
772 }

◆ testSelectIovs() [2/2]

void testSelectIovs ( const std::string &  tagname,
long  since,
long  until,
long  snapshot 
)

Definition at line 774 of file crest_example.cxx.

774  {
775  std::cout << std::endl << "test: selectIovs, all paprams" << std::endl;
776  CrestClient myCrestClient = CrestClient(SURL,false);
777 
778  try{
779  nlohmann::json tag_info = myCrestClient.selectIovs(tagname, since, until, snapshot);
780  std::cout << std::endl << "test: selectIovs (result) =" << std::endl;
781  std::cout << tag_info.dump(4) << std::endl;
782  }
783  catch (const std::exception& e) {
784  std::cout << std::endl << "test: selectIovs (failed)" << std::endl;
785  std::cerr << e.what() << std::endl;
786  }
787 }

◆ testSelectIovsFS()

void testSelectIovsFS ( const std::string &  tagname,
long  since,
long  until 
)

Definition at line 741 of file crest_example.cxx.

741  {
742  std::cout << std::endl << "test: selectIovsFS with additional parameters" << std::endl;
743  CrestClient myCrestClient = CrestClient(true);
744 
745  try{
746  nlohmann::json iov_list = myCrestClient.selectIovsFS(tagname, since, until);
747 
748  std::cout << std::endl << "test: selectIovs =" << std::endl;
749  std::cout << iov_list.dump(4) << std::endl;
750 
751  std::cout << "result size = " << iov_list.size() << std::endl;
752  }
753  catch (const std::exception& e) {
754  std::cout << std::endl << "test: selectIovsFS with additional parameters (failed)" << std::endl;
755  std::cerr << e.what() << std::endl;
756  }
757 }

◆ testSelectIovsParams()

void testSelectIovsParams ( const std::string &  tagname,
long  since,
long  until 
)

Definition at line 718 of file crest_example.cxx.

718  {
719  std::cout << std::endl << "test: selectIovs with additional parameters" << std::endl;
720  CrestClientExt myCrestClient = CrestClientExt(SURL);
721 
722  try{
723  nlohmann::json iov_list_1 = myCrestClient.selectIovs(tagname, since, until);
724  nlohmann::json iov_list_2 = myCrestClient.selectIovs(tagname, since, -1);
725 
726  std::cout << std::endl << "test: selectIovs (result A) =" << std::endl;
727  std::cout << iov_list_1.dump(4) << std::endl;
728 
729  std::cout << std::endl << "test: selectIovs (result B) =" << std::endl;
730  std::cout << iov_list_2.dump(4) << std::endl;
731 
732  std::cout << "result A size = " << iov_list_1.size() << std::endl;
733  std::cout << "result B size = " << iov_list_2.size() << std::endl;
734  }
735  catch (const std::exception& e) {
736  std::cout << std::endl << "test: selectIovs with additional parameters (failed)" << std::endl;
737  std::cerr << e.what() << std::endl;
738  }
739 }

◆ testStoreBatchIOVs()

void testStoreBatchIOVs ( const std::string &  tagname1,
const std::string &  tagname2 
)

Definition at line 2086 of file crest_example.cxx.

2086  {
2087  std::cout << std::endl << "test: storeBatchIOVs" << std::endl;
2088  CrestClient myCrestClient = CrestClient(SURL,false);
2089 
2090  nlohmann::json js =
2091  {
2092  {"description", "none"},
2093  {"endOfValidity", 0},
2094  {"insertionTime", "2018-12-06T11:18:35.641+0000"},
2095  {"lastValidatedTime", 0},
2096  {"modificationTime", "2018-12-06T11:18:35.641+0000"},
2097  {"name", tagname1},
2098  {"payloadSpec", "stave: Int32, eta: Int32, mag: Float, base: Float, free: Float"},
2099  {"synchronization", "none"},
2100  {"timeType", "time"}
2101  };
2102 
2103  std::cout << "tag 1 = " << std::endl << js.dump(4) << std::endl;
2104 
2105  try{
2106  myCrestClient.createTag(js);
2107  std::cout << std::endl << "Tag " << tagname1 << " created" << std::endl;
2108  }
2109  catch (const std::exception& e) {
2110  std::cout << std::endl << "ERROR: tag " << tagname1 << " creation failed" << std::endl;
2111  std::cout << e.what() << std::endl;
2112  exit(0);
2113  }
2114 
2115  js["name"] = tagname2;
2116 
2117  std::cout << "tag 2 = " << std::endl << js.dump(4) << std::endl;
2118 
2119  try{
2120  myCrestClient.createTag(js);
2121  std::cout << std::endl << "Tag " << tagname2 << " created" << std::endl;
2122  }
2123  catch (const std::exception& e) {
2124  std::cout << std::endl << "ERROR: tag " << tagname2 << " creation failed" << std::endl;
2125  std::cout << e.what() << std::endl;
2126  exit(0);
2127  }
2128 
2129  // payloads and IOVs:
2130 
2131  uint64_t endtime = 200;
2132  std::string d1 = "\"" + myCrestClient.getDateAndTime() + "_A\"";
2133  std::string d2 = "\"" + myCrestClient.getDateAndTime() + "_B\"";
2134 
2135  std::string str = "[{\"data\":" + d1 + ",\"since\":100},{\"data\":" + d2 + ",\"since\":150}]";
2136  nlohmann::json js2 = myCrestClient.getJson(str);
2137 
2138  try {
2139  myCrestClient.storeBatchPayloads(tagname1, endtime, js2);
2140  std::cout << std::endl << "2 IOVs created in tag " << tagname1 << std::endl;
2141  }
2142  catch (const std::exception& e) {
2143  std::cout << std::endl << "ERROR: payloads and IOVs were not created." << std::endl;
2144  std::cerr << e.what() << std::endl;
2145  exit(0);
2146  }
2147 
2148  // copy the data to tag 2:
2149 
2150  try{
2151  nlohmann::json iovList = myCrestClient.findAllIovs(tagname1);
2152  std::cout << std::endl << "IOV list for tag " << tagname1 << " =" << std::endl;
2153  std::cout << iovList.dump(4) << std::endl;
2154 
2155  int listSize = iovList.size();
2156  nlohmann::json newIovList = nlohmann::json::array();
2157 
2158  for (int j = 0; j < listSize; j++) {
2159 
2160  nlohmann::json iov = iovList[j];
2161  nlohmann::json newIov = iov;
2162 
2163  newIov["tagName"] = tagname2;
2164  newIovList.push_back(newIov);
2165 
2166  } // j
2167 
2168 
2169  try{
2170  myCrestClient.storeBatchIOVs(newIovList);
2171  }
2172  catch (const std::exception& e) {
2173  std::cout << "ERROR: Cannot write the IOVs for the tag \"" << tagname2 << "\"" << std::endl;
2174  std::cerr << e.what() << std::endl;
2175  exit(0);
2176  }
2177 
2178  }
2179  catch (const std::exception& e) {
2180  std::cout << std::endl << "ERROR: cannot get IOV list for tag " << tagname1 << std::endl;
2181  std::cerr << e.what() << std::endl;
2182  exit(0);
2183  }
2184 
2185  try{
2186  nlohmann::json iovList = myCrestClient.findAllIovs(tagname2);
2187  std::cout << std::endl << "IOV list for tag " << tagname2 << " =" << std::endl;
2188  std::cout << iovList.dump(4) << std::endl;
2189  }
2190  catch (const std::exception& e) {
2191  std::cout << std::endl << "ERROR: cannot get IOV list for tag " << tagname2 << std::endl;
2192  std::cerr << e.what() << std::endl;
2193  exit(0);
2194  }
2195 
2196 }

◆ testStoreBatchPayloads()

void testStoreBatchPayloads ( const std::string &  tagname)

Definition at line 1670 of file crest_example.cxx.

1670  {
1671  std::cout << std::endl << "test: storeBatchPayloads" << std::endl;
1672  CrestClient myCrestClient = CrestClient(SURL,false);
1673 
1674  uint64_t endtime = 200;
1675  std::string str = "[{\"data\":\"aaa\",\"since\":100},{\"data\":\"bbb\",\"since\":150}]";
1676  nlohmann::json js = myCrestClient.getJson(str);
1677 
1678  try {
1679  myCrestClient.storeBatchPayloads(tagname, endtime, js);
1680  std::cout << std::endl << "test: storeBatchPayloads (success) " << std::endl;
1681  }
1682  catch (const std::exception& e) {
1683  std::cout << std::endl << "test: storeBatchPayloads (failed)" << std::endl;
1684  std::cerr << e.what() << std::endl;
1685  }
1686 }

◆ testStoreBatchPayloadsB()

void testStoreBatchPayloadsB ( const std::string &  tagname)

Definition at line 1690 of file crest_example.cxx.

1690  {
1691  std::cout << std::endl << "test: storeBatchPayloads2" << std::endl;
1692  CrestClient myCrestClient = CrestClient(SURL,false);
1693 
1694  uint64_t endtime = 200;
1695  std::string d1 = "\"" + myCrestClient.getDateAndTime() + "_A\"";
1696  std::string d2 = "\"" + myCrestClient.getDateAndTime() + "_B\"";
1697 
1698  std::string str = "[{\"data\":" + d1 + ",\"since\":100},{\"data\":" + d2 + ",\"since\":150}]";
1699  nlohmann::json js = myCrestClient.getJson(str);
1700 
1701  try {
1702  myCrestClient.storeBatchPayloads(tagname, endtime, js);
1703  std::cout << std::endl << "test: storeBatchPayloads2 (success) " << std::endl;
1704  }
1705  catch (const std::exception& e) {
1706  std::cout << std::endl << "test: storeBatchPayloads2 (failed)" << std::endl;
1707  std::cerr << e.what() << std::endl;
1708  }
1709 }

◆ testStoreBatchPayloadsFiles()

void testStoreBatchPayloadsFiles ( const std::string &  tagname)

Definition at line 2407 of file crest_example.cxx.

2407  {
2408  std::cout << std::endl << "test: storeBatchPayloadsFiles" << std::endl;
2409  CrestClient myCrestClient = CrestClient(SURL,false);
2410 
2411  uint64_t endtime = 200;
2412  std::string d1 = "\"" + myCrestClient.getDateAndTime() + "_A\"";
2413  std::string d2 = "\"" + myCrestClient.getDateAndTime() + "_B\"";
2414 
2415  std::string file1 = "/tmp/mvg01.txt";
2416  std::string file2 = "/tmp/mvg02.txt";
2417 
2418  std::ofstream out1;
2419  out1.open(file1);
2420  if (out1.is_open()){
2421  out1 << d1;
2422  }
2423  out1.close();
2424 
2425  std::ofstream out2;
2426  out2.open(file2);
2427  if (out2.is_open()){
2428  out2 << d2;
2429  }
2430  out2.close();
2431 
2432  d1 = "file://" + file1;
2433  d2 = "file://" + file2;
2434 
2435  std::string str = "[{\"data\":\"" + d1 + "\",\"since\":100},{\"data\":\"" + d2 + "\",\"since\":150}]";
2436  nlohmann::json js = myCrestClient.getJson(str);
2437 
2438  std::cout << "json = " << js.dump(4) << std::endl;
2439 
2440  try {
2441  myCrestClient.storeBatchPayloadsFiles(tagname, endtime, js);
2442  std::cout << std::endl << "test: storeBatchPayloadsFiles (success) " << std::endl;
2443  }
2444  catch (const std::exception& e) {
2445  std::cout << std::endl << "test: storeBatchPayloadsFiles (failed)" << std::endl;
2446  std::cerr << e.what() << std::endl;
2447  }
2448 }

◆ testStoreBatchPayloadsFs()

void testStoreBatchPayloadsFs ( const std::string &  tagname)

Definition at line 1362 of file crest_example.cxx.

1362  {
1363  std::cout << std::endl << "test: storeBatchPayloads" << std::endl;
1364 
1365  bool rewrite = true;
1366  CrestClient myCrestClient = CrestClient(rewrite);
1367 
1368  uint64_t endtime = 200;
1369  std::string str = "[{\"data\":\"aaa\",\"since\":100},{\"data\":\"bbb\",\"since\":150}]";
1370  nlohmann::json js = myCrestClient.getJson(str);
1371 
1372  try {
1373  myCrestClient.storeBatchPayloads(tagname, endtime, js);
1374  std::cout << std::endl << "test: storeBatchPayloads (success) " << std::endl;
1375  }
1376  catch (const std::exception& e) {
1377  std::cout << std::endl << "test: storeBatchPayloads (failed)" << std::endl;
1378  std::cerr << e.what() << std::endl;
1379  }
1380 }

◆ testStoreData()

void testStoreData ( const std::string &  tagname)

Definition at line 2451 of file crest_example.cxx.

2451  {
2452  std::cout << std::endl << "test: storeData" << std::endl;
2453  CrestClient myCrestClient = CrestClient(SURL,false);
2454 
2455  uint64_t endtime = 200;
2456  uint64_t since = 100;
2457  std::string d1 = "\"" + myCrestClient.getDateAndTime() + "_A\"";
2458 
2459  std::string file = "/tmp/mvg01.txt";
2460 
2461  std::ofstream out1;
2462  out1.open(file);
2463  if (out1.is_open()){
2464  out1 << d1;
2465  }
2466  out1.close();
2467 
2468  try {
2469  myCrestClient.storeData(tagname, endtime, since, file);
2470  std::cout << std::endl << "test: storeData (success) " << std::endl;
2471  }
2472  catch (const std::exception& e) {
2473  std::cout << std::endl << "test: storeData (failed)" << std::endl;
2474  std::cerr << e.what() << std::endl;
2475  }
2476 }

◆ testStoreDataArray()

void testStoreDataArray ( const std::string &  tagname)

Definition at line 2478 of file crest_example.cxx.

2478  {
2479  std::cout << std::endl << "test: storeDataArray" << std::endl;
2480  CrestClient myCrestClient = CrestClient(SURL,false);
2481 
2482  uint64_t endtime = 200;
2483  uint64_t since1 = 100;
2484  uint64_t since2 = 150;
2485  std::string d1 = "\"" + myCrestClient.getDateAndTime() + "_A\"";
2486  std::string d2 = "\"" + myCrestClient.getDateAndTime() + "_B\"";
2487 
2488  std::string file1 = "/tmp/mvg01.txt";
2489  std::string file2 = "/tmp/mvg02.txt";
2490 
2491  std::map<uint64_t, std::string> data;
2492 
2493  std::ofstream out1;
2494  out1.open(file1);
2495  if (out1.is_open()){
2496  out1 << d1;
2497  }
2498  out1.close();
2499 
2500  std::ofstream out2;
2501  out2.open(file2);
2502  if (out2.is_open()){
2503  out2 << d2;
2504  }
2505  out2.close();
2506 
2507  data[since1] = file1;
2508  data[since2] = file2;
2509 
2510  try {
2511  myCrestClient.storeDataArray(tagname, endtime, data);
2512  std::cout << std::endl << "test: storeDataArray (success) " << std::endl;
2513  }
2514  catch (const std::exception& e) {
2515  std::cout << std::endl << "test: storeDataArray (failed)" << std::endl;
2516  std::cerr << e.what() << std::endl;
2517  }
2518 }

◆ testStorePayload()

void testStorePayload ( const std::string &  tagname)

Definition at line 597 of file crest_example.cxx.

597  {
598  std::cout << std::endl << "test: storePayload" << std::endl;
599  CrestClient myCrestClient = CrestClient(SURL,false);
600 
601  // payload + tag name (command line example):
602  // curl --form file=@./test.txt --form tag="SB_TAG-PYLD" --form since=0
603  // http://mvg-test-pc-03.cern.ch:8090/crestapi/payloads/store
604 
605  uint64_t since = 0;
606  std::string payload = "aaa";
607 
608 
609  try{
610  myCrestClient.storePayload(tagname, since, payload);
611  std::cout << std::endl << "test: storePayload (success)" << std::endl;
612  }
613  catch (const std::exception& e) {
614  std::cout << std::endl << "test: storePayload (failed)" << std::endl;
615  std::cout << e.what() << std::endl;
616  }
617 }

◆ testStorePayloadDump()

void testStorePayloadDump ( const std::string &  tagname)

Definition at line 621 of file crest_example.cxx.

621  {
622  std::cout << std::endl << "test: storePayloadDump" << std::endl;
623  bool rewrite = true;
624  std::string path = "/tmp/cresttest/crest_dump";
625  std::filesystem::create_directories(path);
626  CrestClient myCrestClient = CrestClient(rewrite, path);
627 
628  uint64_t since = 200;
629 
630 
631  std::string str =
632  "{\"niovs\": 2,\"format\":\"PYLD_JSON\",\"iovsList\":[{\"since\":800,\"payload\":\"vv1\"},{\"since\":900,\"payload\":\"ww1\"}]}";
633 
634  nlohmann::json js = myCrestClient.getJson(str);
635 
636  try {
637  myCrestClient.storePayloadDump(tagname, since, str);
638  std::cout << std::endl << "test: storePayloadDump (success) " << std::endl;
639  }
640  catch (const std::exception& e) {
641  std::cout << std::endl << "test: storePayloadDump (failed)" << std::endl;
642  std::cout << e.what() << std::endl;
643  }
644 }

◆ testTagAndStoreBatchFs()

void testTagAndStoreBatchFs ( const std::string &  tagname)

Definition at line 1771 of file crest_example.cxx.

1771  {
1772  std::cout << std::endl << "test: createTagFs" << std::endl;
1773 
1774  bool rewrite = true;
1775  CrestClient myCrestClient = CrestClient(rewrite);
1776 
1777  nlohmann::json js =
1778  {
1779  {"description", "none"},
1780  {"endOfValidity", 0},
1781  {"insertionTime", "2018-12-06T11:18:35.641+0000"},
1782  {"lastValidatedTime", 0},
1783  {"modificationTime", "2018-12-06T11:18:35.641+0000"},
1784  {"name", tagname},
1785  {"payloadSpec", "stave: Int32, eta: Int32, mag: Float, base: Float, free: Float"},
1786  {"synchronization", "none"},
1787  {"timeType", "time"}
1788  };
1789 
1790  try{
1791  myCrestClient.createTag(js);
1792  std::cout << std::endl << "test: createTagFs (success)" << std::endl;
1793  }
1794  catch (const std::exception& e) {
1795  std::cout << std::endl << "test: createTagFs (failed)" << std::endl;
1796  std::cout << e.what() << std::endl;
1797  }
1798 
1799  uint64_t endtime = 200;
1800  std::string str = "[{\"data\":\"aaa\",\"since\":100},{\"data\":\"bbb\",\"since\":150}]";
1801  nlohmann::json js2 = myCrestClient.getJson(str);
1802 
1803  try {
1804  myCrestClient.storeBatchPayloads(tagname, endtime, js2);
1805  std::cout << std::endl << "test: storeBatchPayloads (success) " << std::endl;
1806  }
1807  catch (const std::exception& e) {
1808  std::cout << std::endl << "test: storeBatchPayloads (failed)" << std::endl;
1809  std::cerr << e.what() << std::endl;
1810  }
1811 }

◆ testTagAndStoreBatchFsB()

void testTagAndStoreBatchFsB ( const std::string &  tagname)

Definition at line 1813 of file crest_example.cxx.

1813  {
1814  std::cout << std::endl << "test: createTagFs" << std::endl;
1815 
1816  bool rewrite = true;
1817  CrestClient myCrestClient = CrestClient(rewrite);
1818 
1819  nlohmann::json js =
1820  {
1821  {"description", "none"},
1822  {"endOfValidity", 0},
1823  {"insertionTime", "2018-12-06T11:18:35.641+0000"},
1824  {"lastValidatedTime", 0},
1825  {"modificationTime", "2018-12-06T11:18:35.641+0000"},
1826  {"name", tagname},
1827  {"payloadSpec", "stave: Int32, eta: Int32, mag: Float, base: Float, free: Float"},
1828  {"synchronization", "none"},
1829  {"timeType", "time"}
1830  };
1831 
1832  try{
1833  myCrestClient.createTag(js);
1834  std::cout << std::endl << "test: createTagFs (success)" << std::endl;
1835  }
1836  catch (const std::exception& e) {
1837  std::cout << std::endl << "test: createTagFs (failed)" << std::endl;
1838  std::cout << e.what() << std::endl;
1839  }
1840 
1841  uint64_t endtime = 200;
1842  std::string d1 = "\"" + myCrestClient.getDateAndTime() + "_A\"";
1843  std::string d2 = "\"" + myCrestClient.getDateAndTime() + "_B\"";
1844 
1845  std::string str = "[{\"payloadHash\":" + d1 + ",\"since\":100},{\"payloadHash\":" + d2 + ",\"since\":150}]";
1846  nlohmann::json js2 = myCrestClient.getJson(str);
1847 
1848  try {
1849  myCrestClient.storeBatchPayloads(tagname, endtime, js2);
1850  std::cout << std::endl << "test: storeBatchPayloads A (success) " << std::endl;
1851  }
1852  catch (const std::exception& e) {
1853  std::cout << std::endl << "test: storeBatchPayloads A (failed)" << std::endl;
1854  std::cerr << e.what() << std::endl;
1855  }
1856 
1857  d1 = "\"" + myCrestClient.getDateAndTime() + "_C\"";
1858  d2 = "\"" + myCrestClient.getDateAndTime() + "_D\"";
1859 
1860  str = "[{\"data\":" + d1 + ",\"since\":200},{\"data\":" + d2 + ",\"since\":250}]";
1861  js2 = myCrestClient.getJson(str);
1862 
1863  try {
1864  myCrestClient.storeBatchPayloads(tagname, endtime, js2);
1865  std::cout << std::endl << "test: storeBatchPayloads B (success) " << std::endl;
1866  }
1867  catch (const std::exception& e) {
1868  std::cout << std::endl << "test: storeBatchPayloads B (failed)" << std::endl;
1869  std::cerr << e.what() << std::endl;
1870  }
1871 }

◆ testTagAndStoreBatchFsNItems()

void testTagAndStoreBatchFsNItems ( const std::string &  tagname,
int  n 
)

Definition at line 1713 of file crest_example.cxx.

1713  {
1714  std::cout << std::endl << "test: createTagFs" << std::endl;
1715 
1716  bool rewrite = true;
1717  CrestClient myCrestClient = CrestClient(rewrite);
1718 
1719  nlohmann::json js =
1720  {
1721  {"description", "none"},
1722  {"endOfValidity", 0},
1723  {"insertionTime", "2018-12-06T11:18:35.641+0000"},
1724  {"lastValidatedTime", 0},
1725  {"modificationTime", "2018-12-06T11:18:35.641+0000"},
1726  {"name", tagname},
1727  {"payloadSpec", "stave: Int32, eta: Int32, mag: Float, base: Float, free: Float"},
1728  {"synchronization", "none"},
1729  {"timeType", "time"}
1730  };
1731 
1732  try{
1733  myCrestClient.createTag(js);
1734  std::cout << std::endl << "test: storeBatchPayloads for N items (a tag created)" << std::endl;
1735  }
1736  catch (const std::exception& e) {
1737  std::cout << std::endl << "test: storeBatchPayloads for N items (tag creation failed)" << std::endl;
1738  std::cout << e.what() << std::endl;
1739  }
1740 
1741  int step = 10;
1742  uint64_t endtime = (n + 1) * step;
1743 
1745 
1746  for (int i = 1; i <= n; i++) {
1747  int since = i * step;
1748  std::string d = myCrestClient.getDateAndTime() + "_" + std::to_string(i);
1749 
1750  nlohmann::json itemD =
1751  {
1752  {"data", d},
1753  {"since", since}
1754  };
1755 
1756  data.push_back(itemD);
1757  } // end i
1758 
1759  try {
1760  myCrestClient.storeBatchPayloads(tagname, endtime, data);
1761  std::cout << std::endl << "test: storeBatchPayloads for N items (success) " << std::endl;
1762  }
1763  catch (const std::exception& e) {
1764  std::cout << std::endl << "test: storeBatchPayloads for N items (failed)" << std::endl;
1765  std::cerr << e.what() << std::endl;
1766  }
1767 }

◆ testUpdateGlobalTag()

void testUpdateGlobalTag ( const std::string &  tagname)

Definition at line 380 of file crest_example.cxx.

380  {
381  std::cout << std::endl << "test: updateGlobalTag" << std::endl;
382  CrestClient myCrestClient = CrestClient(SURL,false);
383 
384  nlohmann::json js =
385  {
386  {"name", tagname},
387  {"validity", 0},
388  {"description", "test"},
389  {"release", "1"},
390  {"insertionTime", "2018-12-18T11:32:58.081+0000"},
391  {"snapshotTime", "2018-12-18T11:32:57.952+0000"},
392  {"scenario", "test2"},
393  {"workflow", "M"},
394  {"type", "t"},
395  {"snapshotTimeMilli", "null"},
396  {"insertionTimeMilli", "null"}
397  };
398 
399  try {
400  myCrestClient.updateGlobalTag(tagname, js);
401  std::cout << std::endl << "test: updateGlobalTag (success) " << std::endl;
402  }
403  catch (const std::exception& e) {
404  std::cout << std::endl << "test: updateGlobalTag (failed)" << std::endl;
405  std::cout << e.what() << std::endl;
406  }
407 }

◆ testUpdateTag()

void testUpdateTag ( const std::string &  tagname)

Definition at line 229 of file crest_example.cxx.

229  {
230  std::cout << std::endl << "test: updateTag" << std::endl;
231  CrestClient myCrestClient = CrestClient(SURL,false);
232 
233  nlohmann::json js = {{"objectType", "json3"},
234  {"description", "test"}};
235 
236  try{
237  myCrestClient.updateTag(tagname, js);
238  std::cout << std::endl << "test: updateTag (success)" << std::endl;
239  }
240  catch (const std::exception& e) {
241  std::cout << std::endl << "test: updateTag (failed)" << std::endl;
242  std::cout << e.what() << std::endl;
243  }
244 }

◆ testUpdateTagMetainfo()

void testUpdateTagMetainfo ( const std::string &  tagname)

Definition at line 956 of file crest_example.cxx.

956  {
957  std::cout << std::endl << "test: updateTagMetainfo" << std::endl;
958  CrestClient myCrestClient = CrestClient(SURL,false);
959 
960  nlohmann::json js =
961  {
962  {"tagName", tagname},
963  {"description", "desc-02"}
964  };
965 
966  try{
967  myCrestClient.updateTagMetaInfo(js);
968  std::cout << std::endl << "test: updateTagMetaInfo (success)" << std::endl;
969  }
970  catch (const std::exception& e) {
971  std::cout << std::endl << "test: updateTagMetainfo (failed)" << std::endl;
972  std::cerr << e.what() << std::endl;
973  }
974 }

◆ testUpdateTagMetaInfoFs()

void testUpdateTagMetaInfoFs ( const std::string &  tagname)

Definition at line 1266 of file crest_example.cxx.

1266  {
1267  std::cout << std::endl << "test: updateTagMetainfoFs" << std::endl;
1268  CrestClient myCrestClient = CrestClient(true);
1269 
1270  nlohmann::json channel = {{"0", "ATLAS_PREFERRED"}};
1271 
1272  std::cout << std::endl << "channel = " << std::endl
1273  << channel.dump(4) << std::endl;
1274 
1276 
1277  nlohmann::json tagInfo =
1278  {
1279  {"channel_list", chanList},
1280  {"node_description", "description of the node"},
1281  {"payload_spec", "payload specification"}
1282  };
1283 
1284  std::cout << std::endl << "TagInfo = " << std::endl
1285  << tagInfo.dump(4) << std::endl;
1286 
1287  std::cout << std::endl << "TagInfo = " << std::endl
1288  << tagInfo.dump() << std::endl;
1289 
1290  nlohmann::json js =
1291  {
1292  {"tagName", tagname},
1293  {"description", "none"},
1294  {"chansize", 1},
1295  {"colsize", 6},
1296  {"tagInfo", tagInfo.dump()},
1297  {"insertionTime", "2020-12-04"}
1298  };
1299 
1300  try{
1301  // myCrestClient.updateTagMetaInfoFs(tagname+"a",js); // test for wrong tag name, uncomment it if you want test this
1302  // case.
1303  myCrestClient.updateTagMetaInfoFs(tagname, js);
1304  std::cout << std::endl << "test: updateTagMetaInfoFs (success)" << std::endl;
1305  }
1306  catch (const std::exception& e) {
1307  std::cout << std::endl << "test: updateTagMetaInfoFs (failed)" << std::endl;
1308  std::cerr << e.what() << std::endl;
1309  }
1310 }

◆ testUpdateTagSpecification()

void testUpdateTagSpecification ( const std::string &  tagname)

Definition at line 246 of file crest_example.cxx.

246  {
247  std::cout << std::endl << "test: updateTagSpecification" << std::endl;
248  CrestClient myCrestClient = CrestClient(SURL,false);
249 
250  std::string newObjectType = "json4";
251 
252  try{
253  myCrestClient.updateTagSpecification(tagname, newObjectType);
254  std::cout << std::endl << "test: updateTagSpecification (success)" << std::endl;
255  }
256  catch (const std::exception& e) {
257  std::cout << std::endl << "test: updateTagSpecification (failed)" << std::endl;
258  std::cout << e.what() << std::endl;
259  }
260 }

Variable Documentation

◆ ATLAS_NO_CHECK_FILE_THREAD_SAFETY

ATLAS_NO_CHECK_FILE_THREAD_SAFETY

Definition at line 22 of file crest_example.cxx.

◆ SURL

std::string SURL = "http://crest-01.cern.ch:8090"

Definition at line 27 of file crest_example.cxx.

grepfile.info
info
Definition: grepfile.py:38
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Crest::CrestClient::getPayloadAsJsonFS
nlohmann::json getPayloadAsJsonFS(const std::string &hash)
This auxillary method finds a payload resource associated to the hash in the local file storage.
Definition: CrestApi.cxx:2566
beamspotman.r
def r
Definition: beamspotman.py:676
Crest::CrestClient::getBlob
std::string getBlob(const std::string &hash)
This method finds payload data by hash; the payload object contains the real BLOB.
Definition: CrestApi.cxx:915
Crest::CrestClient::getBlobInStreamFs
std::string getBlobInStreamFs(const std::string &hash, std::ofstream &out)
This method finds payload data by hash; the payload object contains the real BLOB.
Definition: CrestApi.cxx:2610
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Crest::CrestClient::selectIovs
nlohmann::json selectIovs(const std::string &tagname)
Select iovs for a given tagname.
Definition: CrestApi.cxx:493
testCreateTag
void testCreateTag(const std::string &tagname)
Definition: crest_example.cxx:49
Crest::CrestClient::findGlobalTagMapFs
nlohmann::json findGlobalTagMapFs(const std::string &name)
The auxillary method to find a global tag by name for the file storage.
Definition: CrestApi.cxx:2412
Crest::CrestClient::findAllIovs
nlohmann::json findAllIovs(const std::string &tagname)
This method finds all iovs for a given tag name.
Definition: CrestApi.cxx:390
dqt_zlumi_alleff_HIST.iov
iov
Definition: dqt_zlumi_alleff_HIST.py:119
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Crest::CrestClient::getTagDataInfo
void getTagDataInfo(const std::string &tagname)
This is an auxillary method for checking how many unique IOVs(hashcodes) are in an IOV list.
Definition: CrestApi.cxx:2712
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:126
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
Crest::CrestClient::getDateAndTime
std::string getDateAndTime()
The auxillary method to get a current data and time.
Definition: CrestApi.cxx:2534
Crest::CrestClient::createTagMetaInfoIOVDbSvc
void createTagMetaInfoIOVDbSvc(const std::string &tagname, nlohmann::json &js)
This method creates a tag meta info in the CREST database.
Definition: CrestApi.cxx:2134
Crest::CrestClient::getPayloadMetaInfoAsJsonFS
nlohmann::json getPayloadMetaInfoAsJsonFS(const std::string &hash)
This auxillary method finds a payload resource associated to the hash in the local file storage.
Definition: CrestApi.cxx:2594
Crest::CrestClient::getJson
nlohmann::json getJson(const std::string &str)
Auxillary method to convert string in to JSON object.
Definition: CrestApi.cxx:1650
json
nlohmann::json json
Definition: HistogramDef.cxx:9
Crest::CrestClient::createTag
void createTag(nlohmann::json &js)
This method creates a tag in the CREST database.
Definition: CrestApi.cxx:262
find_tgc_unfilled_channelids.iovs
iovs
Definition: find_tgc_unfilled_channelids.py:12
Crest::CrestClient::getBlobInStream
std::string getBlobInStream(const std::string &hash, std::ofstream &out)
This method finds payload data by hash; the payload object contains the real BLOB.
Definition: CrestApi.cxx:936
hist_file_dump.d
d
Definition: hist_file_dump.py:137
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
Crest::CrestClient::getTagMetaInfo
nlohmann::json getTagMetaInfo(const std::string &tagname)
This method gets a tag meta info from the CREST database.
Definition: CrestApi.cxx:2037
Crest::CrestClient::findGlobalTagMap
nlohmann::json findGlobalTagMap(const std::string &name)
This method search for mappings using the global tag name.
Definition: CrestApi.cxx:849
DMTest::C
C_v1 C
Definition: C.h:26
Crest::CrestClient::createGlobalTag
void createGlobalTag(nlohmann::json &js)
Create a global tag in the database.
Definition: CrestApi.cxx:688
picosha2::hash256_hex_string
void hash256_hex_string(InIter first, InIter last, std::string &hex_str)
Definition: picosha2.h:353
skel.it
it
Definition: skel.GENtoEVGEN.py:423
Crest::CrestClient::selectIovsFS
nlohmann::json selectIovsFS(const std::string &tagname, long since, long until)
This method selects all iovs for a given tag name and for the selected time interval (since-until).
Definition: CrestApi.cxx:2689
Crest::CrestClient::storeData
void storeData(const std::string &tag, uint64_t endtime, uint64_t since, const std::string &file)
This method stores a payload from a file in the database, associated to a given IOV since and tag nam...
Definition: CrestApi.cxx:3119
Crest::CrestClient::getSize
int getSize(const std::string &tagname)
This metghod gets the number of iovs for the given tag.
Definition: CrestApi.cxx:454
dq_defect_virtual_defect_validation.d1
d1
Definition: dq_defect_virtual_defect_validation.py:79
Crest::CrestClient::findGlobalTag
nlohmann::json findGlobalTag(const std::string &name)
Finds a global tag by name.
Definition: CrestApi.cxx:745
WriteCaloSwCorrections.tag_list
tag_list
Definition: WriteCaloSwCorrections.py:28
Crest::CrestClient::getHash
std::string getHash(std::string_view str)
The auxillary method to calculate a hash code for a given string.
Definition: CrestApi.cxx:2441
Crest::CrestClient::listGlobalTags
nlohmann::json listGlobalTags()
This method finds a global tag lists.
Definition: CrestApi.cxx:773
Crest::CrestClient::updateGlobalTag
void updateGlobalTag(const std::string &name, nlohmann::json body)
This method allows to update a GlobalTag.Arguments: the name has to uniquely identify a global tag.
Definition: CrestApi.cxx:672
LArCellConditions.argv
argv
Definition: LArCellConditions.py:112
testFindTag
void testFindTag(const std::string &tagname)
Definition: crest_example.cxx:200
Crest::CrestClient::checkCrestVersion2
void checkCrestVersion2()
This method is a CREST version test.
Definition: CrestApi.cxx:2889
Crest::CrestClient::getPayloadMetaInfo
nlohmann::json getPayloadMetaInfo(const std::string &hash)
This method finds a payload resource associated to the hash.
Definition: CrestApi.cxx:956
Crest::CrestClient::storeDataArray
void storeDataArray(const std::string &tag, uint64_t endtime, std::map< uint64_t, std::string > m)
This method stores several payloads from files in batch mode.
Definition: CrestApi.cxx:3130
Crest::CrestClient::updateTagMetaInfoFs
void updateTagMetaInfoFs(const std::string &tagname, nlohmann::json &js)
This auxillary method updates a tag meta info in local file storage.
Definition: CrestApi.cxx:2224
Crest::CrestClient::getPayloadAsStringFS
std::string getPayloadAsStringFS(const std::string &hash)
This auxillary method finds a payload resource associated to the hash in the local file storage.
Definition: CrestApi.cxx:2547
Crest::CrestClient::removeTagFromGlobalTagMap
void removeTagFromGlobalTagMap(const std::string &global_tag, const std::string &tag, const std::string &label)
This method removes a tag with the name tag and the label from the global tag map with name global_ta...
Definition: CrestApi.cxx:2902
Crest::CrestClient::getBlobFs
std::string getBlobFs(const std::string &hash)
This method finds payload data by hash in the file storage; the payload object contains the real BLOB...
Definition: CrestApi.cxx:2600
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
dq_defect_copy_defect_database.since
def since
Definition: dq_defect_copy_defect_database.py:54
dqt_zlumi_alleff_HIST.A
A
Definition: dqt_zlumi_alleff_HIST.py:110
dq_defect_copy_defect_database.until
def until
Definition: dq_defect_copy_defect_database.py:55
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Crest::CrestClient::convertTagMetaInfo2CREST
nlohmann::json convertTagMetaInfo2CREST(nlohmann::json &js)
Auxillary method to convert a Tag Meta Info from the JSON IOVDbSvc format in CREST Server format.
Definition: CrestApi.cxx:1955
Crest::CrestClient::storeBatchPayloadsFiles
void storeBatchPayloadsFiles(const std::string &tag_name, uint64_t endtime, nlohmann::json &js)
This method stores several payloads from files in batch mode.
Definition: CrestApi.cxx:2925
Crest::CrestClient::listTags
nlohmann::json listTags(void)
This method returns the tag list.
Definition: CrestApi.cxx:103
Crest::CrestClient::updateTag
void updateTag(const std::string &tagname, nlohmann::json body)
This method allows to update tag record in the CREST DB.
Definition: CrestApi.cxx:278
Crest::CrestClient::storeBatchPayloads
void storeBatchPayloads(const std::string &tag_name, uint64_t endtime, const std::string &iovsetupload)
This method stores several payloads in batch mode.
Definition: CrestApi.cxx:1102
Crest::CrestClient::getPayloadAsString
std::string getPayloadAsString(const std::string &hash)
This method finds a payload resource associated to the hash.
Definition: CrestApi.cxx:1066
lumiFormat.i
int i
Definition: lumiFormat.py:92
Crest::CrestClient::getCrestVersion
std::string getCrestVersion()
This method returns the full CREST Server version.
Definition: CrestApi.cxx:2783
beamspotman.n
n
Definition: beamspotman.py:731
Crest::CrestClient::createGlobalTagMapFs
void createGlobalTagMapFs(nlohmann::json &js)
The auxillary method to create a global tag map in file storage.
Definition: CrestApi.cxx:2329
Crest::CrestClient::returnJArray
nlohmann::json returnJArray(nlohmann::json js)
This auxillary method creates a JSON array from a JSON object.
Definition: CrestApi.cxx:2639
calibdata.exception
exception
Definition: calibdata.py:496
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
print_path
void print_path()
Definition: crest_example.cxx:29
file
TFile * file
Definition: tile_monitor.h:29
Crest::CrestClient::getSizeFS
int getSizeFS(const std::string &tagname)
This metghod gets the number of iovs for the given tag.
Definition: CrestApi.cxx:2645
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
Crest::CrestClient::findTag
nlohmann::json findTag(const std::string &name)
This method finds a tag by the name.
Definition: CrestApi.cxx:226
Crest::data
Definition: CrestApi.cxx:1269
Crest::CrestClient::createGlobalTagMap
void createGlobalTagMap(nlohmann::json &gt)
Method to create a global tag map.
Definition: CrestApi.cxx:872
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
Crest::CrestClient::getPayloadMetaInfoAsStringFS
std::string getPayloadMetaInfoAsStringFS(const std::string &hash)
This auxillary method finds a payload resource associated to the hash in the local file storage.
Definition: CrestApi.cxx:2572
Crest::CrestClientExt
Definition: CrestApiExt.h:30
Crest::CrestClient::getCrestVersion2
std::string getCrestVersion2()
This method returns the full CREST Server version.
Definition: CrestApi.cxx:2863
calibdata.exit
exit
Definition: calibdata.py:236
beamspotman.dir
string dir
Definition: beamspotman.py:623
CheckTagAssociation.globaltag
globaltag
Definition: CheckTagAssociation.py:18
Crest::CrestClient::storePayloadDump
void storePayloadDump(const std::string &tag, uint64_t since, const std::string &js)
Method to store a payload in the local file system.
Definition: CrestApi.cxx:2446
lumiFormat.array
array
Definition: lumiFormat.py:98
Crest::CrestClient::listPayloadTagInfo
nlohmann::json listPayloadTagInfo()
This method retrieves monitoring information on all payloads as a list of payload tag information.
Definition: CrestApi.cxx:1023
Crest::CrestClient::getFirstLetters
std::string getFirstLetters(const std::string &str)
This is an auxillary method extract first letters from the string (hash).
Definition: CrestApi.cxx:2762
Crest::CrestClient::getClientVersion
std::string getClientVersion()
This method returns the full CrestApi version.
Definition: CrestApi.cxx:2809
Crest::CrestClient::updateTagMetaInfo
void updateTagMetaInfo(nlohmann::json &js)
This method updates a tag meta info in the CREST database.
Definition: CrestApi.cxx:2060
Crest::CrestClient::storePayload
void storePayload(const std::string &tag, uint64_t since, const std::string &js)
Create a payload in the database, associated to a given iov since and tag name.
Definition: CrestApi.cxx:1252
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
Crest::CrestClient::updateTagSpecification
void updateTagSpecification(const std::string &tagname, const std::string &objectType)
This method cahnges object type specification.
Definition: CrestApi.cxx:293
Crest::CrestClient::checkCrestVersion
void checkCrestVersion()
This method is a CREST version test.
Definition: CrestApi.cxx:2833
Crest::CrestClient::getMgmtInfo
nlohmann::json getMgmtInfo()
This is an auxillary method to read the CREST Server properties.
Definition: CrestApi.cxx:2767
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
Crest::CrestClient::findGlobalTagAsString
std::string findGlobalTagAsString(const std::string &name)
Finds a global tag by name.
Definition: CrestApi.cxx:724
Crest::CrestClient::storeBatchIOVs
void storeBatchIOVs(nlohmann::json &js)
This method stores an IOV set on the CREST server.
Definition: CrestApi.cxx:630
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MyPlots.page
page
Definition: MyPlots.py:234
get_generator_info.version
version
Definition: get_generator_info.py:33
SURL
std::string SURL
Definition: crest_example.cxx:27
testRemoveTag
void testRemoveTag(const std::string &tagname)
Definition: crest_example.cxx:215
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
Crest::CrestClient::createIov
void createIov(nlohmann::json &iov)
This method creates an iov for a given tag in the CREST DB for the created payload.
Definition: CrestApi.cxx:370
Crest::CrestClient::selectGroups
nlohmann::json selectGroups(const std::string &tagname)
Select groups for a given tagname.
Definition: CrestApi.cxx:579
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
dq_defect_virtual_defect_validation.d2
d2
Definition: dq_defect_virtual_defect_validation.py:81
Crest::CrestClient::createTagMetaInfo
void createTagMetaInfo(nlohmann::json &js)
This method creates a tag meta info in the CREST database.
Definition: CrestApi.cxx:1998
Crest::CrestClient
Definition: CrestApi.h:62
Crest::CrestClient::getMajorVersion
int getMajorVersion(std::string &str)
This is an auxillary method to extract a major version number from full version string.
Definition: CrestApi.cxx:2813
Crest::CrestClient::removeTag
void removeTag(const std::string &tagName)
This method allows to remove a Tag.
Definition: CrestApi.cxx:209
tagname
Definition: tagname.h:29
LArCellBinning.step
step
Definition: LArCellBinning.py:158
PlotCalibFromCool.iovList
iovList
Definition: PlotCalibFromCool.py:351
str
Definition: BTagTrackIpAccessor.cxx:11
Crest::CrestClient::listRunLumiInfo
nlohmann::json listRunLumiInfo()
This method gets full list of run/lumi information data.
Definition: CrestApi.cxx:1198
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
Crest::CrestClient::getPayloadAsJson
nlohmann::json getPayloadAsJson(const std::string &hash)
This method finds a payload resource associated to the hash.
Definition: CrestApi.cxx:1042
Crest::CrestClient::getTagMetaInfoIOVDbSvc
nlohmann::json getTagMetaInfoIOVDbSvc(const std::string &tagname)
This method gets a tag meta info from the CREST database in IOVDbSvc format.
Definition: CrestApi.cxx:2120
Crest::CrestClient::getPayloadMetaInfoAsString
std::string getPayloadMetaInfoAsString(const std::string &hash)
This method finds a payload resource associated to the hash.
Definition: CrestApi.cxx:980
Crest::CrestClient::createRunLumiInfo
void createRunLumiInfo(nlohmann::json &body)
This method creates an entry for run information.
Definition: CrestApi.cxx:1216
Crest::CrestClient::findGlobalTagFs
nlohmann::json findGlobalTagFs(const std::string &name)
The auxillary method to find a global tag by name stored in file storage.
Definition: CrestApi.cxx:2307
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
Crest::CrestClient::createGlobalTagFs
void createGlobalTagFs(nlohmann::json &js)
The auxillary method to create a global tag in file storage.
Definition: CrestApi.cxx:2266
Crest::CrestClient::removeGlobalTag
void removeGlobalTag(const std::string &name)
This method allows to remove a Global Tag form CREST DB.
Definition: CrestApi.cxx:758
Crest::CrestClient::findAllIovsFs
nlohmann::json findAllIovsFs(const std::string &tagname)
This method finds all iovs by the tag name in the file storage.
Definition: CrestApi.cxx:1781
Crest::CrestClient::listGlobalTagsAsString
std::string listGlobalTagsAsString()
This method finds a global tag lists.
Definition: CrestApi.cxx:788
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88