|
20 | 20 | #include "QualityControl/MonitorObject.h" |
21 | 21 | #include "QualityControl/DatabaseInterface.h" |
22 | 22 | #include "QualityControl/ObjectMetadataKeys.h" |
| 23 | +#include "QualityControl/ActivityHelpers.h" |
23 | 24 | #include <TDatime.h> |
24 | 25 | #include <TPaveText.h> |
25 | 26 | #include <chrono> |
@@ -105,19 +106,27 @@ void BigScreen::initialize(quality_control::postprocessing::Trigger t, framework |
105 | 106 |
|
106 | 107 | static std::pair<std::shared_ptr<QualityObject>, bool> getQO(repository::DatabaseInterface& qcdb, Trigger t, BigScreenConfig::DataSource& source, long notOlderThan, bool ignoreActivity) |
107 | 108 | { |
108 | | - // retrieve MO from CCDB - do not associate to trigger activity if ignoreActivity is true |
109 | | - auto qo = ignoreActivity ? qcdb.retrieveQO(source.path, t.timestamp, {}) : qcdb.retrieveQO(source.path, t.timestamp, t.activity); |
110 | | - if (!qo) { |
| 109 | + // find the time-stamp of the most recent object matching the current activity |
| 110 | + // if ignoreActivity is true the activity matching criteria are not applied |
| 111 | + Activity activity = ignoreActivity ? Activity{} : t.activity; |
| 112 | + auto timestamp = t.timestamp; |
| 113 | + const auto objFullPath = t.activity.mProvenance + "/" + source.path; |
| 114 | + const auto filterMetadata = activity_helpers::asDatabaseMetadata(activity, false); |
| 115 | + const auto objectValidity = qcdb.getLatestObjectValidity(objFullPath, filterMetadata); |
| 116 | + if (objectValidity.isValid()) { |
| 117 | + timestamp = objectValidity.getMax() - 1; |
| 118 | + } else { |
| 119 | + ILOG(Warning, Devel) << "Could not find an object '" << objFullPath << "' for activity " << activity << ENDM; |
111 | 120 | return { nullptr, false }; |
112 | 121 | } |
113 | | - // get the MO creation time stamp |
114 | | - long timeStamp{ 0 }; |
115 | | - auto iter = qo->getMetadataMap().find(repository::metadata_keys::created); |
116 | | - if (iter != qo->getMetadataMap().end()) { |
117 | | - timeStamp = std::stol(iter->second); |
| 122 | + |
| 123 | + // retrieve QO from CCDB - do not associate to trigger activity if ignoreActivity is true |
| 124 | + auto qo = qcdb.retrieveQO(source.path, timestamp, activity); |
| 125 | + if (!qo) { |
| 126 | + return { nullptr, false }; |
118 | 127 | } |
119 | 128 |
|
120 | | - long elapsed = static_cast<long>(t.timestamp) - timeStamp; |
| 129 | + long elapsed = static_cast<long>(t.timestamp) - timestamp; |
121 | 130 | // check if the object is not older than a given number of milliseconds |
122 | 131 | if (elapsed > notOlderThan) { |
123 | 132 | return { qo, false }; |
|
0 commit comments