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

Monitoring JSON changes in DAQ (80X) #12138

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c314fb0
upgrade AMPT to v2.25t5
kurtejung Oct 8, 2015
e3f34f8
Herwig: Add config for LO NNPDF30
Oct 21, 2015
3fd6a72
alpha_S in LO set to 0.130
Oct 21, 2015
eb15d12
new (json) format for module and path legend json file
smorovic Sep 4, 2015
29bf970
outputmodules entry in json legend
smorovic Sep 28, 2015
7a58df2
*adding HLTErrorEvents field to output JSON (to be used for filling S…
smorovic Oct 26, 2015
8019691
Added bool to make sure the Sherpa object is only initialized once (e…
thuer Oct 30, 2015
8ab7ae7
*const correctness and using static const int instead of preprocessor…
smorovic Oct 30, 2015
a40cc08
Implement "ramdisk" online client.
cmsdqm Oct 12, 2015
c9b9afb
Fix code formatting DQMServices/StreamerIO
Oct 21, 2015
96658e0
Merge pull request #12209 from dmitrijus/ramdisk_76x
davidlange6 Nov 2, 2015
01a95a7
Merge pull request #12229 from smuzaffar/from-CMSSW_8_0_X_2015-11-01-…
smuzaffar Nov 2, 2015
3ac9285
Merge pull request #12199 from thuer/CMSSW_8_0_X_sherpa_no_multiple_i…
cmsbuild Nov 2, 2015
b1e354d
Merge pull request #12025 from mharrend/patch-3
cmsbuild Nov 2, 2015
4be17af
Merge pull request #11932 from kurtejung/AMPT_upgrades
cmsbuild Nov 2, 2015
74d4bf2
*C++ style casts in FastMonitoringService
smorovic Nov 3, 2015
6909b65
*const correctness and using static const int instead of preprocessor…
smorovic Oct 30, 2015
c92781b
*C++ style casts in FastMonitoringService
smorovic Nov 3, 2015
97d6be2
Merge branch 'jsonlegends-80X' of ssh://github.com/smorovic/cmssw int…
smorovic Nov 3, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion DQMServices/Components/src/DQMFileSaver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ DQMFileSaver::fillJson(int run, int lumi, const std::string& dataFilePathName, c
}
// The availability test of the FastMonitoringService was done in the ctor.
bpt::ptree data;
bpt::ptree processedEvents, acceptedEvents, errorEvents, bitmask, fileList, fileSize, inputFiles, fileAdler32, transferDestination;
bpt::ptree processedEvents, acceptedEvents, errorEvents, bitmask, fileList, fileSize, inputFiles, fileAdler32, transferDestination, hltErrorEvents;

processedEvents.put("", nProcessed); // Processed events
acceptedEvents.put("", nProcessed); // Accepted events, same as processed for our purposes
Expand All @@ -303,6 +303,7 @@ DQMFileSaver::fillJson(int run, int lumi, const std::string& dataFilePathName, c
inputFiles.put("", ""); // We do not care about input files!
fileAdler32.put("", -1); // placeholder to match output json definition
transferDestination.put("", transferDestinationStr); // SM Transfer destination field
hltErrorEvents.put("", 0); // Error events

data.push_back(std::make_pair("", processedEvents));
data.push_back(std::make_pair("", acceptedEvents));
Expand All @@ -313,6 +314,7 @@ DQMFileSaver::fillJson(int run, int lumi, const std::string& dataFilePathName, c
data.push_back(std::make_pair("", inputFiles));
data.push_back(std::make_pair("", fileAdler32));
data.push_back(std::make_pair("", transferDestination));
data.push_back(std::make_pair("", hltErrorEvents));

pt.add_child("data", data);

Expand Down
7 changes: 5 additions & 2 deletions EventFilter/Utilities/interface/FastMonitoringService.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ namespace evf{
FastMonitoringService(const edm::ParameterSet&,edm::ActivityRegistry&);
~FastMonitoringService();

std::string makePathLegenda();
std::string makeModuleLegenda();
std::string makePathLegendaJson();
std::string makeModuleLegendaJson();

void preallocate(edm::service::SystemBounds const&);
void jobFailure();
Expand Down Expand Up @@ -258,8 +258,11 @@ namespace evf{
std::atomic<unsigned long> totalEventsProcessed_;

std::string moduleLegendFile_;
std::string moduleLegendFileJson_;
std::string pathLegendFile_;
std::string pathLegendFileJson_;
bool pathLegendWritten_ = false;
unsigned int nOutputModules_ =0;

std::atomic<bool> monInit_;
bool exception_detected_ = false;
Expand Down
5 changes: 5 additions & 0 deletions EventFilter/Utilities/plugins/RecoEventOutputModuleForFU.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ namespace evf {
jsoncollector::StringJ inputFiles_;
jsoncollector::IntJ fileAdler32_;
jsoncollector::StringJ transferDestination_;
jsoncollector::IntJ hltErrorEvents_;
boost::shared_ptr<jsoncollector::FastMonitor> jsonMonitor_;
evf::FastMonitoringService *fms_;
jsoncollector::DataPointDefinition outJsonDef_;
Expand All @@ -85,6 +86,7 @@ namespace evf {
inputFiles_(),
fileAdler32_(1),
transferDestination_(),
hltErrorEvents_(0),
outBuf_(new unsigned char[1024*1024])
{
std::string baseRunDir = edm::Service<evf::EvFDaqDirector>()->baseRunDir();
Expand Down Expand Up @@ -122,6 +124,7 @@ namespace evf {
inputFiles_.setName("InputFiles");
fileAdler32_.setName("FileAdler32");
transferDestination_.setName("TransferDestination");
hltErrorEvents_.setName("HLTErrorEvents");

outJsonDef_.setDefaultGroup("data");
outJsonDef_.addLegendItem("Processed","integer",jsoncollector::DataPointDefinition::SUM);
Expand All @@ -133,6 +136,7 @@ namespace evf {
outJsonDef_.addLegendItem("InputFiles","string",jsoncollector::DataPointDefinition::CAT);
outJsonDef_.addLegendItem("FileAdler32","integer",jsoncollector::DataPointDefinition::ADLER32);
outJsonDef_.addLegendItem("TransferDestination","string",jsoncollector::DataPointDefinition::SAME);
outJsonDef_.addLegendItem("HLTErrorEvents","integer",jsoncollector::DataPointDefinition::SUM);
std::stringstream tmpss,ss;
tmpss << baseRunDir << "/open/" << "output_" << getpid() << ".jsd";
ss << baseRunDir << "/" << "output_" << getpid() << ".jsd";
Expand Down Expand Up @@ -161,6 +165,7 @@ namespace evf {
jsonMonitor_->registerGlobalMonitorable(&inputFiles_,false);
jsonMonitor_->registerGlobalMonitorable(&fileAdler32_,false);
jsonMonitor_->registerGlobalMonitorable(&transferDestination_,false);
jsonMonitor_->registerGlobalMonitorable(&hltErrorEvents_,false);
jsonMonitor_->commit(nullptr);

}
Expand Down
5 changes: 5 additions & 0 deletions EventFilter/Utilities/plugins/output.jsd
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
"name" : "TransferDestination",
"operation" : "same",
"type" : "string"
},
{
"name" : "HLTErrorEvents",
"operation" : "sum",
"type" : "integer"
}

]
Expand Down
62 changes: 41 additions & 21 deletions EventFilter/Utilities/src/FastMonitoringService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ using namespace jsoncollector;

constexpr double throughputFactor() {return (1000000)/double(1024*1024);}

static const int nReservedModules = 33;
static const int nSpecialModules = 7;
static const int nReservedPaths = 1;

namespace evf{

const std::string FastMonitoringService::macroStateNames[FastMonitoringThread::MCOUNT] =
Expand All @@ -33,7 +37,7 @@ namespace evf{
FastMonitoringService::FastMonitoringService(const edm::ParameterSet& iPS,
edm::ActivityRegistry& reg) :
MicroStateService(iPS,reg)
,encModule_(33)
,encModule_(nReservedModules)
,nStreams_(0)//until initialized
,sleepTime_(iPS.getUntrackedParameter<int>("sleepTime", 1))
,fastMonIntervals_(iPS.getUntrackedParameter<unsigned int>("fastMonIntervals", 1))
Expand Down Expand Up @@ -81,26 +85,34 @@ namespace evf{
}


std::string FastMonitoringService::makePathLegenda(){
//taken from first stream
std::ostringstream ost;
for(int i = 0;
i < encPath_[0].current_;
i++)
ost<<i<<"="<<*((std::string *)(encPath_[0].decode(i)))<<" ";
return ost.str();
std::string FastMonitoringService::makePathLegendaJson() {
Json::Value legendaVector(Json::arrayValue);
for(int i = 0; i < encPath_[0].current_; i++)
legendaVector.append(Json::Value(*((const std::string *)(encPath_[0].decode(i)))));
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use C++ style cast.

Json::Value valReserved(nReservedPaths);
Json::Value pathLegend;
pathLegend["names"]=legendaVector;
pathLegend["reserved"]=valReserved;
Json::StyledWriter writer;
return writer.write(pathLegend);
}


std::string FastMonitoringService::makeModuleLegenda()
{
std::ostringstream ost;
std::string FastMonitoringService::makeModuleLegendaJson(){
Json::Value legendaVector(Json::arrayValue);
for(int i = 0; i < encModule_.current_; i++)
ost<<i<<"="<<((const edm::ModuleDescription *)(encModule_.decode(i)))->moduleLabel()<<" ";
return ost.str();
legendaVector.append(Json::Value(((const edm::ModuleDescription *)(encModule_.decode(i)))->moduleLabel()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid use of C style casts. The C++ casts are much easier to notIce and avoid accidental casting away can const.

Json::Value valReserved(nReservedModules);
Json::Value valSpecial(nSpecialModules);
Json::Value valOutputModules(nOutputModules_);
Json::Value moduleLegend;
moduleLegend["names"]=legendaVector;
moduleLegend["reserved"]=valReserved;
moduleLegend["special"]=valSpecial;
moduleLegend["output"]=valOutputModules;
Json::StyledWriter writer;
return writer.write(moduleLegend);
}


void FastMonitoringService::preallocate(edm::service::SystemBounds const & bounds)
{

Expand Down Expand Up @@ -133,12 +145,18 @@ namespace evf{
fastPath_ = fast.string();

std::ostringstream moduleLegFile;
std::ostringstream moduleLegFileJson;
moduleLegFile << "microstatelegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".leg";
moduleLegFileJson << "microstatelegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".jsn";
moduleLegendFile_ = (workingDirectory_/moduleLegFile.str()).string();
moduleLegendFileJson_ = (workingDirectory_/moduleLegFileJson.str()).string();

std::ostringstream pathLegFile;
std::ostringstream pathLegFileJson;
pathLegFile << "pathlegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".leg";
pathLegendFile_ = (workingDirectory_/pathLegFile.str()).string();
pathLegFileJson << "pathlegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".jsn";
pathLegendFileJson_ = (workingDirectory_/pathLegFileJson.str()).string();

LogDebug("FastMonitoringService") << "Initializing FastMonitor with microstate def path -: "
<< microstateDefPath_;
Expand Down Expand Up @@ -267,16 +285,18 @@ namespace evf{
//build a map of modules keyed by their module description address
//here we need to treat output modules in a special way so they can be easily singled out
if(desc.moduleName() == "Stream" || desc.moduleName() == "ShmStreamConsumer" || desc.moduleName() == "EvFOutputModule" ||
desc.moduleName() == "EventStreamFileWriter" || desc.moduleName() == "PoolOutputModule")
desc.moduleName() == "EventStreamFileWriter" || desc.moduleName() == "PoolOutputModule") {
encModule_.updateReserved((void*)&desc);
nOutputModules_++;
}
else
encModule_.update((void*)&desc);
}

void FastMonitoringService::postBeginJob()
{
std::string && moduleLegStr = makeModuleLegenda();
FileIO::writeStringToFile(moduleLegendFile_, moduleLegStr);
std::string && moduleLegStrJson = makeModuleLegendaJson();
FileIO::writeStringToFile(moduleLegendFileJson_, moduleLegStrJson);

macrostate_ = FastMonitoringThread::sJobReady;

Expand Down Expand Up @@ -465,8 +485,8 @@ namespace evf{
collectedPathList_[sc.streamID()]->store(true,std::memory_order_seq_cst);
fmt_.m_data.ministateBins_=encPath_[sc.streamID()].vecsize();
if (!pathLegendWritten_) {
std::string pathLegendStr = makePathLegenda();
FileIO::writeStringToFile(pathLegendFile_, pathLegendStr);
std::string pathLegendStrJson = makePathLegendaJson();
FileIO::writeStringToFile(pathLegendFileJson_, pathLegendStrJson);
pathLegendWritten_=true;
}
}
Expand Down
3 changes: 3 additions & 0 deletions HLTrigger/JSONMonitoring/plugins/TriggerJSONMonitoring.cc
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ TriggerJSONMonitoring::globalEndLuminosityBlockSummary(const edm::LuminosityBloc
IntJ daqJsnAccepted = daqJsnProcessed;
IntJ daqJsnErrorEvents = 0;
IntJ daqJsnRetCodeMask = 0;
IntJ daqJsnHLTErrorEvents = 0;

//write out HLT metadata jsn
Json::Value hltDaqJsn;
Expand All @@ -665,6 +666,7 @@ TriggerJSONMonitoring::globalEndLuminosityBlockSummary(const edm::LuminosityBloc
hltDaqJsn[DataPoint::DATA].append(hltJsnInputFiles.value());
hltDaqJsn[DataPoint::DATA].append(hltJsnFileAdler32);
hltDaqJsn[DataPoint::DATA].append(iSummary->streamHLTDestination);
hltDaqJsn[DataPoint::DATA].append((unsigned int)daqJsnHLTErrorEvents.value());

result = writer.write(hltDaqJsn);

Expand All @@ -690,6 +692,7 @@ TriggerJSONMonitoring::globalEndLuminosityBlockSummary(const edm::LuminosityBloc
l1DaqJsn[DataPoint::DATA].append(l1JsnInputFiles.value());
l1DaqJsn[DataPoint::DATA].append(l1JsnFileAdler32);
l1DaqJsn[DataPoint::DATA].append(iSummary->streamL1Destination);
l1DaqJsn[DataPoint::DATA].append((unsigned int)daqJsnHLTErrorEvents.value());

result = writer.write(l1DaqJsn);

Expand Down