diff --git a/Framework/src/UserCodeInterface.cxx b/Framework/src/UserCodeInterface.cxx index d488bf27c1..5eeca3fc06 100644 --- a/Framework/src/UserCodeInterface.cxx +++ b/Framework/src/UserCodeInterface.cxx @@ -44,12 +44,14 @@ void UserCodeInterface::enableCtpScalers(size_t runNumber, std::string ccdbUrl) { // TODO bail if we are in async ILOG(Debug, Devel) << "Enabling CTP scalers" << ENDM; + mCtpFetcher = make_shared(); mScalersEnabled = true; auto& ccdbManager = o2::ccdb::BasicCCDBManager::instance(); ccdbManager.setURL(ccdbUrl); - mCtpFetcher->setupRun(runNumber, &ccdbManager, getCurrentTimestamp(), false); + mCtpFetcher->setupRun(runNumber, &ccdbManager, /*1726300234140*/ getCurrentTimestamp(), false); mScalersLastUpdate = std::chrono::steady_clock::time_point::min(); + cout << "mScalersLastUpdate : " << std::chrono::duration_cast(mScalersLastUpdate.time_since_epoch()).count() << endl; getScalers(); // initial value ILOG(Debug, Devel) << "Enabled CTP scalers" << ENDM; } @@ -72,15 +74,17 @@ void UserCodeInterface::getScalers() auto now = std::chrono::steady_clock::now(); auto minutesSinceLast = std::chrono::duration_cast(now - mScalersLastUpdate); + cout << "now : " << std::chrono::duration_cast(now.time_since_epoch()).count() << endl; + cout << "minutesSinceLast : " << minutesSinceLast << endl; // TODO get the interval from config - if (minutesSinceLast.count() < 5) { + if (minutesSinceLast.count() >= 0 /*first time it is neg*/ && minutesSinceLast.count() < 5) { ILOG(Debug, Devel) << "getScalers was called less than 5 minutes ago, use the cached value" << ENDM; return; } std::map meta; - void* rawResult = mDatabase->retrieveAny(typeid(o2::ctp::CTPRunScalers), "qc/CTP/Scalers", meta); // TODO make sure we get the last one. + void* rawResult = mDatabase->retrieveAny(typeid(o2::ctp::CTPRunScalers), "qc/CTP/Scalers", meta); o2::ctp::CTPRunScalers* ctpScalers = static_cast(rawResult); mCtpFetcher->updateScalers(*ctpScalers); mScalersLastUpdate = now; @@ -91,7 +95,7 @@ double UserCodeInterface::getScalersValue(std::string sourceName, size_t runNumb { if(!mScalersEnabled) { ILOG(Error, Ops) << "CTP scalers not enabled, impossible to get the value." << ENDM; - return 0; // TODO should we throw ? probably yes + return 0; } getScalers(); // from QCDB auto& ccdbManager = o2::ccdb::BasicCCDBManager::instance(); @@ -104,6 +108,8 @@ void UserCodeInterface::setDatabase(std::unordered_map { // TODO one could really argue that it would be easier to have a singleton for the QCDB... because here we will build and save a database object + // TODO could we rather provide the general config to the User Code ? it would be useful for other stuff like the ccdb url + cout << "dbConfig.count(\"implementation\") " << dbConfig.count("implementation") << " dbConfig.count(\"host\") : " << dbConfig.count("host") << endl; if(dbConfig.count("implementation") == 0 || dbConfig.count("host") == 0) { ILOG(Error, Devel) << "dbConfig is incomplete, we don't build the user code database instance " << ENDM; diff --git a/Modules/Skeleton/src/SkeletonCheck.cxx b/Modules/Skeleton/src/SkeletonCheck.cxx index 8f1f1cbf99..eef9552566 100644 --- a/Modules/Skeleton/src/SkeletonCheck.cxx +++ b/Modules/Skeleton/src/SkeletonCheck.cxx @@ -49,6 +49,9 @@ Quality SkeletonCheck::check(std::mapmId); + ILOG(Info, Devel) << "\"T0VTX\" : " << t0vtx << ENDM; + // This is an example of accessing the histogram 'example' created by SkeletonTask for (auto& [moName, mo] : *moMap) { if (mo->getName() == "example") { @@ -124,6 +127,7 @@ void SkeletonCheck::startOfActivity(const Activity& activity) // THUS FUNCTION BODY IS AN EXAMPLE. PLEASE REMOVE EVERYTHING YOU DO NOT NEED. ILOG(Debug, Devel) << "SkeletonCheck::start : " << activity.mId << ENDM; mActivity = make_shared(activity); + enableCtpScalers(activity.mId, "alice-ccdb.cern.ch"); // TODO get it from the config } void SkeletonCheck::endOfActivity(const Activity& activity)