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 | Private Member Functions | Private Attributes
evf::EvFDaqDirector Class Reference

#include <EvFDaqDirector.h>

Public Types

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

Public Member Functions

std::string & baseRunDir ()
 
std::string & buBaseRunDir ()
 
std::string & buBaseRunOpenDir ()
 
void createRunOpendirMaybe ()
 
 EvFDaqDirector (const edm::ParameterSet &pset, edm::ActivityRegistry &reg)
 
std::string findCurrentRunDir ()
 
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 getJumpFilePath () const
 
unsigned int getJumpIndex () const
 
unsigned int getJumpLS () 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 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::vector< int > * getStreamFileTracker ()
 
bool getTestModeNoBuilderUnit ()
 
bool isSingleStreamThread ()
 
void lockFULocal ()
 
void lockFULocal2 ()
 
void lockInitLock ()
 
FILE * maybeCreateAndLockFileHeadForStream (unsigned int ls, std::string &stream)
 
void postEndRun (edm::GlobalContext const &globalContext)
 
void preallocate (edm::service::SystemBounds const &bounds)
 
void preBeginRun (edm::GlobalContext const &globalContext)
 
void preGlobalEndLumi (edm::GlobalContext const &globalContext)
 
void preSourceEvent (edm::StreamID const &streamID)
 
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)
 
 ~EvFDaqDirector ()
 

Private Member Functions

bool bumpFile (unsigned int &ls, unsigned int &index, std::string &nextFile, uint32_t &fsize)
 
std::string eolsFileName (const unsigned int ls) const
 
std::string eorFileName () const
 
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_
 
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_
 
std::string hostname_
 
pthread_mutex_t init_lock_ = PTHREAD_MUTEX_INITIALIZER
 
unsigned int jumpIndex_
 
unsigned int jumpLS_
 
unsigned int nStreams_ =0
 
unsigned int nThreads_ =0
 
unsigned long previousFileSize_
 
unsigned int run_
 
std::string run_dir_
 
std::string run_string_
 
std::vector< int > streamFileTracker_
 
bool testModeNoBuilderUnit_
 

Detailed Description

Definition at line 38 of file EvFDaqDirector.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 35 of file EvFDaqDirector.cc.

References base_dir_, bu_base_dir_, bu_run_dir_, bu_run_open_dir_, bu_w_lock_stream, bu_writelock_fd_, createRunOpendirMaybe(), directorBu_, edm::hlt::Exception, fu_readwritelock_fd_, fu_rw_lock_stream, fulocal_rwlock_fd2_, fulocal_rwlock_fd_, getRunOpenDirPath(), hostname_, init_lock_, NULL, openFULockfileStream(), postEndRun(), preallocate(), preBeginRun(), preGlobalEndLumi(), preSourceEvent(), run_, run_dir_, run_string_, AlCaHLTBitMon_QueryRunRegistry::string, tryInitializeFuLockFile(), edm::ActivityRegistry::watchPostGlobalEndRun(), edm::ActivityRegistry::watchPreallocate(), edm::ActivityRegistry::watchPreGlobalBeginRun(), edm::ActivityRegistry::watchPreGlobalEndLumi(), and edm::ActivityRegistry::watchPreSourceEvent().

36  :
38  pset.getUntrackedParameter<bool> ("testModeNoBuilderUnit",
39  false)
40  ),
41  base_dir_(
42  pset.getUntrackedParameter<std::string> ("baseDir", "/data")
43  ),
45  pset.getUntrackedParameter<std::string> ("buBaseDir", "/data")
46  ),
48  pset.getUntrackedParameter<bool> ("directorIsBu", false)
49  ),
50  run_(pset.getUntrackedParameter<unsigned int> ("runNumber",0)),
51  hostname_(""),
52  bu_readlock_fd_(-1),
53  bu_writelock_fd_(-1),
58 
62  //bu_w_monitor_stream(0),
63  //bu_t_monitor_stream(0),
64  data_rw_stream(0),
65 
67 
69  jumpLS_(0),
70  jumpIndex_(0),
71 
72  bu_w_flk( make_flock( F_WRLCK, SEEK_SET, 0, 0, 0 )),
73  bu_r_flk( make_flock( F_RDLCK, SEEK_SET, 0, 0, 0 )),
74  bu_w_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, 0 )),
75  bu_r_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, 0 )),
76  fu_rw_flk( make_flock ( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
77  fu_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() )),
78  data_rw_flk( make_flock ( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
79  data_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() ))
80  //fulocal_rw_flk( make_flock( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
81  //fulocal_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() )),
82  //fulocal_rw_flk2( make_flock( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
83  //fulocal_rw_fulk2( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() ))
84  {
85 
91 
92  std::stringstream ss;
93  ss << "run" << std::setfill('0') << std::setw(6) << run_;
94  run_string_ = ss.str();
96 
97  //save hostname for later
98  char hostname[33];
99  gethostname(hostname,32);
100  hostname_ = hostname;
101  // check if base dir exists or create it accordingly
102  int retval = mkdir(base_dir_.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
103  if (retval != 0 && errno != EEXIST) {
104  throw cms::Exception("DaqDirector") << " Error checking for base dir -: "
105  << base_dir_ << " mkdir error:" << strerror(errno);
106  }
107 
108  //create run dir in base dir
109  umask(0);
110  retval = mkdir(run_dir_.c_str(),
111  S_IRWXU | S_IRWXG | S_IROTH | S_IRWXO | S_IXOTH);
112  if (retval != 0 && errno != EEXIST) {
113  throw cms::Exception("DaqDirector") << " Error creating run dir -: "
114  << run_dir_ << " mkdir error:" << strerror(errno);
115  }
116 
117  //create fu-local.lock in run open dir
118  if (!directorBu_) {
119 
121  std::string fulocal_lock_ = getRunOpenDirPath() +"/fu-local.lock";
122  fulocal_rwlock_fd_ = open(fulocal_lock_.c_str(), O_RDWR | O_CREAT, S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);//O_RDWR?
123  if (fulocal_rwlock_fd_==-1)
124  throw cms::Exception("DaqDirector") << " Error creating/opening a local lock file -: " << fulocal_lock_.c_str() << " : " << strerror(errno);
125  chmod(fulocal_lock_.c_str(),0777);
126  fsync(fulocal_rwlock_fd_);
127  //open second fd for another input source thread
128  fulocal_rwlock_fd2_ = open(fulocal_lock_.c_str(), O_RDWR, S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);//O_RDWR?
129  if (fulocal_rwlock_fd2_==-1)
130  throw cms::Exception("DaqDirector") << " Error opening a local lock file -: " << fulocal_lock_.c_str() << " : " << strerror(errno);
131  }
132 
133  //bu_run_dir: for FU, for which the base dir is local and the BU is remote, it is expected to be there
134  //for BU, it is created at this point
135  if (directorBu_)
136  {
138  std::string bulockfile = bu_run_dir_ + "/bu.lock";
139  std::string fulockfile = bu_run_dir_ + "/fu.lock";
140 
141  //make or find bu run dir
142  retval = mkdir(bu_run_dir_.c_str(),
143  S_IRWXU | S_IRWXG | S_IRWXO);
144  if (retval != 0 && errno != EEXIST) {
145  throw cms::Exception("DaqDirector")
146  << " Error creating bu run dir -: " << bu_run_dir_
147  << " mkdir error:" << strerror(errno) << "\n";
148  }
149  bu_run_open_dir_ = bu_run_dir_ + "/open";
150  retval = mkdir(bu_run_open_dir_.c_str(),
151  S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
152  if (retval != 0 && errno != EEXIST) {
153  throw cms::Exception("DaqDirector") << " Error creating bu run open dir -: "
154  << bu_run_open_dir_ << " mkdir error:" << strerror(errno)
155  << "\n";
156  }
157 
158  // the BU director does not need to know about the fu lock
159  bu_writelock_fd_ = open(bulockfile.c_str(),
160  O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU);
161  if (bu_writelock_fd_ == -1)
162  edm::LogWarning("EvFDaqDirector") << "problem with creating filedesc for buwritelock -: "
163  << strerror(errno);
164  else
165  edm::LogInfo("EvFDaqDirector") << "creating filedesc for buwritelock -: "
166  << bu_writelock_fd_;
167  bu_w_lock_stream = fdopen(bu_writelock_fd_, "w");
168  if (bu_w_lock_stream == 0)
169  edm::LogWarning("EvFDaqDirector")<< "Error creating write lock stream -: " << strerror(errno);
170 
171  // BU INITIALIZES LOCK FILE
172  // FU LOCK FILE OPEN
173  openFULockfileStream(fulockfile, true);
175  fflush(fu_rw_lock_stream);
176  close(fu_readwritelock_fd_);
177  }
178  else
179  {
180  // for FU, check if bu base dir exists
181 
182  retval = mkdir(bu_base_dir_.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
183  if (retval != 0 && errno != EEXIST) {
184  throw cms::Exception("DaqDirector") << " Error checking for bu base dir -: "
185  << bu_base_dir_ << " mkdir error:" << strerror(errno) << "\n";
186  }
187 
189  std::string fulockfile = bu_run_dir_ + "/fu.lock";
190  openFULockfileStream(fulockfile, false);
191  }
192 
193  pthread_mutex_init(&init_lock_,NULL);
194 
195  }
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_
unsigned int jumpIndex_
struct flock fu_rw_fulk
std::string bu_base_dir_
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)
std::string bu_run_dir_
void postEndRun(edm::GlobalContext const &globalContext)
unsigned int jumpLS_
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
void preallocate(edm::service::SystemBounds const &bounds)
struct flock data_rw_fulk
std::string getRunOpenDirPath() const
struct flock bu_r_flk
std::string bu_run_open_dir_
evf::EvFDaqDirector::~EvFDaqDirector ( )

Definition at line 197 of file EvFDaqDirector.cc.

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

198  {
199  if (fulocal_rwlock_fd_!=-1) {
200  unlockFULocal();
201  close(fulocal_rwlock_fd_);
202  }
203 
204  if (fulocal_rwlock_fd2_!=-1) {
205  unlockFULocal2();
206  close(fulocal_rwlock_fd2_);
207  }
208 
209  }

Member Function Documentation

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

Definition at line 52 of file EvFDaqDirector.h.

References run_dir_.

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

Definition at line 53 of file EvFDaqDirector.h.

References bu_run_dir_.

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

Definition at line 54 of file EvFDaqDirector.h.

References bu_run_open_dir_.

54 {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 
)
private

Definition at line 488 of file EvFDaqDirector.cc.

References evf::FastMonitoringService::accumulateFileSize(), fms_, getEoLSFilePathOnBU(), getInputJsonFilePath(), getHLTprescales::index, python.rootplot.utilities::ls(), previousFileSize_, AlCaHLTBitMon_QueryRunRegistry::string, and testModeNoBuilderUnit_.

Referenced by updateFuLock().

488  {
489 
490  if (previousFileSize_ != 0) {
491  if (!fms_) {
492  try {
494  } catch (...) {
495  edm::LogError("EvFDaqDirector") <<" FastMonitoringService not found";
496  }
497  }
499  previousFileSize_ = 0;
500  }
501 
502  struct stat buf;
503  std::stringstream ss;
504  unsigned int nextIndex = index;
505  nextIndex++;
506 
507  // 1. Check suggested file
508  nextFile = getInputJsonFilePath(ls,index);
509  if (stat(nextFile.c_str(), &buf) == 0) {
510 
511  previousFileSize_ = buf.st_size;
512  fsize = buf.st_size;
513  return true;
514  }
515  // 2. No file -> lumi ended? (and how many?)
516  else {
517  bool eolFound = (stat(getEoLSFilePathOnBU(ls).c_str(), &buf) == 0);
518  unsigned int startingLumi = ls;
519  while (eolFound) {
520  //DEBUG!
521  //remove this for testing (might not be necessary after all..)
522  /*
523  // recheck that no raw file appeared in the meantime
524  if (stat(nextFile.c_str(), &buf) == 0) {
525  previousFileSize_ = buf.st_size;
526  fsize = buf.st_size;
527  return true;
528  }
529  */
530  // this lumi ended, check for files
531  ++ls;
532  nextFile = getInputJsonFilePath(ls,0);
533  if (stat(nextFile.c_str(), &buf) == 0) {
534  // a new file was found at new lumisection, index 0
535  index = 0;
536  previousFileSize_ = buf.st_size;
537  fsize = buf.st_size;
538 
540  // rename ended lumi to + 2
541  std::string sourceEol = getEoLSFilePathOnBU(startingLumi);
542 
543  std::string destEol = getEoLSFilePathOnBU(startingLumi+2);
544 
545  std::string cpCmd = "cp " + sourceEol + " " + destEol;
546  edm::LogInfo("EvFDaqDirector") << " testmode: Running copy cmd -: " << cpCmd;
547  int rc = system(cpCmd.c_str());
548  if (rc != 0) {
549  edm::LogError("EvFDaqDirector") << " testmode: COPY EOL FAILED!!!!! -: " << cpCmd;
550  }
551  }
552 
553  return true;
554  }
555  eolFound = (stat(getEoLSFilePathOnBU(ls).c_str(), &buf) == 0);
556  }
557  }
558  // no new file found
559  return false;
560  }
void accumulateFileSize(unsigned int lumi, unsigned long fileSize)
std::string getEoLSFilePathOnBU(const unsigned int ls) const
unsigned long previousFileSize_
evf::FastMonitoringService * fms_
std::string getInputJsonFilePath(const unsigned int ls, const unsigned int index) const
void evf::EvFDaqDirector::createRunOpendirMaybe ( )

Definition at line 646 of file EvFDaqDirector.cc.

References getRunOpenDirPath(), LogDebug, and getHLTPrescaleColumns::path.

Referenced by EvFDaqDirector().

646  {
647  // create open dir if not already there
648 
650  if (!boost::filesystem::is_directory(openPath)) {
651  LogDebug("EvFDaqDirector") << "<open> FU dir not found. Creating... -:" << openPath.string();
652  boost::filesystem::create_directories(openPath);
653  }
654  }
#define LogDebug(id)
std::string getRunOpenDirPath() const
std::string evf::EvFDaqDirector::eolsFileName ( const unsigned int  ls) const
private
std::string evf::EvFDaqDirector::eorFileName ( ) const
private
std::string evf::EvFDaqDirector::findCurrentRunDir ( )
inline

Definition at line 56 of file EvFDaqDirector.h.

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

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

Definition at line 352 of file EvFDaqDirector.cc.

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

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

352  {
353  return bu_run_dir_ + "/" + fffnaming::eolsFileName(run_,ls);
354  }
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 356 of file EvFDaqDirector.cc.

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

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

356  {
357  return run_dir_ + "/" + fffnaming::eolsFileName(run_,ls);
358  }
std::string eolsFileName(const unsigned int run, const unsigned int ls)
std::string evf::EvFDaqDirector::getEoRFilePath ( ) const

Definition at line 360 of file EvFDaqDirector.cc.

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

Referenced by updateFuLock().

360  {
361  return bu_run_dir_ + "/" + fffnaming::eorFileName(run_);
362  }
std::string eorFileName(const unsigned int run)
std::string bu_run_dir_
std::string evf::EvFDaqDirector::getEoRFilePathOnFU ( ) const

Definition at line 365 of file EvFDaqDirector.cc.

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

Referenced by FedRawDataInputSource::checkNextEvent().

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

Definition at line 324 of file EvFDaqDirector.cc.

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

324  {
326  }
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 290 of file EvFDaqDirector.cc.

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

Referenced by bumpFile().

290  {
292  }
std::string inputJsonFileName(const unsigned int run, const unsigned int ls, const unsigned int index)
std::string bu_run_dir_
std::string evf::EvFDaqDirector::getJumpFilePath ( ) const
inline

Definition at line 85 of file EvFDaqDirector.h.

References bu_run_dir_, getRunNumber(), fffnaming::inputRawFileName(), jumpIndex_, and jumpLS_.

Referenced by FedRawDataInputSource::renameToNextFree().

std::string inputRawFileName(const unsigned int run, const unsigned int ls, const unsigned int index)
unsigned int jumpIndex_
std::string bu_run_dir_
unsigned int getRunNumber() const
unsigned int jumpLS_
unsigned int evf::EvFDaqDirector::getJumpIndex ( ) const
inline

Definition at line 84 of file EvFDaqDirector.h.

References jumpIndex_.

84 { return jumpIndex_; }
unsigned int jumpIndex_
unsigned int evf::EvFDaqDirector::getJumpLS ( ) const
inline

Definition at line 83 of file EvFDaqDirector.h.

References jumpLS_.

83 { return jumpLS_; }
unsigned int jumpLS_
std::string evf::EvFDaqDirector::getMergedDatFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 320 of file EvFDaqDirector.cc.

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

Referenced by maybeCreateAndLockFileHeadForStream().

320  {
322  }
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 336 of file EvFDaqDirector.cc.

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

336  {
338  }
std::string protocolBufferHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string evf::EvFDaqDirector::getMergedRootHistogramFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 348 of file EvFDaqDirector.cc.

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

348  {
350  }
std::string rootHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string evf::EvFDaqDirector::getOpenDatFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 308 of file EvFDaqDirector.cc.

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

308  {
310  }
std::string streamerDataFileNameWithPid(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 303 of file EvFDaqDirector.cc.

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

303  {
305  }
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 312 of file EvFDaqDirector.cc.

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

312  {
314  }
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 328 of file EvFDaqDirector.cc.

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

328  {
330  }
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 299 of file EvFDaqDirector.cc.

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

299  {
300  return bu_run_dir_ + "/open/" + fffnaming::inputRawFileName(run_,ls,index);
301  }
std::string inputRawFileName(const unsigned int run, const unsigned int ls, const unsigned int index)
std::string bu_run_dir_
std::string evf::EvFDaqDirector::getOpenRootHistogramFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 340 of file EvFDaqDirector.cc.

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

340  {
342  }
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 316 of file EvFDaqDirector.cc.

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

316  {
318  }
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 332 of file EvFDaqDirector.cc.

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

332  {
334  }
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 295 of file EvFDaqDirector.cc.

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

Referenced by removeFile().

295  {
297  }
std::string inputRawFileName(const unsigned int run, const unsigned int ls, const unsigned int index)
std::string bu_run_dir_
std::string evf::EvFDaqDirector::getRootHistogramFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 344 of file EvFDaqDirector.cc.

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

344  {
346  }
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 82 of file EvFDaqDirector.h.

References run_.

Referenced by getJumpFilePath().

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

Definition at line 76 of file EvFDaqDirector.h.

References run_dir_.

Referenced by createRunOpendirMaybe(), and EvFDaqDirector().

76 {return run_dir_ +"/open";}
std::vector<int>* evf::EvFDaqDirector::getStreamFileTracker ( )
inline

Definition at line 93 of file EvFDaqDirector.h.

References streamFileTracker_.

Referenced by FedRawDataInputSource::getNextEvent().

93 {return &streamFileTracker_;}
std::vector< int > streamFileTracker_
bool evf::EvFDaqDirector::getTestModeNoBuilderUnit ( )
inline

Definition at line 86 of file EvFDaqDirector.h.

References testModeNoBuilderUnit_.

86 { return testModeNoBuilderUnit_;}
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 94 of file EvFDaqDirector.h.

References nStreams_, and nThreads_.

Referenced by FedRawDataInputSource::getNextEvent().

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

Definition at line 624 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd_.

Referenced by updateFuLock().

624  {
625  //fcntl(fulocal_rwlock_fd_, F_SETLKW, &fulocal_rw_flk);
626  flock(fulocal_rwlock_fd_,LOCK_EX);
627  }
void evf::EvFDaqDirector::lockFULocal2 ( )

Definition at line 635 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd2_.

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

635  {
636  //fcntl(fulocal_rwlock_fd2_, F_SETLKW, &fulocal_rw_flk2);
637  flock(fulocal_rwlock_fd2_,LOCK_EX);
638  }
void evf::EvFDaqDirector::lockInitLock ( )

Definition at line 616 of file EvFDaqDirector.cc.

References init_lock_.

616  {
617  pthread_mutex_lock(&init_lock_);
618  }
pthread_mutex_t init_lock_
FILE * evf::EvFDaqDirector::maybeCreateAndLockFileHeadForStream ( unsigned int  ls,
std::string &  stream 
)

Definition at line 596 of file EvFDaqDirector.cc.

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

596  {
597  data_rw_stream = fopen(getMergedDatFilePath(ls,stream).c_str(), "a"); //open stream for appending
599  if (data_readwrite_fd_ == -1)
600  edm::LogError("EvFDaqDirector") << "problem with creating filedesc for datamerge "
601  << strerror(errno);
602  else
603  LogDebug("EvFDaqDirector") << "creating filedesc for datamerge -: "
605  fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_flk);
606 
607  return data_rw_stream;
608  }
#define LogDebug(id)
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 577 of file EvFDaqDirector.cc.

References fu_readwritelock_fd_, fu_rw_lock_stream, and LogDebug.

Referenced by EvFDaqDirector().

577  {
578  if (create) {
579  fu_readwritelock_fd_ = open(fulockfile.c_str(), O_RDWR | O_CREAT,
580  S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);
581  chmod(fulockfile.c_str(),0766);
582  } else {
583  fu_readwritelock_fd_ = open(fulockfile.c_str(), O_RDWR, S_IRWXU);
584  }
585  if (fu_readwritelock_fd_ == -1)
586  edm::LogError("EvFDaqDirector") << "problem with creating filedesc for fuwritelock -: " << fulockfile.c_str()
587  << " create:" << create << " error:" << strerror(errno);
588  else
589  LogDebug("EvFDaqDirector") << "creating filedesc for fureadwritelock -: "
591 
592  fu_rw_lock_stream = fdopen(fu_readwritelock_fd_, "r+");
593  }
#define LogDebug(id)
SurfaceDeformation * create(int type, const std::vector< double > &params)
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 211 of file EvFDaqDirector.cc.

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

Referenced by EvFDaqDirector().

211  {
212  close(bu_readlock_fd_);
213  close(bu_writelock_fd_);
214  if (directorBu_) {
215  std::string filename = base_dir_ + "/bu.lock";
216  removeFile(filename);
217  }
218  }
void removeFile(unsigned int ls, unsigned int index)
tuple filename
Definition: lut2db_cfg.py:20
void evf::EvFDaqDirector::preallocate ( edm::service::SystemBounds const &  bounds)

Definition at line 220 of file EvFDaqDirector.cc.

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

Referenced by EvFDaqDirector().

220  {
221 
222  for (unsigned int i=0;i<bounds.maxNumberOfStreams();i++){
223  streamFileTracker_.push_back(-1);
224  }
225  nThreads_=bounds.maxNumberOfStreams();
226  nStreams_=bounds.maxNumberOfThreads();
227  }
unsigned int nThreads_
int i
Definition: DBlmapReader.cc:9
std::vector< int > streamFileTracker_
unsigned int nStreams_
void evf::EvFDaqDirector::preBeginRun ( edm::GlobalContext const &  globalContext)

Definition at line 229 of file EvFDaqDirector.cc.

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

Referenced by EvFDaqDirector().

229  {
230 
231 // assert(run_ == id.run());
232 
233  // check if the requested run is the latest one - issue a warning if it isn't
235  edm::LogWarning("EvFDaqDirector") << "WARNING - checking run dir -: "
236  << run_dir_ << ". This is not the highest run "
238  }
239  }
std::string findHighestRunDir()
Definition: DirManager.cc:20
void evf::EvFDaqDirector::preGlobalEndLumi ( edm::GlobalContext const &  globalContext)

Definition at line 241 of file EvFDaqDirector.cc.

References cppFunctionSkipper::exception, fileDeleteLockPtr_, filesToDeletePtr_, LogDebug, python.rootplot.utilities::ls(), edm::LuminosityBlockID::luminosityBlock(), edm::GlobalContext::luminosityBlockID(), getHLTPrescaleColumns::path, and python.multivaluedict::remove().

Referenced by EvFDaqDirector().

242  {
243  //delete all files belonging to just closed lumi
244  unsigned int ls = globalContext.luminosityBlockID().luminosityBlock();
246  edm::LogWarning("EvFDaqDirector") << " Handles to check for files to delete were not set by the input source...";
247  return;
248  }
249 
250  std::unique_lock<std::mutex> lkw(*fileDeleteLockPtr_);
251  auto it = filesToDeletePtr_->begin();
252  while (it!=filesToDeletePtr_->end()) {
253  if (it->second->lumi_ == ls) {
254  const boost::filesystem::path filePath(it->second->fileName_);
255  LogDebug("EvFDaqDirector") << "Deleting input file -:" << it->second->fileName_;
256  try {
257  //rarely this fails but file gets deleted
258  boost::filesystem::remove(filePath);
259  }
260  catch (const boost::filesystem::filesystem_error& ex)
261  {
262  edm::LogError("EvFDaqDirector") << " - deleteFile BOOST FILESYSTEM ERROR CAUGHT -: " << ex.what() << ". Trying again.";
263  usleep(10000);
264  try {
265  boost::filesystem::remove(filePath);
266  }
267  catch (...) {/*file gets deleted first time but exception is still thrown*/}
268  }
269  catch (std::exception& ex)
270  {
271  edm::LogError("EvFDaqDirector") << " - deleteFile std::exception CAUGHT -: " << ex.what() << ". Trying again.";
272  usleep(10000);
273  try {
274  boost::filesystem::remove(filePath);
275  } catch (...) {/*file gets deleted first time but exception is still thrown*/}
276  }
277 
278  delete it->second;
279  it = filesToDeletePtr_->erase(it);
280  }
281  else it++;
282  }
283  }
#define LogDebug(id)
std::list< std::pair< int, InputFile * > > * filesToDeletePtr_
std::mutex * fileDeleteLockPtr_
void evf::EvFDaqDirector::preSourceEvent ( edm::StreamID const &  streamID)
inline

Definition at line 285 of file EvFDaqDirector.cc.

References currentFileIndex_, and streamFileTracker_.

Referenced by EvFDaqDirector().

285  {
287  }
std::vector< int > streamFileTracker_
void evf::EvFDaqDirector::removeFile ( unsigned int  ls,
unsigned int  index 
)

Definition at line 376 of file EvFDaqDirector.cc.

References getRawFilePath().

Referenced by postEndRun().

376  {
378  }
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 369 of file EvFDaqDirector.cc.

369  {
370  int retval = remove(filename.c_str());
371  if (retval != 0)
372  edm::LogError("EvFDaqDirector") << "Could not remove used file -: " << filename << ". error = "
373  << strerror(errno);
374  }
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 100 of file EvFDaqDirector.h.

References fileDeleteLockPtr_, and filesToDeletePtr_.

Referenced by FedRawDataInputSource::FedRawDataInputSource().

100  {
101  fileDeleteLockPtr_=fileDeleteLock;
102  filesToDeletePtr_ = filesToDelete;
103  }
std::list< std::pair< int, InputFile * > > * filesToDeletePtr_
std::mutex * fileDeleteLockPtr_
void evf::EvFDaqDirector::setFMS ( evf::FastMonitoringService fms)
inline

Definition at line 91 of file EvFDaqDirector.h.

References fms_.

Referenced by FedRawDataInputSource::FedRawDataInputSource().

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

Definition at line 562 of file EvFDaqDirector.cc.

References fu_rw_lock_stream, getHLTprescales::readIndex(), and testModeNoBuilderUnit_.

Referenced by EvFDaqDirector().

562  {
563  if (fu_rw_lock_stream == 0)
564  edm::LogError("EvFDaqDirector") << "Error creating fu read/write lock stream "
565  << strerror(errno);
566  else {
567  edm::LogInfo("EvFDaqDirector") << "Initializing FU LOCK FILE";
568  unsigned int readLs = 1, readIndex = 0, jumpLs = 3, jumpIndex = 0;
570  fprintf(fu_rw_lock_stream, "%u %u %u %u", readLs, readIndex,
571  jumpLs, jumpIndex);
572  else
573  fprintf(fu_rw_lock_stream, "%u %u", readLs, readIndex);
574  }
575  }
void evf::EvFDaqDirector::unlockAndCloseMergeStream ( )

Definition at line 610 of file EvFDaqDirector.cc.

References data_readwrite_fd_, data_rw_fulk, and data_rw_stream.

610  {
611  fflush(data_rw_stream);
612  fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_fulk);
613  fclose(data_rw_stream);
614  }
struct flock data_rw_fulk
void evf::EvFDaqDirector::unlockFULocal ( )

Definition at line 629 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd_.

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

629  {
630  //fcntl(fulocal_rwlock_fd_, F_SETLKW, &fulocal_rw_fulk);
631  flock(fulocal_rwlock_fd_,LOCK_UN);
632  }
void evf::EvFDaqDirector::unlockFULocal2 ( )

Definition at line 640 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd2_.

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

640  {
641  //fcntl(fulocal_rwlock_fd2_, F_SETLKW, &fulocal_rw_fulk2);
642  flock(fulocal_rwlock_fd2_,LOCK_UN);
643  }
void evf::EvFDaqDirector::unlockInitLock ( )

Definition at line 620 of file EvFDaqDirector.cc.

References init_lock_.

620  {
621  pthread_mutex_unlock(&init_lock_);
622  }
pthread_mutex_t init_lock_
void evf::EvFDaqDirector::updateFileIndex ( int const &  fileIndex)
inline

Definition at line 92 of file EvFDaqDirector.h.

References currentFileIndex_.

Referenced by FedRawDataInputSource::getNextEvent().

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

Definition at line 380 of file EvFDaqDirector.cc.

References bumpFile(), CastorDataFrameFilter_impl::check(), fu_readwritelock_fd_, fu_rw_flk, fu_rw_fulk, fu_rw_lock_stream, getEoRFilePath(), jumpIndex_, jumpLS_, lockFULocal(), LogDebug, newFile, noFile, getHLTprescales::readIndex(), runEnded, and testModeNoBuilderUnit_.

Referenced by FedRawDataInputSource::readSupervisor().

380  {
381  EvFDaqDirector::FileStatus fileStatus = noFile;
382 
383  int retval = -1;
384  while (retval==-1) {
385  retval = fcntl(fu_readwritelock_fd_, F_SETLK, &fu_rw_flk);
386  if (retval==-1) usleep(50000);
387  }
388  if(retval!=0) return fileStatus;
389 
390 #ifdef DEBUG
391  timeval ts_lockend;
392  gettimeofday(&ts_lockend,0);
393 #endif
394 
395  // if the stream is readable
396  if (fu_rw_lock_stream != 0) {
397  unsigned int readLs, readIndex, jumpLs, jumpIndex;
398  int check = 0;
399  // rewind the stream
400  check = fseek(fu_rw_lock_stream, 0, SEEK_SET);
401  // if rewinded ok
402  if (check == 0) {
403  // read its' values
405  fscanf(fu_rw_lock_stream, "%u %u %u %u", &readLs, &readIndex,
406  &jumpLs, &jumpIndex);
407  else
408  fscanf(fu_rw_lock_stream, "%u %u", &readLs, &readIndex);
409 
410  // try to bump
411  bool bumpedOk = bumpFile(readLs, readIndex, nextFile, fsize);
412  ls = readLs;
413  // there is a new file to grab or lumisection ended
414  if (bumpedOk) {
415  // rewind and clear
416  check = fseek(fu_rw_lock_stream, 0, SEEK_SET);
417  if (check == 0) {
418  ftruncate(fu_readwritelock_fd_, 0);
419  fflush(fu_rw_lock_stream); //this should not be needed ???
420  } else
421  edm::LogError("EvFDaqDirector") << "seek on fu read/write lock for updating failed with error "
422  << strerror(errno);
423  // write new data
424  check = fseek(fu_rw_lock_stream, 0, SEEK_SET);
425  if (check == 0) {
426  // write next index in the file, which is the file the next process should take
428  fprintf(fu_rw_lock_stream, "%u %u %u %u", readLs,
429  readIndex + 1, readLs + 2, readIndex + 1);
430  jumpLS_ = readLs + 2;
432  } else {
433  fprintf(fu_rw_lock_stream, "%u %u", readLs,
434  readIndex + 1);
435  }
436  fflush(fu_rw_lock_stream);
437  fsync(fu_readwritelock_fd_);
438 
439  fileStatus = newFile;
440 
442  edm::LogInfo("EvFDaqDirector") << "Written to file -: " << readLs << ":"
443  << readIndex + 1 << " --> " << readLs + 2
444  << ":" << readIndex + 1;
445  else
446  LogDebug("EvFDaqDirector") << "Written to file -: " << readLs << ":"
447  << readIndex + 1;
448 
449  } else
450  edm::LogError("EvFDaqDirector") << "seek on fu read/write lock for updating failed with error "
451  << strerror(errno);
452  }
453  } else
454  edm::LogError("EvFDaqDirector") << "seek on fu read/write lock for reading failed with error "
455  << strerror(errno);
456  } else
457  edm::LogError("EvFDaqDirector") << "fu read/write lock stream is invalid " << strerror(errno);
458 
459 #ifdef DEBUG
460  timeval ts_preunlock;
461  gettimeofday(&ts_preunlock,0);
462  int locked_period_int = ts_preunlock.tv_sec - ts_lockend.tv_sec;
463  double locked_period=locked_period_int+double(ts_preunlock.tv_usec - ts_lockend.tv_usec)/1000000;
464 #endif
465 
466  //if new json is present, lock file which FedRawDataInputSource will later unlock
467  if (fileStatus==newFile) lockFULocal();
468 
469  //release lock at this point
470  int retvalu=-1;
471  retvalu=fcntl(fu_readwritelock_fd_, F_SETLKW, &fu_rw_fulk);
472  if (retvalu==-1) edm::LogError("EvFDaqDirector") << "Error unlocking the fu.lock " << strerror(errno);
473 
474 #ifdef DEBUG
475  edm::LogDebug("EvFDaqDirector") << "Waited during lock -: " << locked_period << " seconds";
476 #endif
477 
478  if ( fileStatus == noFile ) {
479  struct stat buf;
480  //edm::LogInfo("EvFDaqDirector") << " looking for EoR file: " << getEoRFilePath().c_str();
481  if ( stat(getEoRFilePath().c_str(), &buf) == 0 )
482  fileStatus = runEnded;
483  }
484  return fileStatus;
485  }
#define LogDebug(id)
struct flock fu_rw_flk
std::string getEoRFilePath() const
unsigned int jumpIndex_
struct flock fu_rw_fulk
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
bool bumpFile(unsigned int &ls, unsigned int &index, std::string &nextFile, uint32_t &fsize)
unsigned int jumpLS_

Member Data Documentation

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

Definition at line 119 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), and postEndRun().

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

Definition at line 120 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector().

struct flock evf::EvFDaqDirector::bu_r_flk
private

Definition at line 150 of file EvFDaqDirector.h.

struct flock evf::EvFDaqDirector::bu_r_fulk
private

Definition at line 152 of file EvFDaqDirector.h.

FILE* evf::EvFDaqDirector::bu_r_lock_stream
private

Definition at line 138 of file EvFDaqDirector.h.

int evf::EvFDaqDirector::bu_readlock_fd_
private

Definition at line 130 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 128 of file EvFDaqDirector.h.

Referenced by buBaseRunOpenDir(), and EvFDaqDirector().

FILE* evf::EvFDaqDirector::bu_t_monitor_stream
private

Definition at line 141 of file EvFDaqDirector.h.

struct flock evf::EvFDaqDirector::bu_w_flk
private

Definition at line 149 of file EvFDaqDirector.h.

struct flock evf::EvFDaqDirector::bu_w_fulk
private

Definition at line 151 of file EvFDaqDirector.h.

FILE* evf::EvFDaqDirector::bu_w_lock_stream
private

Definition at line 137 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector().

FILE* evf::EvFDaqDirector::bu_w_monitor_stream
private

Definition at line 140 of file EvFDaqDirector.h.

int evf::EvFDaqDirector::bu_writelock_fd_
private

Definition at line 131 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), and postEndRun().

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

Definition at line 164 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 155 of file EvFDaqDirector.h.

Referenced by maybeCreateAndLockFileHeadForStream().

struct flock evf::EvFDaqDirector::data_rw_fulk
private

Definition at line 156 of file EvFDaqDirector.h.

Referenced by unlockAndCloseMergeStream().

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

Definition at line 121 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), and postEndRun().

DirManager evf::EvFDaqDirector::dirManager_
private

Definition at line 144 of file EvFDaqDirector.h.

Referenced by findCurrentRunDir(), and preBeginRun().

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

Definition at line 166 of file EvFDaqDirector.h.

Referenced by preGlobalEndLumi(), and setDeleteTracking().

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

Definition at line 167 of file EvFDaqDirector.h.

Referenced by preGlobalEndLumi(), and setDeleteTracking().

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

Definition at line 162 of file EvFDaqDirector.h.

Referenced by bumpFile(), and setFMS().

int evf::EvFDaqDirector::fu_readwritelock_fd_
private

Definition at line 132 of file EvFDaqDirector.h.

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

struct flock evf::EvFDaqDirector::fu_rw_flk
private

Definition at line 153 of file EvFDaqDirector.h.

Referenced by updateFuLock().

struct flock evf::EvFDaqDirector::fu_rw_fulk
private

Definition at line 154 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 135 of file EvFDaqDirector.h.

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

int evf::EvFDaqDirector::fulocal_rwlock_fd_
private

Definition at line 134 of file EvFDaqDirector.h.

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

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

Definition at line 169 of file EvFDaqDirector.h.

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

unsigned int evf::EvFDaqDirector::jumpIndex_
private

Definition at line 147 of file EvFDaqDirector.h.

Referenced by getJumpFilePath(), getJumpIndex(), and updateFuLock().

unsigned int evf::EvFDaqDirector::jumpLS_
private

Definition at line 147 of file EvFDaqDirector.h.

Referenced by getJumpFilePath(), getJumpLS(), and updateFuLock().

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

Definition at line 171 of file EvFDaqDirector.h.

Referenced by isSingleStreamThread(), and preallocate().

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

Definition at line 172 of file EvFDaqDirector.h.

Referenced by isSingleStreamThread(), and preallocate().

unsigned long evf::EvFDaqDirector::previousFileSize_
private

Definition at line 146 of file EvFDaqDirector.h.

Referenced by bumpFile().

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

Definition at line 125 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector().

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

Definition at line 163 of file EvFDaqDirector.h.

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

bool evf::EvFDaqDirector::testModeNoBuilderUnit_
private