Skip to content

Commit

Permalink
ignoring syncQC provenance in send call until BKP implements it
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Tichák committed Jun 13, 2024
1 parent 4822426 commit f95a85d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Framework/include/QualityControl/BookkeepingQualitySink.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class BookkeepingQualitySink : public framework::Task

private:
std::string mGrpcUri;
Provenance mType;
Provenance mProvenance;
SendCallback mSendCallback;
FlagsMap mQualityObjectsMap;

Expand Down
15 changes: 8 additions & 7 deletions Framework/src/BookkeepingQualitySink.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void BookkeepingQualitySink::customizeInfrastructure(std::vector<framework::Comp
policies.emplace_back(CompletionPolicyHelpers::consumeWhenAny("BookkeepingQualitySinkCompletionPolicy", matcher));
}

void BookkeepingQualitySink::send(const std::string& grpcUri, const BookkeepingQualitySink::FlagsMap& flags, Provenance type)
void BookkeepingQualitySink::send(const std::string& grpcUri, const BookkeepingQualitySink::FlagsMap& flags, Provenance provenance)
{
auto bkpClient = o2::bkp::api::BkpClientFactory::create(grpcUri);
auto& qcClient = bkpClient->qcFlag();
Expand All @@ -65,8 +65,9 @@ void BookkeepingQualitySink::send(const std::string& grpcUri, const BookkeepingQ
}

try {
switch (type) {
switch (provenance) {
case Provenance::SyncQC:
break;
case Provenance::AsyncQC:
qcClient->createForDataPass(flagCollection->getRunNumber(), flagCollection->getPassName(), detector, bkpQcFlags);
break;
Expand All @@ -81,8 +82,8 @@ void BookkeepingQualitySink::send(const std::string& grpcUri, const BookkeepingQ
}
}

BookkeepingQualitySink::BookkeepingQualitySink(const std::string& grpcUri, Provenance type, SendCallback sendCallback)
: mGrpcUri{ grpcUri }, mType{ type }, mSendCallback{ sendCallback } {}
BookkeepingQualitySink::BookkeepingQualitySink(const std::string& grpcUri, Provenance provenance, SendCallback sendCallback)
: mGrpcUri{ grpcUri }, mProvenance{ provenance }, mSendCallback{ sendCallback } {}

auto merge(std::unique_ptr<QualityControlFlagCollection>&& collection, const std::unique_ptr<QualityObject>& qualityObject) -> std::unique_ptr<QualityControlFlagCollection>
{
Expand All @@ -91,7 +92,7 @@ auto merge(std::unique_ptr<QualityControlFlagCollection>&& collection, const std
return converter.getResult();
}

auto collectionFromQualityObject(const QualityObject& qualityObject) -> std::unique_ptr<QualityControlFlagCollection>
auto collectionForQualityObject(const QualityObject& qualityObject) -> std::unique_ptr<QualityControlFlagCollection>
{
return std::make_unique<QualityControlFlagCollection>(
qualityObject.getName(),
Expand All @@ -108,7 +109,7 @@ void BookkeepingQualitySink::run(framework::ProcessingContext& context)
for (auto const& ref : framework::InputRecordWalker(context.inputs())) {
try {
auto qualityObject = framework::DataRefUtils::as<QualityObject>(ref);
auto [emplacedIt, _] = mQualityObjectsMap.emplace(qualityObject->getDetectorName(), collectionFromQualityObject(*qualityObject));
auto [emplacedIt, _] = mQualityObjectsMap.emplace(qualityObject->getDetectorName(), collectionForQualityObject(*qualityObject));
emplacedIt->second = merge(std::move(emplacedIt->second), qualityObject);
} catch (...) {
ILOG(Warning, Support) << "Unexpected message received, QualityObject expected" << ENDM;
Expand All @@ -128,7 +129,7 @@ void BookkeepingQualitySink::stop()

void BookkeepingQualitySink::sendAndClear()
{
mSendCallback(mGrpcUri, mQualityObjectsMap, mType);
mSendCallback(mGrpcUri, mQualityObjectsMap, mProvenance);
mQualityObjectsMap.clear();
}

Expand Down

0 comments on commit f95a85d

Please sign in to comment.