Skip to content

Commit 021cab1

Browse files
committed
new logbook api
1 parent 0e02823 commit 021cab1

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

doc/configurationParameters.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ The parameters related to 3rd-party libraries are described here for convenience
170170
| readout | fairmqConsoleSeverity | int | -1 | Select amount of FMQ messages with fair::Logger::SetConsoleSeverity(). Value as defined in Severity enum defined from FairLogger/Logger.h. Use -1 to leave current setting. |
171171
| readout | flushConsumerTimeout | double | 1 | Time in seconds to wait before stopping the consumers (ie wait allocated pages released). 0 means stop immediately. |
172172
| readout | flushEquipmentTimeout | double | 1 | Time in seconds to wait for data once the equipments are stopped. 0 means stop immediately. |
173-
| readout | logbookApiToken | string | | The token to be used for the logbook API. |
174173
| readout | logbookEnabled | int | 0 | When set, the logbook is enabled and populated with readout stats at runtime. |
175174
| readout | logbookUpdateInterval | int | 30 | Amount of time (in seconds) between logbook publish updates. |
176175
| readout | logbookUrl | string | | The address to be used for the logbook API. |

src/mainReadout.cxx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,13 @@
4242
#ifdef WITH_ZMQ
4343
#include "ZmqServer.hxx"
4444
#endif
45-
#undef WITH_LOGBOOK
4645

4746
#ifdef WITH_CONFIG
4847
#include <Configuration/ConfigurationFactory.h>
4948
#endif
5049

5150
#ifdef WITH_LOGBOOK
52-
#include <BookkeepingApiCpp/BookkeepingFactory.h>
51+
#include <BookkeepingApi/BkpClientFactory.h>
5352
#endif
5453

5554
#ifdef WITH_DB
@@ -266,7 +265,7 @@ class Readout
266265
bool logFirstError = 0; // flag set to 1 after 1 error reported from iterateCheck/iterateRunning procedures
267266

268267
#ifdef WITH_LOGBOOK
269-
std::unique_ptr<bookkeeping::BookkeepingInterface> logbookHandle; // handle to logbook
268+
std::unique_ptr<o2::bkp::api::BkpClient> logbookHandle; // handle to logbook
270269
#endif
271270
#ifdef WITH_DB
272271
std::unique_ptr<ReadoutDatabase> dbHandle; // handle to readout database
@@ -290,18 +289,20 @@ void Readout::publishLogbookStats()
290289
if (logbookHandle != nullptr) {
291290
bool isOk = false;
292291
try {
293-
// interface: https://github.com/AliceO2Group/Bookkeeping/blob/master/cpp-api-client/src/BookkeepingApi.h
292+
// interface: https://github.com/AliceO2Group/Bookkeeping/tree/main/cxx-client/include/BookkeepingApi
294293
if (testLogbook) {
295294
// in test mode, create a dummy run entry in logbook
296295
if (occRole.length() == 0) { occRole = "flp-test"; }
297296
if (occRunNumber == 0) { occRunNumber = 999999999; }
298297
theLog.log(LogInfoDevel_(3210), "Logbook in test mode: create run number/flp %d / %s", (int)occRunNumber, occRole.c_str());
298+
/*
299299
std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
300300
logbookHandle->runStart(occRunNumber, now, now, "readout", RunType::TECHNICAL, 0, 0, 0, false, false, false, "normal");
301301
logbookHandle->flpAdd(occRole, "localhost", occRunNumber);
302+
*/
302303
testLogbook=0;
303304
}
304-
logbookHandle->flpUpdateCounters(occRole, occRunNumber, (int64_t)gReadoutStats.counters.numberOfSubtimeframes, (int64_t)gReadoutStats.counters.bytesReadout, (int64_t)gReadoutStats.counters.bytesRecorded, (int64_t)gReadoutStats.counters.bytesFairMQ);
305+
logbookHandle->flp()->updateReadoutCountersByFlpNameAndRunNumber(occRole, occRunNumber, (int64_t)gReadoutStats.counters.numberOfSubtimeframes, (int64_t)gReadoutStats.counters.bytesReadout, (int64_t)gReadoutStats.counters.bytesRecorded, (int64_t)gReadoutStats.counters.bytesFairMQ);
305306
isOk = true;
306307
} catch (const std::exception& ex) {
307308
theLog.log(LogErrorDevel_(3210), "Failed to update logbook: %s", ex.what());
@@ -846,11 +847,9 @@ int Readout::configure(const boost::property_tree::ptree& properties)
846847
#else
847848
// configuration parameter: | readout | logbookUrl | string | | The address to be used for the logbook API. |
848849
cfg.getOptionalValue<std::string>("readout.logbookUrl", cfgLogbookUrl);
849-
// configuration parameter: | readout | logbookApiToken | string | | The token to be used for the logbook API. |
850-
cfg.getOptionalValue<std::string>("readout.logbookApiToken", cfgLogbookApiToken);
851850

852851
theLog.log(LogInfoDevel, "Logbook enabled, %ds update interval, using URL = %s", cfgLogbookUpdateInterval, cfgLogbookUrl.c_str());
853-
logbookHandle = bookkeeping::getApiInstance(cfgLogbookUrl, cfgLogbookApiToken);
852+
logbookHandle = o2::bkp::api::BkpClientFactory::create(cfgLogbookUrl);
854853
if (logbookHandle == nullptr) {
855854
theLog.log(LogErrorSupport_(3210), "Failed to create handle to logbook");
856855
}

src/readoutConfigEditor.tcl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ set configurationParametersDescriptor {
146146
| readout | fairmqConsoleSeverity | int | -1 | Select amount of FMQ messages with fair::Logger::SetConsoleSeverity(). Value as defined in Severity enum defined from FairLogger/Logger.h. Use -1 to leave current setting. |
147147
| readout | flushConsumerTimeout | double | 1 | Time in seconds to wait before stopping the consumers (ie wait allocated pages released). 0 means stop immediately. |
148148
| readout | flushEquipmentTimeout | double | 1 | Time in seconds to wait for data once the equipments are stopped. 0 means stop immediately. |
149-
| readout | logbookApiToken | string | | The token to be used for the logbook API. |
150149
| readout | logbookEnabled | int | 0 | When set, the logbook is enabled and populated with readout stats at runtime. |
151150
| readout | logbookUpdateInterval | int | 30 | Amount of time (in seconds) between logbook publish updates. |
152151
| readout | logbookUrl | string | | The address to be used for the logbook API. |

0 commit comments

Comments
 (0)