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

Utilities cleanup #3381

Merged
merged 16 commits into from Apr 17, 2014
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions EventFilter/Utilities/ChangeLog
@@ -1,3 +1,9 @@
2014-04-17 Srecko Morovic <srecko.morovic@cern.ch>

* Removed obsolete modules (were used for fakeBU mode previously)
* FU-wide lock when moving index and creating EoL files
* This is to prevent another process creating EoL prematurely

2014-02-26 Srecko Morovic <srecko.morovic@cern.ch>

* Multithreaded implementation of monitoring and monitoring rework
Expand Down
4 changes: 3 additions & 1 deletion EventFilter/Utilities/interface/DataPoint.h
Expand Up @@ -66,7 +66,7 @@ class DataPoint: public JsonSerializable {
//take new update for lumi
void snap(unsigned int lumi);
void snapGlobal(unsigned int lumi);
void snapStreamAtomic(unsigned int streamID, unsigned int lumi);
void snapStreamAtomic(unsigned int lumi, unsigned int streamID);

//set to track a variable
void trackMonitorable(JsonMonitorable *monitorable,bool NAifZeroUpdates);
Expand Down Expand Up @@ -114,6 +114,8 @@ class DataPoint: public JsonSerializable {

std::string const& getName() {return name_;}

void updateDefinition(std::string const& definition) {definition_=definition;}

// JSON field names
static const std::string SOURCE;
static const std::string DEFINITION;
Expand Down
17 changes: 10 additions & 7 deletions EventFilter/Utilities/interface/FastMonitor.h
Expand Up @@ -27,7 +27,7 @@ class FastMonitor {

void addFastPathDefinition(std::string const& defPathFast, std::string const defGroupFast, bool strict);

void setDefPath(std::string const& dpath) {defPath_=dpath;}
void setDefPath(std::string const& dpath) {defPath_=dpath;for (auto dp : dataPoints_) dp->updateDefinition(dpath);}

void setNStreams(unsigned int nStreams) {nStreams_=nStreams;}

Expand All @@ -53,22 +53,25 @@ class FastMonitor {
void commit(std::vector<unsigned int> *streamLumisPtr);

// fetches new snapshot and outputs one-line CSV if set (timer based)
void snap(bool outputCSVFile, std::string const& path, unsigned int forLumi);
void snap(unsigned int ls);

//only update global variables (invoked at global EOL)
void snapGlobal(bool outputCSVFile, std::string const& path, unsigned int forLumi);
void snapGlobal(unsigned int ls);

//only updates atomic vectors (for certain stream - at stream EOL)
void snapStreamAtomic(bool outputCSVFile, std::string const& path, unsigned int streamID, unsigned int forLumi);
void snapStreamAtomic(unsigned int ls, unsigned int streamID);

//fastpath CSV
void outputCSV(std::string const& path);
//fastpath CSV string
std::string getCSVString();

//fastpath file output
void outputCSV(std::string const& path, std::string const& csvString);

//provide merged variable back to user
JsonMonitorable* getMergedIntJForLumi(std::string const& name,unsigned int forLumi);

// merges and outputs everything collected for the given stream to JSON file
bool outputFullJSON(std::string const& path, unsigned int lumi);
bool outputFullJSON(std::string const& path, unsigned int lumi, bool log=true);

//discard what was collected for a lumisection
void discardCollected(unsigned int forLumi);
Expand Down
8 changes: 5 additions & 3 deletions EventFilter/Utilities/interface/MicroStateService.h
Expand Up @@ -8,8 +8,9 @@
#include "DataFormats/Provenance/interface/Timestamp.h"
#include "DataFormats/Provenance/interface/ModuleDescription.h"
#include "DataFormats/Provenance/interface/ParameterSetID.h"
//#include "FWCore/ServiceRegistry/interface/StreamContext.h"

#include "boost/thread/thread.hpp"
//#include "boost/thread/thread.hpp"

#include <string>
#include <vector>
Expand All @@ -21,7 +22,7 @@ namespace evf{
class MicroStateService
{
public:
enum Microstate { mInvalid = 0, mFwkOvh, mIdle, mInput, mInputDone, mDqm, mCOUNT};
enum Microstate { mInvalid = 0, mFwkOvh, mIdle, mInput, mInputDone, mDqm, mEoL, mCOUNT};
// the names of the states - some of them are never reached in an online app
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT];
MicroStateService(const edm::ParameterSet&,edm::ActivityRegistry&);
Expand All @@ -32,10 +33,11 @@ namespace evf{
virtual std::string const &getMicroState2(){return default_return_;}

virtual void setMicroState(Microstate m)=0;
virtual void setMicroState(edm::StreamID sid, Microstate m) = 0;

protected:
static const std::string default_return_;
boost::mutex lock_;
//boost::mutex lock_;
};

}
Expand Down
18 changes: 5 additions & 13 deletions EventFilter/Utilities/plugins/EvFBuildingThrottle.h
Expand Up @@ -17,8 +17,7 @@ namespace evf{
class EvFBuildingThrottle
{
public:
enum Directory { mInvalid = 0, mBase, mBU, mSM, mMon, mWhat,
mCOUNT};
enum Directory { mInvalid = 0, mBase, mBU, mCOUNT};
explicit EvFBuildingThrottle( const edm::ParameterSet &pset,
edm::ActivityRegistry& reg )
: highWaterMark_(pset.getUntrackedParameter<double>("highWaterMark",0.8))
Expand All @@ -33,27 +32,20 @@ namespace evf{
reg.watchPreGlobalBeginLumi(this,&EvFBuildingThrottle::preBeginLumi);
}
~EvFBuildingThrottle(){}
// void preBeginRun(edm::RunID const& id, edm::Timestamp const& ts){
void preBeginRun(edm::GlobalContext const& gc){
//obtain directory to stat on
switch(whatToThrottleOn_){
case mInvalid:
//do nothing
break;
case mBase:
baseDir_ = edm::Service<EvFDaqDirector>()->baseDir();
baseDir_ = edm::Service<EvFDaqDirector>()->baseRunDir();
break;
case mBU:
baseDir_ = edm::Service<EvFDaqDirector>()->buBaseDir();
break;
case mSM:
baseDir_ = edm::Service<EvFDaqDirector>()->smBaseDir();
break;
case mMon:
baseDir_ = edm::Service<EvFDaqDirector>()->monitorBaseDir();
baseDir_ = edm::Service<EvFDaqDirector>()->buBaseRunDir();
break;
default:
baseDir_ = edm::Service<EvFDaqDirector>()->baseDir();
baseDir_ = edm::Service<EvFDaqDirector>()->baseRunDir();
}
start();
}
Expand Down Expand Up @@ -85,7 +77,7 @@ namespace evf{
if(highwater_ && !throttled_){ lock_.lock(); throttled_ = true;std::cout << ">>>>throttling on " << std::endl;}
if(lowwater_ && throttled_){ lock_.unlock(); throttled_ = false;}
std::cout << " building throttle on " << baseDir_ << " is " << fraction*100 << " %full " << std::endl;
edm::Service<EvFDaqDirector>()->writeDiskAndThrottleStat(fraction,highwater_,lowwater_);
//edm::Service<EvFDaqDirector>()->writeDiskAndThrottleStat(fraction,highwater_,lowwater_);
::usleep(sleep_*1000);
}
}
Expand Down