CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
evf::EvFDaqDirector Class Reference

#include <EvFDaqDirector.h>

Public Types

enum  FileStatus {
  noFile, sameFile, newFile, newLumi,
  runEnded, runAbort
}
 

Public Member Functions

std::string & baseRunDir ()
 
std::string & buBaseRunDir ()
 
std::string & buBaseRunOpenDir ()
 
void checkTransferSystemPSet (edm::ProcessContext const &pc)
 
void createProcessingNotificationMaybe () const
 
void createRunOpendirMaybe ()
 
bool emptyLumisectionMode () const
 
 EvFDaqDirector (const edm::ParameterSet &pset, edm::ActivityRegistry &reg)
 
std::string findCurrentRunDir ()
 
std::string getBoLSFilePathOnFU (const unsigned int ls) const
 
std::string getEoLSFilePathOnBU (const unsigned int ls) const
 
std::string getEoLSFilePathOnFU (const unsigned int ls) const
 
std::string getEoRFilePath () const
 
std::string getEoRFilePathOnFU () const
 
std::string getInitFilePath (std::string const &stream) const
 
std::string getInputJsonFilePath (const unsigned int ls, const unsigned int index) const
 
std::string getMergedDatChecksumFilePath (const unsigned int ls, std::string const &stream) const
 
std::string getMergedDatFilePath (const unsigned int ls, std::string const &stream) const
 
std::string getMergedProtocolBufferHistogramFilePath (const unsigned int ls, std::string const &stream) const
 
std::string getMergedRootHistogramFilePath (const unsigned int ls, std::string const &stream) const
 
std::string getOpenDatFilePath (const unsigned int ls, std::string const &stream) const
 
std::string getOpenInitFilePath (std::string const &stream) const
 
std::string getOpenInputJsonFilePath (const unsigned int ls, const unsigned int index) const
 
std::string getOpenOutputJsonFilePath (const unsigned int ls, std::string const &stream) const
 
std::string getOpenProtocolBufferHistogramFilePath (const unsigned int ls, std::string const &stream) const
 
std::string getOpenRawFilePath (const unsigned int ls, const unsigned int index) const
 
std::string getOpenRootHistogramFilePath (const unsigned int ls, std::string const &stream) const
 
std::string getOutputJsonFilePath (const unsigned int ls, std::string const &stream) const
 
std::string getProtocolBufferHistogramFilePath (const unsigned int ls, std::string const &stream) const
 
std::string getRawFilePath (const unsigned int ls, const unsigned int index) const
 
std::string getRootHistogramFilePath (const unsigned int ls, std::string const &stream) const
 
unsigned int getRunNumber () const
 
std::string getRunOpenDirPath () const
 
std::string getStreamDestinations (std::string const &stream) const
 
std::vector< int > * getStreamFileTracker ()
 
bool isSingleStreamThread ()
 
void lockFULocal ()
 
void lockFULocal2 ()
 
void lockInitLock ()
 
FILE * maybeCreateAndLockFileHeadForStream (unsigned int ls, std::string &stream)
 
bool outputAdler32Recheck () const
 
void postEndRun (edm::GlobalContext const &globalContext)
 
void preallocate (edm::service::SystemBounds const &bounds)
 
void preBeginJob (edm::PathsAndConsumesOfModulesBase const &, edm::ProcessContext const &)
 
void preBeginRun (edm::GlobalContext const &globalContext)
 
void preGlobalEndLumi (edm::GlobalContext const &globalContext)
 
void preSourceEvent (edm::StreamID const &streamID)
 
int readLastLSEntry (std::string const &file)
 
void removeFile (unsigned int ls, unsigned int index)
 
void removeFile (std::string)
 
void setDeleteTracking (std::mutex *fileDeleteLock, std::list< std::pair< int, InputFile * >> *filesToDelete)
 
void setFMS (evf::FastMonitoringService *fms)
 
void tryInitializeFuLockFile ()
 
void unlockAndCloseMergeStream ()
 
void unlockFULocal ()
 
void unlockFULocal2 ()
 
void unlockInitLock ()
 
void updateFileIndex (int const &fileIndex)
 
FileStatus updateFuLock (unsigned int &ls, std::string &nextFile, uint32_t &fsize, uint64_t &lockWaitTime)
 
 ~EvFDaqDirector ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

bool bumpFile (unsigned int &ls, unsigned int &index, std::string &nextFile, uint32_t &fsize, int maxLS)
 
std::string eolsFileName (const unsigned int ls) const
 
std::string eorFileName () const
 
int getNFilesFromEoLS (std::string BUEoLSFile)
 
std::string initFileName (std::string const &stream) const
 
std::string inputFileNameStem (const unsigned int ls, const unsigned int index) const
 
std::string mergedFileNameStem (const unsigned int ls, std::string const &stream) const
 
void openFULockfileStream (std::string &fuLockFilePath, bool create)
 
std::string outputFileNameStem (const unsigned int ls, std::string const &stream) const
 

Private Attributes

std::string base_dir_
 
std::string bu_base_dir_
 
struct flock bu_r_flk
 
struct flock bu_r_fulk
 
FILE * bu_r_lock_stream
 
int bu_readlock_fd_
 
std::string bu_run_dir_
 
std::string bu_run_open_dir_
 
FILE * bu_t_monitor_stream
 
struct flock bu_w_flk
 
struct flock bu_w_fulk
 
FILE * bu_w_lock_stream
 
FILE * bu_w_monitor_stream
 
int bu_writelock_fd_
 
int currentFileIndex_ = -1
 
int data_readwrite_fd_
 
struct flock data_rw_flk
 
struct flock data_rw_fulk
 
FILE * data_rw_stream
 
bool directorBu_
 
DirManager dirManager_
 
bool emptyLumisectionMode_
 
unsigned int eolsNFilesIndex_ = 1
 
std::mutexfileDeleteLockPtr_ = nullptr
 
std::list< std::pair< int,
InputFile * > > * 
filesToDeletePtr_ = nullptr
 
evf::FastMonitoringServicefms_ = nullptr
 
int fu_readwritelock_fd_
 
struct flock fu_rw_flk
 
struct flock fu_rw_fulk
 
FILE * fu_rw_lock_stream
 
int fulocal_rwlock_fd2_
 
int fulocal_rwlock_fd_
 
unsigned int fuLockPollInterval_
 
std::string hltSourceDirectory_
 
std::string hostname_
 
pthread_mutex_t init_lock_ = PTHREAD_MUTEX_INITIALIZER
 
unsigned int nStreams_ =0
 
unsigned int nThreads_ =0
 
bool outputAdler32Recheck_
 
unsigned long previousFileSize_
 
bool readEolsDefinition_ = true
 
bool requireTSPSet_
 
unsigned int run_
 
std::string run_dir_
 
std::string run_string_
 
std::string selectedTransferMode_
 
std::string stopFilePath_
 
std::vector< int > streamFileTracker_
 
std::shared_ptr< Json::ValuetransferSystemJson_
 

Detailed Description

Definition at line 51 of file EvFDaqDirector.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

evf::EvFDaqDirector::EvFDaqDirector ( const edm::ParameterSet pset,
edm::ActivityRegistry reg 
)
explicit

Definition at line 43 of file EvFDaqDirector.cc.

References base_dir_, bu_base_dir_, bu_run_dir_, bu_run_open_dir_, bu_w_lock_stream, bu_writelock_fd_, eostools::chmod(), createRunOpendirMaybe(), directorBu_, emptyLumisectionMode_, Exception, fu_readwritelock_fd_, fu_rw_lock_stream, fulocal_rwlock_fd2_, fulocal_rwlock_fd_, fuLockPollInterval_, getRunOpenDirPath(), hltSourceDirectory_, hostname_, init_lock_, eostools::mkdir(), NULL, openFULockfileStream(), postEndRun(), preallocate(), preBeginJob(), preBeginRun(), preGlobalEndLumi(), preSourceEvent(), run_, run_dir_, run_string_, contentValuesCheck::ss, stopFilePath_, AlCaHLTBitMon_QueryRunRegistry::string, tryInitializeFuLockFile(), edm::ActivityRegistry::watchPostGlobalEndRun(), edm::ActivityRegistry::watchPreallocate(), edm::ActivityRegistry::watchPreBeginJob(), edm::ActivityRegistry::watchPreGlobalBeginRun(), edm::ActivityRegistry::watchPreGlobalEndLumi(), and edm::ActivityRegistry::watchPreSourceEvent().

44  :
45  base_dir_(pset.getUntrackedParameter<std::string> ("baseDir", ".")),
46  bu_base_dir_(pset.getUntrackedParameter<std::string> ("buBaseDir", ".")),
47  directorBu_(pset.getUntrackedParameter<bool> ("directorIsBu", false)),
48  run_(pset.getUntrackedParameter<unsigned int> ("runNumber",0)),
49  outputAdler32Recheck_(pset.getUntrackedParameter<bool>("outputAdler32Recheck",false)),
50  requireTSPSet_(pset.getUntrackedParameter<bool>("requireTransfersPSet",false)),
51  selectedTransferMode_(pset.getUntrackedParameter<std::string>("selectedTransferMode","")),
52  hltSourceDirectory_(pset.getUntrackedParameter<std::string>("hltSourceDirectory","")),
53  fuLockPollInterval_(pset.getUntrackedParameter<unsigned int>("fuLockPollInterval",2000)),
54  emptyLumisectionMode_(pset.getUntrackedParameter<bool>("emptyLumisectionMode",false)),
55  hostname_(""),
56  bu_readlock_fd_(-1),
57  bu_writelock_fd_(-1),
62 
66  //bu_w_monitor_stream(0),
67  //bu_t_monitor_stream(0),
68  data_rw_stream(0),
69 
71 
73 
74  bu_w_flk( make_flock( F_WRLCK, SEEK_SET, 0, 0, 0 )),
75  bu_r_flk( make_flock( F_RDLCK, SEEK_SET, 0, 0, 0 )),
76  bu_w_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, 0 )),
77  bu_r_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, 0 )),
78  fu_rw_flk( make_flock ( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
79  fu_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() )),
80  data_rw_flk( make_flock ( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
81  data_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() ))
82  //fulocal_rw_flk( make_flock( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
83  //fulocal_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() )),
84  //fulocal_rw_flk2( make_flock( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
85  //fulocal_rw_fulk2( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() ))
86  {
87 
94 
95  std::stringstream ss;
96  ss << "run" << std::setfill('0') << std::setw(6) << run_;
97  run_string_ = ss.str();
99 
100  //save hostname for later
101  char hostname[33];
102  gethostname(hostname,32);
103  hostname_ = hostname;
104 
105  char * fuLockPollIntervalPtr = getenv("FFF_LOCKPOLLINTERVAL");
106  if (fuLockPollIntervalPtr) {
107  try {
108  fuLockPollInterval_=boost::lexical_cast<unsigned int>(std::string(fuLockPollIntervalPtr));
109  edm::LogInfo("Setting fu lock poll interval by environment string: ") << fuLockPollInterval_ << " us";
110  }
111  catch( boost::bad_lexical_cast const& ) {
112  edm::LogWarning("Bad lexical cast in parsing: ") << std::string(fuLockPollIntervalPtr);
113  }
114  }
115 
116  char * emptyLumiModePtr = getenv("FFF_EMPTYLSMODE");
117  if (emptyLumiModePtr) {
118  emptyLumisectionMode_ = true;
119  edm::LogInfo("Setting empty lumisection mode");
120  }
121 
122  // check if base dir exists or create it accordingly
123  int retval = mkdir(base_dir_.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
124  if (retval != 0 && errno != EEXIST) {
125  throw cms::Exception("DaqDirector") << " Error checking for base dir -: "
126  << base_dir_ << " mkdir error:" << strerror(errno);
127  }
128 
129  //create run dir in base dir
130  umask(0);
131  retval = mkdir(run_dir_.c_str(),
132  S_IRWXU | S_IRWXG | S_IROTH | S_IRWXO | S_IXOTH);
133  if (retval != 0 && errno != EEXIST) {
134  throw cms::Exception("DaqDirector") << " Error creating run dir -: "
135  << run_dir_ << " mkdir error:" << strerror(errno);
136  }
137 
138  //create fu-local.lock in run open dir
139  if (!directorBu_) {
140 
142  std::string fulocal_lock_ = getRunOpenDirPath() +"/fu-local.lock";
143  fulocal_rwlock_fd_ = open(fulocal_lock_.c_str(), O_RDWR | O_CREAT, S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);//O_RDWR?
144  if (fulocal_rwlock_fd_==-1)
145  throw cms::Exception("DaqDirector") << " Error creating/opening a local lock file -: " << fulocal_lock_.c_str() << " : " << strerror(errno);
146  chmod(fulocal_lock_.c_str(),0777);
147  fsync(fulocal_rwlock_fd_);
148  //open second fd for another input source thread
149  fulocal_rwlock_fd2_ = open(fulocal_lock_.c_str(), O_RDWR, S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);//O_RDWR?
150  if (fulocal_rwlock_fd2_==-1)
151  throw cms::Exception("DaqDirector") << " Error opening a local lock file -: " << fulocal_lock_.c_str() << " : " << strerror(errno);
152  }
153 
154  //bu_run_dir: for FU, for which the base dir is local and the BU is remote, it is expected to be there
155  //for BU, it is created at this point
156  if (directorBu_)
157  {
159  std::string bulockfile = bu_run_dir_ + "/bu.lock";
160  std::string fulockfile = bu_run_dir_ + "/fu.lock";
161 
162  //make or find bu run dir
163  retval = mkdir(bu_run_dir_.c_str(),
164  S_IRWXU | S_IRWXG | S_IRWXO);
165  if (retval != 0 && errno != EEXIST) {
166  throw cms::Exception("DaqDirector")
167  << " Error creating bu run dir -: " << bu_run_dir_
168  << " mkdir error:" << strerror(errno) << "\n";
169  }
170  bu_run_open_dir_ = bu_run_dir_ + "/open";
171  retval = mkdir(bu_run_open_dir_.c_str(),
172  S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
173  if (retval != 0 && errno != EEXIST) {
174  throw cms::Exception("DaqDirector") << " Error creating bu run open dir -: "
175  << bu_run_open_dir_ << " mkdir error:" << strerror(errno)
176  << "\n";
177  }
178 
179  // the BU director does not need to know about the fu lock
180  bu_writelock_fd_ = open(bulockfile.c_str(),
181  O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU);
182  if (bu_writelock_fd_ == -1)
183  edm::LogWarning("EvFDaqDirector") << "problem with creating filedesc for buwritelock -: "
184  << strerror(errno);
185  else
186  edm::LogInfo("EvFDaqDirector") << "creating filedesc for buwritelock -: "
187  << bu_writelock_fd_;
188  bu_w_lock_stream = fdopen(bu_writelock_fd_, "w");
189  if (bu_w_lock_stream == 0)
190  edm::LogWarning("EvFDaqDirector")<< "Error creating write lock stream -: " << strerror(errno);
191 
192  // BU INITIALIZES LOCK FILE
193  // FU LOCK FILE OPEN
194  openFULockfileStream(fulockfile, true);
196  fflush(fu_rw_lock_stream);
197  close(fu_readwritelock_fd_);
198 
199  if (hltSourceDirectory_.size())
200  {
201  struct stat buf;
202  if (stat(hltSourceDirectory_.c_str(),&buf)==0) {
203  std::string hltdir=bu_run_dir_+"/hlt";
204  std::string tmphltdir=bu_run_open_dir_+"/hlt";
205  retval = mkdir(tmphltdir.c_str(),S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
206  if (retval != 0 && errno != EEXIST)
207  throw cms::Exception("DaqDirector")
208  << " Error creating bu run dir -: " << hltdir
209  << " mkdir error:" << strerror(errno) << "\n";
210 
211  boost::filesystem::copy_file(hltSourceDirectory_+"/HltConfig.py",tmphltdir+"/HltConfig.py");
212 
213  boost::filesystem::copy_file(hltSourceDirectory_+"/fffParameters.jsn",tmphltdir+"/fffParameters.jsn");
214 
215  boost::filesystem::rename(tmphltdir,hltdir);
216  }
217  else
218  throw cms::Exception("DaqDirector") << " Error looking for HLT configuration -: " << hltSourceDirectory_;
219  }
220  //else{}//no configuration specified
221  }
222  else
223  {
224  // for FU, check if bu base dir exists
225 
226  retval = mkdir(bu_base_dir_.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
227  if (retval != 0 && errno != EEXIST) {
228  throw cms::Exception("DaqDirector") << " Error checking for bu base dir -: "
229  << bu_base_dir_ << " mkdir error:" << strerror(errno) << "\n";
230  }
231 
233  std::string fulockfile = bu_run_dir_ + "/fu.lock";
234  openFULockfileStream(fulockfile, false);
235  }
236 
237  pthread_mutex_init(&init_lock_,NULL);
238 
239  stopFilePath_ = run_dir_+"/CMSSW_STOP";
240  }
struct flock bu_w_fulk
T getUntrackedParameter(std::string const &, T const &) const
struct flock fu_rw_flk
std::string run_string_
void watchPreallocate(Preallocate::slot_type const &iSlot)
void openFULockfileStream(std::string &fuLockFilePath, bool create)
void watchPreGlobalEndLumi(PreGlobalEndLumi::slot_type const &iSlot)
pthread_mutex_t init_lock_
struct flock bu_r_fulk
#define NULL
Definition: scimark2.h:8
struct flock data_rw_flk
unsigned long previousFileSize_
def chmod
Definition: eostools.py:293
struct flock fu_rw_fulk
std::string hltSourceDirectory_
std::string stopFilePath_
std::string bu_base_dir_
std::string selectedTransferMode_
void preBeginJob(edm::PathsAndConsumesOfModulesBase const &, edm::ProcessContext const &)
void watchPreGlobalBeginRun(PreGlobalBeginRun::slot_type const &iSlot)
struct flock bu_w_flk
void preBeginRun(edm::GlobalContext const &globalContext)
void preSourceEvent(edm::StreamID const &streamID)
void preGlobalEndLumi(edm::GlobalContext const &globalContext)
void watchPostGlobalEndRun(PostGlobalEndRun::slot_type const &iSlot)
void watchPreBeginJob(PreBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
std::string bu_run_dir_
def mkdir
Definition: eostools.py:250
void postEndRun(edm::GlobalContext const &globalContext)
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
void preallocate(edm::service::SystemBounds const &bounds)
struct flock data_rw_fulk
std::string getRunOpenDirPath() const
unsigned int fuLockPollInterval_
struct flock bu_r_flk
std::string bu_run_open_dir_
evf::EvFDaqDirector::~EvFDaqDirector ( )

Definition at line 242 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd2_, fulocal_rwlock_fd_, unlockFULocal(), and unlockFULocal2().

243  {
244  if (fulocal_rwlock_fd_!=-1) {
245  unlockFULocal();
246  close(fulocal_rwlock_fd_);
247  }
248 
249  if (fulocal_rwlock_fd2_!=-1) {
250  unlockFULocal2();
251  close(fulocal_rwlock_fd2_);
252  }
253 
254  }

Member Function Documentation

std::string& evf::EvFDaqDirector::baseRunDir ( )
inline

Definition at line 67 of file EvFDaqDirector.h.

References run_dir_.

67 {return run_dir_;}
std::string& evf::EvFDaqDirector::buBaseRunDir ( )
inline

Definition at line 68 of file EvFDaqDirector.h.

References bu_run_dir_.

68 {return bu_run_dir_;}
std::string bu_run_dir_
std::string& evf::EvFDaqDirector::buBaseRunOpenDir ( )
inline

Definition at line 69 of file EvFDaqDirector.h.

References bu_run_open_dir_.

69 {return bu_run_open_dir_;}
std::string bu_run_open_dir_
bool evf::EvFDaqDirector::bumpFile ( unsigned int &  ls,
unsigned int &  index,
std::string &  nextFile,
uint32_t &  fsize,
int  maxLS 
)
private

Definition at line 686 of file EvFDaqDirector.cc.

References evf::FastMonitoringService::accumulateFileSize(), fms_, getEoLSFilePathOnBU(), getInputJsonFilePath(), getNFilesFromEoLS(), cmsHarvester::index, eostools::ls(), previousFileSize_, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by updateFuLock().

686  {
687 
688  if (previousFileSize_ != 0) {
689  if (!fms_) {
690  fms_ = (FastMonitoringService *) (edm::Service<evf::MicroStateService>().operator->());
691  }
693  previousFileSize_ = 0;
694  }
695 
696  //reached limit
697  if (maxLS>=0 && ls > (unsigned int)maxLS) return false;
698 
699  struct stat buf;
700  std::stringstream ss;
701  unsigned int nextIndex = index;
702  nextIndex++;
703 
704  // 1. Check suggested file
705  nextFile = getInputJsonFilePath(ls,index);
706  if (stat(nextFile.c_str(), &buf) == 0) {
707 
708  previousFileSize_ = buf.st_size;
709  fsize = buf.st_size;
710  return true;
711  }
712  // 2. No file -> lumi ended? (and how many?)
713  else {
714  std::string BUEoLSFile = getEoLSFilePathOnBU(ls);
715  bool eolFound = (stat(BUEoLSFile.c_str(), &buf) == 0);
716  while (eolFound) {
717 
718  // recheck that no raw file appeared in the meantime
719  if (stat(nextFile.c_str(), &buf) == 0) {
720  previousFileSize_ = buf.st_size;
721  fsize = buf.st_size;
722  return true;
723  }
724 
725  int indexFilesInLS = getNFilesFromEoLS(BUEoLSFile);
726  if (indexFilesInLS < 0)
727  //parsing failed
728  return false;
729  else {
730  //check index
731  if ((int)index<indexFilesInLS) {
732  //we have 2 files, and check for 1 failed... retry (2 will never be here)
733  edm::LogError("EvFDaqDirector") << "Potential miss of index file in LS -: " << ls << ". Missing "
734  << nextFile << " because " << indexFilesInLS-1 << " is the highest index expected. Will not update fu.lock file";
735  return false;
736  }
737  }
738  // this lumi ended, check for files
739  ++ls;
740  index = 0;
741 
742  //reached limit
743  if (maxLS>=0 && ls > (unsigned int)maxLS) return false;
744 
745  nextFile = getInputJsonFilePath(ls,0);
746  if (stat(nextFile.c_str(), &buf) == 0) {
747  // a new file was found at new lumisection, index 0
748  previousFileSize_ = buf.st_size;
749  fsize = buf.st_size;
750  return true;
751  }
752  else {
753  //change of policy: we need to cycle through each LS
754  return false;
755  }
756  BUEoLSFile = getEoLSFilePathOnBU(ls);
757  eolFound = (stat(BUEoLSFile.c_str(), &buf) == 0);
758  }
759  }
760  // no new file found
761  return false;
762  }
void accumulateFileSize(unsigned int lumi, unsigned long fileSize)
def ls
Definition: eostools.py:348
std::string getEoLSFilePathOnBU(const unsigned int ls) const
unsigned long previousFileSize_
int getNFilesFromEoLS(std::string BUEoLSFile)
evf::FastMonitoringService * fms_
std::string getInputJsonFilePath(const unsigned int ls, const unsigned int index) const
void evf::EvFDaqDirector::checkTransferSystemPSet ( edm::ProcessContext const &  pc)

Definition at line 872 of file EvFDaqDirector.cc.

References Json::Value::append(), Json::arrayValue, alignCSCRings::dest, gather_cfg::destinations, Exception, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), edm::getParameterSet(), alignBH_cfg::mode, edm::ProcessContext::parameterSetID(), requireTSPSet_, and transferSystemJson_.

Referenced by preBeginJob().

873  {
874  if(transferSystemJson_) return;
875 
876  transferSystemJson_.reset(new Json::Value);
877  edm::ParameterSet const& topPset = edm::getParameterSet(pc.parameterSetID());
878  if (topPset.existsAs<edm::ParameterSet>("transferSystem",true))
879  {
880  const edm::ParameterSet& tsPset(topPset.getParameterSet("transferSystem"));
881 
882  Json::Value destinationsVal(Json::arrayValue);
883  std::vector<std::string> destinations = tsPset.getParameter<std::vector<std::string>>("destinations");
884  for (auto & dest: destinations) destinationsVal.append(dest);
885  (*transferSystemJson_)["destinations"]=destinationsVal;
886 
887  Json::Value modesVal(Json::arrayValue);
888  std::vector<std::string> modes = tsPset.getParameter< std::vector<std::string> >("transferModes");
889  for (auto & mode: modes) modesVal.append(mode);
890  (*transferSystemJson_)["transferModes"]=modesVal;
891 
892  for (auto psKeyItr =tsPset.psetTable().begin();psKeyItr!=tsPset.psetTable().end(); ++ psKeyItr) {
893  if (psKeyItr->first!="destinations" && psKeyItr->first!="transferModes") {
894  const edm::ParameterSet & streamDef = tsPset.getParameterSet(psKeyItr->first);
895  Json::Value streamVal;
896  for (auto & mode : modes) {
897  //validation
898  if (!streamDef.existsAs<std::vector<std::string>>(mode,true))
899  throw cms::Exception("EvFDaqDirector") << " Missing transfer system specification for -:" << psKeyItr->first << " (transferMode " << mode << ")";
900  std::vector<std::string> streamDestinations = streamDef.getParameter<std::vector<std::string>>(mode);
901 
902  Json::Value sDestsValue(Json::arrayValue);
903 
904  if (!streamDestinations.size())
905  throw cms::Exception("EvFDaqDirector") << " Missing transter system destination(s) for -: "<< psKeyItr->first << ", mode:" << mode;
906 
907  for (auto & sdest:streamDestinations) {
908  bool sDestValid=false;
909  sDestsValue.append(sdest);
910  for (auto & dest: destinations) {
911  if (dest==sdest) sDestValid=true;
912  }
913  if (!sDestValid)
914  throw cms::Exception("EvFDaqDirector") << " Invalid transter system destination specified for -: "<< psKeyItr->first << ", mode:" << mode << ", dest:"<<sdest;
915  }
916  streamVal[mode]=sDestsValue;
917  }
918  (*transferSystemJson_)[psKeyItr->first] = streamVal;
919  }
920  }
921  }
922  else {
923  if (requireTSPSet_)
924  throw cms::Exception("EvFDaqDirector") << "transferSystem PSet not found";
925  }
926  }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
std::shared_ptr< Json::Value > transferSystemJson_
ParameterSet const & getParameterSet(ParameterSetID const &id)
Represents a JSON value.
Definition: value.h:111
ParameterSet const & getParameterSet(std::string const &) const
tuple destinations
Definition: gather_cfg.py:144
array value (ordered list)
Definition: value.h:31
void evf::EvFDaqDirector::createProcessingNotificationMaybe ( ) const

Definition at line 975 of file EvFDaqDirector.cc.

References run_dir_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FedRawDataInputSource::checkNextEvent().

975  {
976  std::string proc_flag = run_dir_ + "/processing";
977  int proc_flag_fd = open(proc_flag.c_str(), O_RDWR | O_CREAT, S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);
978  close(proc_flag_fd);
979  }
void evf::EvFDaqDirector::createRunOpendirMaybe ( )

Definition at line 844 of file EvFDaqDirector.cc.

References getRunOpenDirPath(), LogDebug, and fed_dqm_sourceclient-live_cfg::path.

Referenced by EvFDaqDirector().

844  {
845  // create open dir if not already there
846 
848  if (!boost::filesystem::is_directory(openPath)) {
849  LogDebug("EvFDaqDirector") << "<open> FU dir not found. Creating... -:" << openPath.string();
850  boost::filesystem::create_directories(openPath);
851  }
852  }
#define LogDebug(id)
std::string getRunOpenDirPath() const
bool evf::EvFDaqDirector::emptyLumisectionMode ( ) const
inline

Definition at line 123 of file EvFDaqDirector.h.

References emptyLumisectionMode_.

Referenced by FedRawDataInputSource::checkNextEvent().

123 {return emptyLumisectionMode_;}
std::string evf::EvFDaqDirector::eolsFileName ( const unsigned int  ls) const
private
std::string evf::EvFDaqDirector::eorFileName ( ) const
private
void evf::EvFDaqDirector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 256 of file EvFDaqDirector.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), edm::ParameterSetDescription::setAllowAnything(), edm::ParameterSetDescription::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

257  {
259  desc.setComment("Service used for file locking arbitration and for propagating information between other EvF components");
260  desc.addUntracked<std::string> ("baseDir", ".")->setComment("Local base directory for run output");
261  desc.addUntracked<std::string> ("buBaseDir", ".")->setComment("BU base ramdisk directory ");
262  desc.addUntracked<unsigned int> ("runNumber",0)->setComment("Run Number in ramdisk to open");
263  desc.addUntracked<bool>("outputAdler32Recheck",false)->setComment("Check Adler32 of per-process output files while micro-merging");
264  desc.addUntracked<bool>("requireTransfersPSet",false)->setComment("Require complete transferSystem PSet in the process configuration");
265  desc.addUntracked<std::string>("selectedTransferMode","")->setComment("Selected transfer mode (choice in Lvl0 propagated as Python parameter");
266  desc.addUntracked<unsigned int>("fuLockPollInterval",2000)->setComment("Lock polling interval in microseconds for the input directory file lock");
267  desc.addUntracked<bool>("emptyLumisectionMode",false)->setComment("Enables writing stream output metadata even when no events are processed in a lumisection");
268  desc.setAllowAnything();
269  descriptions.add("EvFDaqDirector", desc);
270  }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void setAllowAnything()
allow any parameter label/value pairs
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::string evf::EvFDaqDirector::findCurrentRunDir ( )
inline

Definition at line 71 of file EvFDaqDirector.h.

References dirManager_, evf::DirManager::findRunDir(), and run_.

71 { return dirManager_.findRunDir(run_);}
std::string findRunDir(unsigned int)
Definition: DirManager.cc:37
std::string evf::EvFDaqDirector::getBoLSFilePathOnFU ( const unsigned int  ls) const

Definition at line 433 of file EvFDaqDirector.cc.

References fffnaming::bolsFileName(), run_, and run_dir_.

Referenced by FedRawDataInputSource::createBoLSFile().

433  {
434  return run_dir_ + "/" + fffnaming::bolsFileName(run_,ls);
435  }
std::string bolsFileName(const unsigned int run, const unsigned int ls)
def ls
Definition: eostools.py:348
std::string evf::EvFDaqDirector::getEoLSFilePathOnBU ( const unsigned int  ls) const

Definition at line 425 of file EvFDaqDirector.cc.

References bu_run_dir_, fffnaming::eolsFileName(), and run_.

Referenced by bumpFile(), and FedRawDataInputSource::checkNextEvent().

425  {
426  return bu_run_dir_ + "/" + fffnaming::eolsFileName(run_,ls);
427  }
def ls
Definition: eostools.py:348
std::string bu_run_dir_
std::string eolsFileName(const unsigned int run, const unsigned int ls)
std::string evf::EvFDaqDirector::getEoLSFilePathOnFU ( const unsigned int  ls) const

Definition at line 429 of file EvFDaqDirector.cc.

References fffnaming::eolsFileName(), run_, and run_dir_.

Referenced by FedRawDataInputSource::checkNextEvent(), FedRawDataInputSource::maybeOpenNewLumiSection(), and updateFuLock().

429  {
430  return run_dir_ + "/" + fffnaming::eolsFileName(run_,ls);
431  }
def ls
Definition: eostools.py:348
std::string eolsFileName(const unsigned int run, const unsigned int ls)
std::string evf::EvFDaqDirector::getEoRFilePath ( ) const

Definition at line 437 of file EvFDaqDirector.cc.

References bu_run_dir_, fffnaming::eorFileName(), and run_.

Referenced by updateFuLock().

437  {
438  return bu_run_dir_ + "/" + fffnaming::eorFileName(run_);
439  }
std::string eorFileName(const unsigned int run)
std::string bu_run_dir_
std::string evf::EvFDaqDirector::getEoRFilePathOnFU ( ) const

Definition at line 442 of file EvFDaqDirector.cc.

References fffnaming::eorFileName(), run_, and run_dir_.

Referenced by FedRawDataInputSource::checkNextEvent().

442  {
443  return run_dir_ + "/" + fffnaming::eorFileName(run_);
444  }
std::string eorFileName(const unsigned int run)
std::string evf::EvFDaqDirector::getInitFilePath ( std::string const &  stream) const

Definition at line 397 of file EvFDaqDirector.cc.

References fffnaming::initFileNameWithPid(), run_, and run_dir_.

Referenced by DQMFileSaver::globalBeginRun().

397  {
398  return run_dir_ + "/" + fffnaming::initFileNameWithPid(run_,0,stream);
399  }
std::string initFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string evf::EvFDaqDirector::getInputJsonFilePath ( const unsigned int  ls,
const unsigned int  index 
) const

Definition at line 356 of file EvFDaqDirector.cc.

References bu_run_dir_, fffnaming::inputJsonFileName(), and run_.

Referenced by bumpFile().

356  {
358  }
def ls
Definition: eostools.py:348
std::string inputJsonFileName(const unsigned int run, const unsigned int ls, const unsigned int index)
std::string bu_run_dir_
std::string evf::EvFDaqDirector::getMergedDatChecksumFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 389 of file EvFDaqDirector.cc.

References hostname_, run_, run_dir_, and fffnaming::streamerDataChecksumFileNameWithInstance().

389  {
391  }
std::string streamerDataChecksumFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
def ls
Definition: eostools.py:348
std::string evf::EvFDaqDirector::getMergedDatFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 385 of file EvFDaqDirector.cc.

References hostname_, run_, run_dir_, and fffnaming::streamerDataFileNameWithInstance().

Referenced by maybeCreateAndLockFileHeadForStream().

385  {
387  }
def ls
Definition: eostools.py:348
std::string streamerDataFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string evf::EvFDaqDirector::getMergedProtocolBufferHistogramFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 409 of file EvFDaqDirector.cc.

References hostname_, fffnaming::protocolBufferHistogramFileNameWithInstance(), run_, and run_dir_.

409  {
411  }
std::string protocolBufferHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
def ls
Definition: eostools.py:348
std::string evf::EvFDaqDirector::getMergedRootHistogramFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 421 of file EvFDaqDirector.cc.

References hostname_, fffnaming::rootHistogramFileNameWithInstance(), run_, and run_dir_.

421  {
423  }
def ls
Definition: eostools.py:348
std::string rootHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
int evf::EvFDaqDirector::getNFilesFromEoLS ( std::string  BUEoLSFile)
private

Definition at line 625 of file EvFDaqDirector.cc.

References bu_run_dir_, data, def, jsoncollector::DataPoint::deserialize(), reco::dp, eolsNFilesIndex_, jsoncollector::DataPoint::getData(), jsoncollector::DataPoint::getDefinition(), jsoncollector::DataPointDefinition::getNames(), i, Json::Reader::parse(), readEolsDefinition_, matplotRender::reader, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by bumpFile().

625  {
626 
627  boost::filesystem::ifstream ij(BUEoLSFile);
628  Json::Value deserializeRoot;
630 
631  if (!reader.parse(ij, deserializeRoot)) {
632  edm::LogError("EvFDaqDirector") << "Cannot deserialize input JSON file -:" << BUEoLSFile;
633  return -1;
634  }
635 
637  DataPoint dp;
638  dp.deserialize(deserializeRoot);
639 
640  //read definition
641  if (readEolsDefinition_) {
642  //std::string def = boost::algorithm::trim(dp.getDefinition());
644  if (!def.size()) readEolsDefinition_=false;
645  while (def.size()) {
646  std::string fullpath;
647  if (def.find('/')==0)
648  fullpath = def;
649  else
650  fullpath = bu_run_dir_+'/'+def;
651  struct stat buf;
652  if (stat(fullpath.c_str(), &buf) == 0) {
653  DataPointDefinition eolsDpd;
654  std::string defLabel = "legend";
655  DataPointDefinition::getDataPointDefinitionFor(fullpath, &eolsDpd,&defLabel);
656  if (eolsDpd.getNames().size()==0) {
657  //try with "data" label if "legend" format is not used
658  eolsDpd = DataPointDefinition();
659  defLabel="data";
660  DataPointDefinition::getDataPointDefinitionFor(fullpath, &eolsDpd,&defLabel);
661  }
662  for (unsigned int i=0;i<eolsDpd.getNames().size();i++)
663  if (eolsDpd.getNames().at(i)=="NFiles")
665  readEolsDefinition_=false;
666  break;
667  }
668  //check if we can still find definition
669  if (def.size()<=1 || def.find('/')==std::string::npos) {
670  readEolsDefinition_=false;
671  break;
672  }
673  def = def.substr(def.find('/')+1);
674  }
675  }
676 
677  if (dp.getData().size()>eolsNFilesIndex_)
678  data = dp.getData()[eolsNFilesIndex_];
679  else {
680  edm::LogError("EvFDaqDirector") << " error reading number of files from BU JSON -: " << BUEoLSFile;
681  return -1;
682  }
683  return boost::lexical_cast<int>(data);
684  }
std::vector< std::string > & getData()
Definition: DataPoint.h:58
int i
Definition: DBlmapReader.cc:9
bool parse(const std::string &document, Value &root, bool collectComments=true)
Read a Value from a JSON document.
Represents a JSON value.
Definition: value.h:111
virtual void deserialize(Json::Value &root)
Definition: DataPoint.cc:56
unsigned int eolsNFilesIndex_
auto dp
Definition: deltaR.h:22
std::string & getDefinition()
Definition: DataPoint.h:59
std::string bu_run_dir_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Unserialize a JSON document into a Value.
Definition: reader.h:16
std::vector< std::string > const & getNames()
JetCorrectorParameters::Definitions def
Definition: classes.h:6
std::string evf::EvFDaqDirector::getOpenDatFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 373 of file EvFDaqDirector.cc.

References run_, run_dir_, and fffnaming::streamerDataFileNameWithPid().

373  {
374  return run_dir_ + "/open/" + fffnaming::streamerDataFileNameWithPid(run_,ls,stream);
375  }
def ls
Definition: eostools.py:348
std::string streamerDataFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string evf::EvFDaqDirector::getOpenInitFilePath ( std::string const &  stream) const

Definition at line 393 of file EvFDaqDirector.cc.

References fffnaming::initFileNameWithPid(), run_, and run_dir_.

393  {
394  return run_dir_ + "/open/" + fffnaming::initFileNameWithPid(run_,0,stream);
395  }
std::string initFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string evf::EvFDaqDirector::getOpenInputJsonFilePath ( const unsigned int  ls,
const unsigned int  index 
) const

Definition at line 369 of file EvFDaqDirector.cc.

References bu_run_dir_, fffnaming::inputJsonFileName(), and run_.

369  {
371  }
def ls
Definition: eostools.py:348
std::string inputJsonFileName(const unsigned int run, const unsigned int ls, const unsigned int index)
std::string bu_run_dir_
std::string evf::EvFDaqDirector::getOpenOutputJsonFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 377 of file EvFDaqDirector.cc.

References run_, run_dir_, and fffnaming::streamerJsonFileNameWithPid().

377  {
378  return run_dir_ + "/open/" + fffnaming::streamerJsonFileNameWithPid(run_,ls,stream);
379  }
def ls
Definition: eostools.py:348
std::string streamerJsonFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string evf::EvFDaqDirector::getOpenProtocolBufferHistogramFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 401 of file EvFDaqDirector.cc.

References fffnaming::protocolBufferHistogramFileNameWithPid(), run_, and run_dir_.

401  {
403  }
def ls
Definition: eostools.py:348
std::string protocolBufferHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string evf::EvFDaqDirector::getOpenRawFilePath ( const unsigned int  ls,
const unsigned int  index 
) const

Definition at line 365 of file EvFDaqDirector.cc.

References bu_run_dir_, fffnaming::inputRawFileName(), and run_.

365  {
366  return bu_run_dir_ + "/open/" + fffnaming::inputRawFileName(run_,ls,index);
367  }
std::string inputRawFileName(const unsigned int run, const unsigned int ls, const unsigned int index)
def ls
Definition: eostools.py:348
std::string bu_run_dir_
std::string evf::EvFDaqDirector::getOpenRootHistogramFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 413 of file EvFDaqDirector.cc.

References fffnaming::rootHistogramFileNameWithPid(), run_, and run_dir_.

413  {
414  return run_dir_ + "/open/" + fffnaming::rootHistogramFileNameWithPid(run_,ls,stream);
415  }
def ls
Definition: eostools.py:348
std::string rootHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string evf::EvFDaqDirector::getOutputJsonFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 381 of file EvFDaqDirector.cc.

References run_, run_dir_, and fffnaming::streamerJsonFileNameWithPid().

381  {
383  }
def ls
Definition: eostools.py:348
std::string streamerJsonFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string evf::EvFDaqDirector::getProtocolBufferHistogramFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 405 of file EvFDaqDirector.cc.

References fffnaming::protocolBufferHistogramFileNameWithPid(), run_, and run_dir_.

405  {
407  }
def ls
Definition: eostools.py:348
std::string protocolBufferHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string evf::EvFDaqDirector::getRawFilePath ( const unsigned int  ls,
const unsigned int  index 
) const

Definition at line 361 of file EvFDaqDirector.cc.

References bu_run_dir_, fffnaming::inputRawFileName(), and run_.

Referenced by removeFile().

361  {
363  }
std::string inputRawFileName(const unsigned int run, const unsigned int ls, const unsigned int index)
def ls
Definition: eostools.py:348
std::string bu_run_dir_
std::string evf::EvFDaqDirector::getRootHistogramFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 417 of file EvFDaqDirector.cc.

References fffnaming::rootHistogramFileNameWithPid(), run_, and run_dir_.

417  {
419  }
def ls
Definition: eostools.py:348
std::string rootHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
unsigned int evf::EvFDaqDirector::getRunNumber ( ) const
inline

Definition at line 101 of file EvFDaqDirector.h.

References run_.

101 { return run_; }
std::string evf::EvFDaqDirector::getRunOpenDirPath ( ) const
inline

Definition at line 94 of file EvFDaqDirector.h.

References run_dir_.

Referenced by createRunOpendirMaybe(), and EvFDaqDirector().

94 {return run_dir_ +"/open";}
std::string evf::EvFDaqDirector::getStreamDestinations ( std::string const &  stream) const

Definition at line 928 of file EvFDaqDirector.cc.

References Json::Value::begin(), Json::Value::end(), Exception, visualization-live-secondInstance_cfg::msg, requireTSPSet_, runTheMatrix::ret, selectedTransferMode_, AlCaHLTBitMon_QueryRunRegistry::string, and transferSystemJson_.

929  {
930  std::string streamRequestName;
931  if (transferSystemJson_->isMember(stream.c_str()))
932  streamRequestName = stream;
933  else {
934  std::stringstream msg;
935  msg << "Transfer system mode definitions missing for -: " << stream;
936  if (requireTSPSet_)
937  throw cms::Exception("EvFDaqDirector") << msg.str();
938  else {
939  edm::LogWarning("EvFDaqDirector") << msg.str() << " (permissive mode)";
940  return std::string("Failsafe");
941  }
942  }
943  //return empty if strict check parameter is not on
945  edm::LogWarning("EvFDaqDirector") << "Selected mode string is not provided as DaqDirector parameter."
946  << "Switch on requireTSPSet parameter to enforce this requirement. Setting mode to empty string.";
947  return std::string("Failsafe");
948  }
950  throw cms::Exception("EvFDaqDirector") << "Selected mode string is not provided as DaqDirector parameter.";
951  }
952  //check if stream has properly listed transfer stream
953  if (!transferSystemJson_->get(streamRequestName, "").isMember(selectedTransferMode_.c_str()))
954  {
955  std::stringstream msg;
956  msg << "Selected transfer mode " << selectedTransferMode_ << " is not specified for stream " << streamRequestName;
957  if (requireTSPSet_)
958  throw cms::Exception("EvFDaqDirector") << msg.str();
959  else
960  edm::LogWarning("EvFDaqDirector") << msg.str() << " (permissive mode)";
961  return std::string("Failsafe");
962  }
963  Json::Value destsVec = transferSystemJson_->get(streamRequestName, "").get(selectedTransferMode_,"");
964 
965  //flatten string json::Array into CSV std::string
967  for (Json::Value::iterator it = destsVec.begin(); it!=destsVec.end(); it++)
968  {
969  if (ret!="") ret +=",";
970  ret+=(*it).asString();
971  }
972  return ret;
973  }
tuple ret
prodAgent to be discontinued
const_iterator begin() const
std::shared_ptr< Json::Value > transferSystemJson_
Represents a JSON value.
Definition: value.h:111
std::string selectedTransferMode_
const_iterator end() const
Iterator for object and array value.
Definition: value.h:1007
std::vector<int>* evf::EvFDaqDirector::getStreamFileTracker ( )
inline

Definition at line 108 of file EvFDaqDirector.h.

References streamFileTracker_.

Referenced by FedRawDataInputSource::getNextEvent().

108 {return &streamFileTracker_;}
std::vector< int > streamFileTracker_
std::string evf::EvFDaqDirector::initFileName ( std::string const &  stream) const
private
std::string evf::EvFDaqDirector::inputFileNameStem ( const unsigned int  ls,
const unsigned int  index 
) const
private
bool evf::EvFDaqDirector::isSingleStreamThread ( )
inline

Definition at line 109 of file EvFDaqDirector.h.

References nStreams_, and nThreads_.

Referenced by FedRawDataInputSource::getNextEvent().

109 {return nStreams_==1 && nThreads_==1;}
unsigned int nThreads_
unsigned int nStreams_
void evf::EvFDaqDirector::lockFULocal ( )

Definition at line 822 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd_.

Referenced by updateFuLock().

822  {
823  //fcntl(fulocal_rwlock_fd_, F_SETLKW, &fulocal_rw_flk);
824  flock(fulocal_rwlock_fd_,LOCK_SH);
825  }
void evf::EvFDaqDirector::lockFULocal2 ( )

Definition at line 833 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd2_.

Referenced by FedRawDataInputSource::checkNextEvent(), and FedRawDataInputSource::maybeOpenNewLumiSection().

833  {
834  //fcntl(fulocal_rwlock_fd2_, F_SETLKW, &fulocal_rw_flk2);
835  flock(fulocal_rwlock_fd2_,LOCK_EX);
836  }
void evf::EvFDaqDirector::lockInitLock ( )

Definition at line 814 of file EvFDaqDirector.cc.

References init_lock_.

814  {
815  pthread_mutex_lock(&init_lock_);
816  }
pthread_mutex_t init_lock_
FILE * evf::EvFDaqDirector::maybeCreateAndLockFileHeadForStream ( unsigned int  ls,
std::string &  stream 
)

Definition at line 794 of file EvFDaqDirector.cc.

References data_readwrite_fd_, data_rw_flk, data_rw_stream, getMergedDatFilePath(), and LogDebug.

794  {
795  data_rw_stream = fopen(getMergedDatFilePath(ls,stream).c_str(), "a"); //open stream for appending
797  if (data_readwrite_fd_ == -1)
798  edm::LogError("EvFDaqDirector") << "problem with creating filedesc for datamerge "
799  << strerror(errno);
800  else
801  LogDebug("EvFDaqDirector") << "creating filedesc for datamerge -: "
803  fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_flk);
804 
805  return data_rw_stream;
806  }
#define LogDebug(id)
def ls
Definition: eostools.py:348
struct flock data_rw_flk
std::string getMergedDatFilePath(const unsigned int ls, std::string const &stream) const
std::string evf::EvFDaqDirector::mergedFileNameStem ( const unsigned int  ls,
std::string const &  stream 
) const
private
void evf::EvFDaqDirector::openFULockfileStream ( std::string &  fuLockFilePath,
bool  create 
)
private

Definition at line 775 of file EvFDaqDirector.cc.

References eostools::chmod(), fu_readwritelock_fd_, fu_rw_lock_stream, and LogDebug.

Referenced by EvFDaqDirector().

775  {
776  if (create) {
777  fu_readwritelock_fd_ = open(fulockfile.c_str(), O_RDWR | O_CREAT,
778  S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);
779  chmod(fulockfile.c_str(),0766);
780  } else {
781  fu_readwritelock_fd_ = open(fulockfile.c_str(), O_RDWR, S_IRWXU);
782  }
783  if (fu_readwritelock_fd_ == -1)
784  edm::LogError("EvFDaqDirector") << "problem with creating filedesc for fuwritelock -: " << fulockfile.c_str()
785  << " create:" << create << " error:" << strerror(errno);
786  else
787  LogDebug("EvFDaqDirector") << "creating filedesc for fureadwritelock -: "
789 
790  fu_rw_lock_stream = fdopen(fu_readwritelock_fd_, "r+");
791  }
#define LogDebug(id)
def chmod
Definition: eostools.py:293
SurfaceDeformation * create(int type, const std::vector< double > &params)
bool evf::EvFDaqDirector::outputAdler32Recheck ( ) const
inline

Definition at line 95 of file EvFDaqDirector.h.

References outputAdler32Recheck_.

std::string evf::EvFDaqDirector::outputFileNameStem ( const unsigned int  ls,
std::string const &  stream 
) const
private
void evf::EvFDaqDirector::postEndRun ( edm::GlobalContext const &  globalContext)

Definition at line 272 of file EvFDaqDirector.cc.

References bu_readlock_fd_, bu_run_dir_, bu_writelock_fd_, directorBu_, lut2db_cfg::filename, removeFile(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EvFDaqDirector().

272  {
273  close(bu_readlock_fd_);
274  close(bu_writelock_fd_);
275  if (directorBu_) {
276  std::string filename = bu_run_dir_ + "/bu.lock";
277  removeFile(filename);
278  }
279  }
void removeFile(unsigned int ls, unsigned int index)
std::string bu_run_dir_
tuple filename
Definition: lut2db_cfg.py:20
void evf::EvFDaqDirector::preallocate ( edm::service::SystemBounds const &  bounds)

Definition at line 281 of file EvFDaqDirector.cc.

References i, edm::service::SystemBounds::maxNumberOfStreams(), edm::service::SystemBounds::maxNumberOfThreads(), nStreams_, nThreads_, and streamFileTracker_.

Referenced by EvFDaqDirector().

281  {
282 
283  for (unsigned int i=0;i<bounds.maxNumberOfStreams();i++){
284  streamFileTracker_.push_back(-1);
285  }
286  nThreads_=bounds.maxNumberOfStreams();
287  nStreams_=bounds.maxNumberOfThreads();
288  }
unsigned int nThreads_
int i
Definition: DBlmapReader.cc:9
std::vector< int > streamFileTracker_
unsigned int nStreams_
void evf::EvFDaqDirector::preBeginJob ( edm::PathsAndConsumesOfModulesBase const &  ,
edm::ProcessContext const &  pc 
)

Definition at line 290 of file EvFDaqDirector.cc.

References checkTransferSystemPSet().

Referenced by EvFDaqDirector().

291  {
293  }
void checkTransferSystemPSet(edm::ProcessContext const &pc)
void evf::EvFDaqDirector::preBeginRun ( edm::GlobalContext const &  globalContext)

Definition at line 295 of file EvFDaqDirector.cc.

References dirManager_, evf::DirManager::findHighestRunDir(), and run_dir_.

Referenced by EvFDaqDirector().

295  {
296 
297  //assert(run_ == id.run());
298 
299  // check if the requested run is the latest one - issue a warning if it isn't
301  edm::LogWarning("EvFDaqDirector") << "WARNING - checking run dir -: "
302  << run_dir_ << ". This is not the highest run "
304  }
305  }
std::string findHighestRunDir()
Definition: DirManager.cc:20
void evf::EvFDaqDirector::preGlobalEndLumi ( edm::GlobalContext const &  globalContext)

Definition at line 307 of file EvFDaqDirector.cc.

References cppFunctionSkipper::exception, fileDeleteLockPtr_, filesToDeletePtr_, LogDebug, eostools::ls(), edm::LuminosityBlockID::luminosityBlock(), edm::GlobalContext::luminosityBlockID(), fed_dqm_sourceclient-live_cfg::path, and MatrixUtil::remove().

Referenced by EvFDaqDirector().

308  {
309  //delete all files belonging to just closed lumi
310  unsigned int ls = globalContext.luminosityBlockID().luminosityBlock();
312  edm::LogWarning("EvFDaqDirector") << " Handles to check for files to delete were not set by the input source...";
313  return;
314  }
315 
316  std::unique_lock<std::mutex> lkw(*fileDeleteLockPtr_);
317  auto it = filesToDeletePtr_->begin();
318  while (it!=filesToDeletePtr_->end()) {
319  if (it->second->lumi_ == ls) {
320  const boost::filesystem::path filePath(it->second->fileName_);
321  LogDebug("EvFDaqDirector") << "Deleting input file -:" << it->second->fileName_;
322  try {
323  //rarely this fails but file gets deleted
324  boost::filesystem::remove(filePath);
325  }
326  catch (const boost::filesystem::filesystem_error& ex)
327  {
328  edm::LogError("EvFDaqDirector") << " - deleteFile BOOST FILESYSTEM ERROR CAUGHT -: " << ex.what() << ". Trying again.";
329  usleep(10000);
330  try {
331  boost::filesystem::remove(filePath);
332  }
333  catch (const boost::filesystem::filesystem_error&) {/*file gets deleted first time but exception is still thrown*/}
334  }
335  catch (std::exception& ex)
336  {
337  edm::LogError("EvFDaqDirector") << " - deleteFile std::exception CAUGHT -: " << ex.what() << ". Trying again.";
338  usleep(10000);
339  try {
340  boost::filesystem::remove(filePath);
341  } catch (std::exception&) {/*file gets deleted first time but exception is still thrown*/}
342  }
343 
344  delete it->second;
345  it = filesToDeletePtr_->erase(it);
346  }
347  else it++;
348  }
349  }
#define LogDebug(id)
std::list< std::pair< int, InputFile * > > * filesToDeletePtr_
def ls
Definition: eostools.py:348
std::mutex * fileDeleteLockPtr_
void evf::EvFDaqDirector::preSourceEvent ( edm::StreamID const &  streamID)
inline

Definition at line 351 of file EvFDaqDirector.cc.

References currentFileIndex_, and streamFileTracker_.

Referenced by EvFDaqDirector().

351  {
353  }
std::vector< int > streamFileTracker_
int evf::EvFDaqDirector::readLastLSEntry ( std::string const &  file)

Definition at line 855 of file EvFDaqDirector.cc.

References Json::Value::asInt(), mergeVDriftHistosByStation::file, Json::Value::get(), Json::Reader::parse(), matplotRender::reader, and runTheMatrix::ret.

Referenced by updateFuLock().

855  {
856 
857  boost::filesystem::ifstream ij(file);
858  Json::Value deserializeRoot;
860 
861  if (!reader.parse(ij, deserializeRoot)) {
862  edm::LogError("EvFDaqDirector") << "Cannot deserialize input JSON file -:" << file;
863  return -1;
864  }
865 
866  int ret = deserializeRoot.get("lastLS","").asInt();
867  return ret;
868 
869  }
Value get(UInt index, const Value &defaultValue) const
tuple ret
prodAgent to be discontinued
bool parse(const std::string &document, Value &root, bool collectComments=true)
Read a Value from a JSON document.
Represents a JSON value.
Definition: value.h:111
Int asInt() const
Unserialize a JSON document into a Value.
Definition: reader.h:16
void evf::EvFDaqDirector::removeFile ( unsigned int  ls,
unsigned int  index 
)

Definition at line 453 of file EvFDaqDirector.cc.

References getRawFilePath().

Referenced by postEndRun().

453  {
455  }
def ls
Definition: eostools.py:348
std::string getRawFilePath(const unsigned int ls, const unsigned int index) const
void removeFile(unsigned int ls, unsigned int index)
void evf::EvFDaqDirector::removeFile ( std::string  filename)

Definition at line 446 of file EvFDaqDirector.cc.

446  {
447  int retval = remove(filename.c_str());
448  if (retval != 0)
449  edm::LogError("EvFDaqDirector") << "Could not remove used file -: " << filename << ". error = "
450  << strerror(errno);
451  }
tuple filename
Definition: lut2db_cfg.py:20
void evf::EvFDaqDirector::setDeleteTracking ( std::mutex fileDeleteLock,
std::list< std::pair< int, InputFile * >> *  filesToDelete 
)
inline

Definition at line 117 of file EvFDaqDirector.h.

References fileDeleteLockPtr_, and filesToDeletePtr_.

Referenced by FedRawDataInputSource::FedRawDataInputSource().

117  {
118  fileDeleteLockPtr_=fileDeleteLock;
119  filesToDeletePtr_ = filesToDelete;
120  }
std::list< std::pair< int, InputFile * > > * filesToDeletePtr_
std::mutex * fileDeleteLockPtr_
void evf::EvFDaqDirector::setFMS ( evf::FastMonitoringService fms)
inline

Definition at line 106 of file EvFDaqDirector.h.

References fms_.

Referenced by FedRawDataInputSource::FedRawDataInputSource().

106 {fms_=fms;}
evf::FastMonitoringService * fms_
void evf::EvFDaqDirector::tryInitializeFuLockFile ( )

Definition at line 764 of file EvFDaqDirector.cc.

References fu_rw_lock_stream, and getHLTprescales::readIndex().

Referenced by EvFDaqDirector().

764  {
765  if (fu_rw_lock_stream == 0)
766  edm::LogError("EvFDaqDirector") << "Error creating fu read/write lock stream "
767  << strerror(errno);
768  else {
769  edm::LogInfo("EvFDaqDirector") << "Initializing FU LOCK FILE";
770  unsigned int readLs = 1, readIndex = 0;
771  fprintf(fu_rw_lock_stream, "%u %u", readLs, readIndex);
772  }
773  }
void evf::EvFDaqDirector::unlockAndCloseMergeStream ( )

Definition at line 808 of file EvFDaqDirector.cc.

References data_readwrite_fd_, data_rw_fulk, and data_rw_stream.

808  {
809  fflush(data_rw_stream);
810  fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_fulk);
811  fclose(data_rw_stream);
812  }
struct flock data_rw_fulk
void evf::EvFDaqDirector::unlockFULocal ( )

Definition at line 827 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd_.

Referenced by FedRawDataInputSource::grabNextJsonFile(), and ~EvFDaqDirector().

827  {
828  //fcntl(fulocal_rwlock_fd_, F_SETLKW, &fulocal_rw_fulk);
829  flock(fulocal_rwlock_fd_,LOCK_UN);
830  }
void evf::EvFDaqDirector::unlockFULocal2 ( )

Definition at line 838 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd2_.

Referenced by FedRawDataInputSource::checkNextEvent(), FedRawDataInputSource::maybeOpenNewLumiSection(), and ~EvFDaqDirector().

838  {
839  //fcntl(fulocal_rwlock_fd2_, F_SETLKW, &fulocal_rw_fulk2);
840  flock(fulocal_rwlock_fd2_,LOCK_UN);
841  }
void evf::EvFDaqDirector::unlockInitLock ( )

Definition at line 818 of file EvFDaqDirector.cc.

References init_lock_.

818  {
819  pthread_mutex_unlock(&init_lock_);
820  }
pthread_mutex_t init_lock_
void evf::EvFDaqDirector::updateFileIndex ( int const &  fileIndex)
inline

Definition at line 107 of file EvFDaqDirector.h.

References currentFileIndex_.

Referenced by FedRawDataInputSource::getNextEvent().

107 {currentFileIndex_=fileIndex;}
EvFDaqDirector::FileStatus evf::EvFDaqDirector::updateFuLock ( unsigned int &  ls,
std::string &  nextFile,
uint32_t &  fsize,
uint64_t &  lockWaitTime 
)

Definition at line 457 of file EvFDaqDirector.cc.

References bu_run_dir_, bumpFile(), DDVectorGetter::check(), Exception, fu_readwritelock_fd_, fu_rw_flk, fu_rw_fulk, fu_rw_lock_stream, fuLockPollInterval_, getEoLSFilePathOnFU(), getEoRFilePath(), lockFULocal(), LogDebug, eostools::ls(), newFile, noFile, getHLTprescales::readIndex(), readLastLSEntry(), runEnded, and stopFilePath_.

Referenced by FedRawDataInputSource::readSupervisor().

457  {
458  EvFDaqDirector::FileStatus fileStatus = noFile;
459 
460  int retval = -1;
461  int lock_attempts = 0;
462 
463  struct stat buf;
464  int stopFileLS = -1;
465  if (stat(stopFilePath_.c_str(),&buf)==0) {
466  stopFileLS = readLastLSEntry(stopFilePath_);
467  edm::LogWarning("EvFDaqDirector") << "Detected stop request from hltd. Ending run for this process after LS -: " << stopFileLS;
468  //return runEnded;
469  }
470 
471  timeval ts_lockbegin;
472  gettimeofday(&ts_lockbegin,0);
473 
474  while (retval==-1) {
475  retval = fcntl(fu_readwritelock_fd_, F_SETLK, &fu_rw_flk);
476  if (retval==-1) usleep(fuLockPollInterval_);
477  else continue;
478 
479  lock_attempts+=fuLockPollInterval_;
480  if (lock_attempts>5000000 || errno==116) {
481  if (errno==116)
482  edm::LogWarning("EvFDaqDirector") << "Stale lock file handle. Checking if run directory and fu.lock file are present" << std::endl;
483  else
484  edm::LogWarning("EvFDaqDirector") << "Unable to obtain a lock for 5 seconds. Checking if run directory and fu.lock file are present -: errno "
485  << errno <<":"<< strerror(errno) << std::endl;
486 
487 
488  if (stat(getEoLSFilePathOnFU(ls).c_str(),&buf)==0) {
489  edm::LogWarning("EvFDaqDirector") << "Detected local EoLS for lumisection "<< ls ;
490  ls++;
491  return noFile;
492  }
493 
494  if (stat(bu_run_dir_.c_str(), &buf)!=0) return runEnded;
495  if (stat((bu_run_dir_+"/fu.lock").c_str(), &buf)!=0) return runEnded;
496  lock_attempts=0;
497  }
498  }
499 
500  timeval ts_lockend;
501  gettimeofday(&ts_lockend,0);
502  long deltat = (ts_lockend.tv_usec-ts_lockbegin.tv_usec) + (ts_lockend.tv_sec-ts_lockbegin.tv_sec)*1000000;
503  if (deltat>0.) lockWaitTime=deltat;
504 
505 
506 
507  if(retval!=0) return fileStatus;
508 
509 #ifdef DEBUG
510  timeval ts_lockend;
511  gettimeofday(&ts_lockend,0);
512 #endif
513 
514  // if the stream is readable
515  if (fu_rw_lock_stream != 0) {
516  unsigned int readLs, readIndex;
517  int check = 0;
518  // rewind the stream
519  check = fseek(fu_rw_lock_stream, 0, SEEK_SET);
520  // if rewinded ok
521  if (check == 0) {
522  // read its' values
523  fscanf(fu_rw_lock_stream, "%u %u", &readLs, &readIndex);
524  edm::LogInfo("EvFDaqDirector") << "Read fu.lock file file -: " << readLs << ":" << readIndex;
525 
526  unsigned int currentLs = readLs;
527  bool bumpedOk = false;
528  //if next lumisection in a lock file is not +1 wrt. source, cycle through the next empty one, unless initial lumi not yet set
529  //no lock file write in this case
530  if (ls && ls+1 < currentLs) ls++;
531  else {
532  // try to bump (look for new index or EoLS file)
533  bumpedOk = bumpFile(readLs, readIndex, nextFile, fsize, stopFileLS);
534  //avoid 2 lumisections jump
535  if (ls && readLs>currentLs && currentLs > ls) {
536  ls++;
537  readLs=currentLs=ls;
538  readIndex=0;
539  bumpedOk=false;
540  //no write to lock file
541  }
542  else {
543  if (ls==0 && readLs>currentLs) {
544  //make sure to intialize always with LS found in the lock file, with possibility of grabbing index file immediately
545  //in this case there is no new file in the same LS
546  readLs=currentLs;
547  readIndex=0;
548  bumpedOk=false;
549  //no write to lock file
550  }
551  //update return LS value
552  ls = readLs;
553  }
554  }
555  if (bumpedOk) {
556  // there is a new index file to grab, lock file needs to be updated
557  check = fseek(fu_rw_lock_stream, 0, SEEK_SET);
558  if (check == 0) {
559  ftruncate(fu_readwritelock_fd_, 0);
560  // write next index in the file, which is the file the next process should take
561  fprintf(fu_rw_lock_stream, "%u %u", readLs, readIndex + 1);
562  fflush(fu_rw_lock_stream);
563  fsync(fu_readwritelock_fd_);
564  fileStatus = newFile;
565  LogDebug("EvFDaqDirector") << "Written to file -: " << readLs << ":" << readIndex + 1;
566  }
567  else {
568  throw cms::Exception("EvFDaqDirector") << "seek on fu read/write lock for updating failed with error " << strerror(errno);
569  }
570  }
571  else if (currentLs < readLs) {
572  //there is no new file in next LS (yet), but lock file can be updated to the next LS
573  check = fseek(fu_rw_lock_stream, 0, SEEK_SET);
574  if (check == 0) {
575  ftruncate(fu_readwritelock_fd_, 0);
576  // in this case LS was bumped, but no new file. Thus readIndex is 0 (set by bumpFile)
577  fprintf(fu_rw_lock_stream, "%u %u", readLs, readIndex);
578  fflush(fu_rw_lock_stream);
579  fsync(fu_readwritelock_fd_);
580  LogDebug("EvFDaqDirector") << "Written to file -: " << readLs << ":" << readIndex;
581  }
582  else {
583  throw cms::Exception("EvFDaqDirector") << "seek on fu read/write lock for updating failed with error " << strerror(errno);
584  }
585  }
586  } else {
587  edm::LogError("EvFDaqDirector") << "seek on fu read/write lock for reading failed with error " << strerror(errno);
588  }
589  } else {
590  edm::LogError("EvFDaqDirector") << "fu read/write lock stream is invalid " << strerror(errno);
591  }
592 
593 #ifdef DEBUG
594  timeval ts_preunlock;
595  gettimeofday(&ts_preunlock,0);
596  int locked_period_int = ts_preunlock.tv_sec - ts_lockend.tv_sec;
597  double locked_period=locked_period_int+double(ts_preunlock.tv_usec - ts_lockend.tv_usec)/1000000;
598 #endif
599 
600  //if new json is present, lock file which FedRawDataInputSource will later unlock
601  if (fileStatus==newFile) lockFULocal();
602 
603  //release lock at this point
604  int retvalu=-1;
605  retvalu=fcntl(fu_readwritelock_fd_, F_SETLKW, &fu_rw_fulk);
606  if (retvalu==-1) edm::LogError("EvFDaqDirector") << "Error unlocking the fu.lock " << strerror(errno);
607 
608 #ifdef DEBUG
609  edm::LogDebug("EvFDaqDirector") << "Waited during lock -: " << locked_period << " seconds";
610 #endif
611 
612  if ( fileStatus == noFile ) {
613  struct stat buf;
614  //edm::LogInfo("EvFDaqDirector") << " looking for EoR file: " << getEoRFilePath().c_str();
615  if ( stat(getEoRFilePath().c_str(), &buf) == 0 || stat(bu_run_dir_.c_str(), &buf)!=0)
616  fileStatus = runEnded;
617  if (stopFileLS>=0 && (int)ls > stopFileLS) {
618  edm::LogInfo("EvFDaqDirector") << "Reached maximum lumisection set by hltd";
619  fileStatus = runEnded;
620  }
621  }
622  return fileStatus;
623  }
#define LogDebug(id)
struct flock fu_rw_flk
def ls
Definition: eostools.py:348
std::string getEoRFilePath() const
struct flock fu_rw_fulk
bool check(const std::string &)
std::string stopFilePath_
int readLastLSEntry(std::string const &file)
std::string bu_run_dir_
std::string getEoLSFilePathOnFU(const unsigned int ls) const
bool bumpFile(unsigned int &ls, unsigned int &index, std::string &nextFile, uint32_t &fsize, int maxLS)
unsigned int fuLockPollInterval_

Member Data Documentation

std::string evf::EvFDaqDirector::base_dir_
private

Definition at line 139 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector().

std::string evf::EvFDaqDirector::bu_base_dir_
private

Definition at line 140 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector().

struct flock evf::EvFDaqDirector::bu_r_flk
private

Definition at line 175 of file EvFDaqDirector.h.

struct flock evf::EvFDaqDirector::bu_r_fulk
private

Definition at line 177 of file EvFDaqDirector.h.

FILE* evf::EvFDaqDirector::bu_r_lock_stream
private

Definition at line 164 of file EvFDaqDirector.h.

int evf::EvFDaqDirector::bu_readlock_fd_
private

Definition at line 156 of file EvFDaqDirector.h.

Referenced by postEndRun().

std::string evf::EvFDaqDirector::bu_run_dir_
private
std::string evf::EvFDaqDirector::bu_run_open_dir_
private

Definition at line 154 of file EvFDaqDirector.h.

Referenced by buBaseRunOpenDir(), and EvFDaqDirector().

FILE* evf::EvFDaqDirector::bu_t_monitor_stream
private

Definition at line 167 of file EvFDaqDirector.h.

struct flock evf::EvFDaqDirector::bu_w_flk
private

Definition at line 174 of file EvFDaqDirector.h.

struct flock evf::EvFDaqDirector::bu_w_fulk
private

Definition at line 176 of file EvFDaqDirector.h.

FILE* evf::EvFDaqDirector::bu_w_lock_stream
private

Definition at line 163 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector().

FILE* evf::EvFDaqDirector::bu_w_monitor_stream
private

Definition at line 166 of file EvFDaqDirector.h.

int evf::EvFDaqDirector::bu_writelock_fd_
private

Definition at line 157 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), and postEndRun().

int evf::EvFDaqDirector::currentFileIndex_ = -1
private

Definition at line 189 of file EvFDaqDirector.h.

Referenced by preSourceEvent(), and updateFileIndex().

int evf::EvFDaqDirector::data_readwrite_fd_
private
struct flock evf::EvFDaqDirector::data_rw_flk
private

Definition at line 180 of file EvFDaqDirector.h.

Referenced by maybeCreateAndLockFileHeadForStream().

struct flock evf::EvFDaqDirector::data_rw_fulk
private

Definition at line 181 of file EvFDaqDirector.h.

Referenced by unlockAndCloseMergeStream().

FILE* evf::EvFDaqDirector::data_rw_stream
private
bool evf::EvFDaqDirector::directorBu_
private

Definition at line 141 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), and postEndRun().

DirManager evf::EvFDaqDirector::dirManager_
private

Definition at line 170 of file EvFDaqDirector.h.

Referenced by findCurrentRunDir(), and preBeginRun().

bool evf::EvFDaqDirector::emptyLumisectionMode_
private

Definition at line 148 of file EvFDaqDirector.h.

Referenced by emptyLumisectionMode(), and EvFDaqDirector().

unsigned int evf::EvFDaqDirector::eolsNFilesIndex_ = 1
private

Definition at line 200 of file EvFDaqDirector.h.

Referenced by getNFilesFromEoLS().

std::mutex* evf::EvFDaqDirector::fileDeleteLockPtr_ = nullptr
private

Definition at line 191 of file EvFDaqDirector.h.

Referenced by preGlobalEndLumi(), and setDeleteTracking().

std::list<std::pair<int,InputFile*> >* evf::EvFDaqDirector::filesToDeletePtr_ = nullptr
private

Definition at line 192 of file EvFDaqDirector.h.

Referenced by preGlobalEndLumi(), and setDeleteTracking().

evf::FastMonitoringService* evf::EvFDaqDirector::fms_ = nullptr
private

Definition at line 187 of file EvFDaqDirector.h.

Referenced by bumpFile(), and setFMS().

int evf::EvFDaqDirector::fu_readwritelock_fd_
private

Definition at line 158 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), openFULockfileStream(), and updateFuLock().

struct flock evf::EvFDaqDirector::fu_rw_flk
private

Definition at line 178 of file EvFDaqDirector.h.

Referenced by updateFuLock().

struct flock evf::EvFDaqDirector::fu_rw_fulk
private

Definition at line 179 of file EvFDaqDirector.h.

Referenced by updateFuLock().

FILE* evf::EvFDaqDirector::fu_rw_lock_stream
private
int evf::EvFDaqDirector::fulocal_rwlock_fd2_
private

Definition at line 161 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), lockFULocal2(), unlockFULocal2(), and ~EvFDaqDirector().

int evf::EvFDaqDirector::fulocal_rwlock_fd_
private

Definition at line 160 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), lockFULocal(), unlockFULocal(), and ~EvFDaqDirector().

unsigned int evf::EvFDaqDirector::fuLockPollInterval_
private

Definition at line 147 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), and updateFuLock().

std::string evf::EvFDaqDirector::hltSourceDirectory_
private

Definition at line 146 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector().

std::string evf::EvFDaqDirector::hostname_
private
pthread_mutex_t evf::EvFDaqDirector::init_lock_ = PTHREAD_MUTEX_INITIALIZER
private

Definition at line 194 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), lockInitLock(), and unlockInitLock().

unsigned int evf::EvFDaqDirector::nStreams_ =0
private

Definition at line 196 of file EvFDaqDirector.h.

Referenced by isSingleStreamThread(), and preallocate().

unsigned int evf::EvFDaqDirector::nThreads_ =0
private

Definition at line 197 of file EvFDaqDirector.h.

Referenced by isSingleStreamThread(), and preallocate().

bool evf::EvFDaqDirector::outputAdler32Recheck_
private

Definition at line 143 of file EvFDaqDirector.h.

Referenced by outputAdler32Recheck().

unsigned long evf::EvFDaqDirector::previousFileSize_
private

Definition at line 172 of file EvFDaqDirector.h.

Referenced by bumpFile().

bool evf::EvFDaqDirector::readEolsDefinition_ = true
private

Definition at line 199 of file EvFDaqDirector.h.

Referenced by getNFilesFromEoLS().

bool evf::EvFDaqDirector::requireTSPSet_
private

Definition at line 144 of file EvFDaqDirector.h.

Referenced by checkTransferSystemPSet(), and getStreamDestinations().

unsigned int evf::EvFDaqDirector::run_
private
std::string evf::EvFDaqDirector::run_dir_
private
std::string evf::EvFDaqDirector::run_string_
private

Definition at line 151 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector().

std::string evf::EvFDaqDirector::selectedTransferMode_
private

Definition at line 145 of file EvFDaqDirector.h.

Referenced by getStreamDestinations().

std::string evf::EvFDaqDirector::stopFilePath_
private

Definition at line 201 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), and updateFuLock().

std::vector<int> evf::EvFDaqDirector::streamFileTracker_
private

Definition at line 188 of file EvFDaqDirector.h.

Referenced by getStreamFileTracker(), preallocate(), and preSourceEvent().

std::shared_ptr<Json::Value> evf::EvFDaqDirector::transferSystemJson_
private

Definition at line 203 of file EvFDaqDirector.h.

Referenced by checkTransferSystemPSet(), and getStreamDestinations().