Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to JSONMonotoring (74X) #9613

Merged
merged 3 commits into from Jun 16, 2015
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
57 changes: 27 additions & 30 deletions HLTrigger/JSONMonitoring/plugins/TriggerJSONMonitoring.cc
Expand Up @@ -17,6 +17,8 @@
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "EventFilter/Utilities/interface/FastMonitoringService.h"

#include <fstream>

TriggerJSONMonitoring::TriggerJSONMonitoring(const edm::ParameterSet& ps)
Expand Down Expand Up @@ -529,7 +531,14 @@ TriggerJSONMonitoring::endLuminosityBlockSummary(const edm::LuminosityBlock& iLu
void
TriggerJSONMonitoring::globalEndLuminosityBlockSummary(const edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup, const LuminosityBlockContext* iContext, hltJson::lumiVars* iSummary)
{
if (iSummary->processed->value().at(0)!=0) {

unsigned int iLs = iLumi.luminosityBlock();
unsigned int iRun = iLumi.run();

evf::FastMonitoringService * fms_ = (evf::FastMonitoringService *)(edm::Service<evf::MicroStateService>().operator->());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a check for the availability of the FastMonitoringService or MicroStateService.
It is fine to print a LogError and/or disable some functionality if a service is not available, but it should not crash the whole program.

(actually, IMO nothing should ever crash the whole program, if a more graceful alternative is available)

bool writeFiles = fms_ ? fms_->getEventsProcessedForLumi(iLs)>0 : true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ops, apologies, fms_ is used only here, and there is a check - fooled by the name, I though it was a member available elsewhere.


if (iSummary->processed->value().at(0)!=0 && writeFiles) {
Json::StyledWriter writer;

char hostname[33];
Expand All @@ -542,9 +551,6 @@ TriggerJSONMonitoring::globalEndLuminosityBlockSummary(const edm::LuminosityBloc
std::stringstream sOutDef;
sOutDef << monPath << "output_" << getpid() << ".jsd";

unsigned int iLs = iLumi.luminosityBlock();
unsigned int iRun = iLumi.run();

//Write the .jsndata files which contain the actual rates
//HLT .jsndata file
Json::Value hltJsnData;
Expand Down Expand Up @@ -573,6 +579,14 @@ TriggerJSONMonitoring::globalEndLuminosityBlockSummary(const edm::LuminosityBloc
outHltJsnData<<result;
outHltJsnData.close();

//HLT jsn entries
StringJ hltJsnFilelist_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi Srecko,
please do not use names ending with an underscore for non-member variables.

.A

hltJsnFilelist_.update(ssHltJsnData.str());
IntJ hltJsnFilesize_ = result.size();
IntJ hltJsnFileAdler32_ = cms::Adler32(result.c_str(),result.size());
StringJ hltJsnInputFiles_;
hltJsnInputFiles_.update("");

//L1 .jsndata file
Json::Value l1JsnData;
l1JsnData[DataPoint::SOURCE] = sourceHost;
Expand All @@ -598,6 +612,13 @@ TriggerJSONMonitoring::globalEndLuminosityBlockSummary(const edm::LuminosityBloc
outL1JsnData<<result;
outL1JsnData.close();

StringJ l1JsnFilelist_;
l1JsnFilelist_.update(ssL1JsnData.str());
IntJ l1JsnFilesize_ = result.size();
IntJ l1JsnFileAdler32_ = cms::Adler32(result.c_str(), result.size());
StringJ l1JsnInputFiles_;
l1JsnInputFiles_.update("");

//Create special DAQ JSON file for L1 and HLT rates pseudo-streams
//Only three variables are different between the files:
//the file list, the file size and the Adler32 value
Expand All @@ -606,20 +627,7 @@ TriggerJSONMonitoring::globalEndLuminosityBlockSummary(const edm::LuminosityBloc
IntJ daqJsnErrorEvents_ = 0;
IntJ daqJsnRetCodeMask_ = 0;

struct stat st;

//HLT
StringJ hltJsnFilelist_;
hltJsnFilelist_.update(ssHltJsnData.str());

const char* cName = (monPath+ssHltJsnData.str()).c_str();
stat(cName, &st);

IntJ hltJsnFilesize_ = st.st_size;
StringJ hltJsnInputFiles_;
hltJsnInputFiles_.update("");
IntJ hltJsnFileAdler32_ = cms::Adler32(cName, st.st_size);

//write out HLT metadata jsn
Json::Value hltDaqJsn;
hltDaqJsn[DataPoint::SOURCE] = sourceHost;
hltDaqJsn[DataPoint::DEFINITION] = sOutDef.str();
Expand All @@ -644,18 +652,7 @@ TriggerJSONMonitoring::globalEndLuminosityBlockSummary(const edm::LuminosityBloc
outHltDaqJsn<<result;
outHltDaqJsn.close();

//L1
StringJ l1JsnFilelist_;
l1JsnFilelist_.update(ssL1JsnData.str());

cName = (monPath+ssL1JsnData.str()).c_str();
stat(cName, &st);

IntJ l1JsnFilesize_ = st.st_size;
StringJ l1JsnInputFiles_;
l1JsnInputFiles_.update("");
IntJ l1JsnFileAdler32_ = cms::Adler32(cName, st.st_size);

//write out HLT metadata jsn
Json::Value l1DaqJsn;
l1DaqJsn[DataPoint::SOURCE] = sourceHost;
l1DaqJsn[DataPoint::DEFINITION] = sOutDef.str();
Expand Down