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 ()
 
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 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 46 of file EvFDaqDirector.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 41 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_, emptyLumisectionMode_, Exception, fu_readwritelock_fd_, fu_rw_lock_stream, fulocal_rwlock_fd2_, fulocal_rwlock_fd_, fuLockPollInterval_, getRunOpenDirPath(), hltSourceDirectory_, hostname_, init_lock_, NULL, openFULockfileStream(), postEndRun(), preallocate(), preBeginRun(), preGlobalEndLumi(), preSourceEvent(), run_, run_dir_, run_string_, contentValuesCheck::ss, stopFilePath_, AlCaHLTBitMon_QueryRunRegistry::string, tryInitializeFuLockFile(), edm::ActivityRegistry::watchPostGlobalEndRun(), edm::ActivityRegistry::watchPreallocate(), edm::ActivityRegistry::watchPreGlobalBeginRun(), edm::ActivityRegistry::watchPreGlobalEndLumi(), and edm::ActivityRegistry::watchPreSourceEvent().

42  :
43  base_dir_(pset.getUntrackedParameter<std::string> ("baseDir", ".")),
44  bu_base_dir_(pset.getUntrackedParameter<std::string> ("buBaseDir", ".")),
45  directorBu_(pset.getUntrackedParameter<bool> ("directorIsBu", false)),
46  run_(pset.getUntrackedParameter<unsigned int> ("runNumber",0)),
47  outputAdler32Recheck_(pset.getUntrackedParameter<bool>("outputAdler32Recheck",false)),
48  requireTSPSet_(pset.getUntrackedParameter<bool>("requireTransfersPSet",false)),
49  selectedTransferMode_(pset.getUntrackedParameter<std::string>("selectedTransferMode","")),
50  hltSourceDirectory_(pset.getUntrackedParameter<std::string>("hltSourceDirectory","")),
51  fuLockPollInterval_(pset.getUntrackedParameter<unsigned int>("fuLockPollInterval",2000)),
52  emptyLumisectionMode_(pset.getUntrackedParameter<bool>("emptyLumisectionMode",false)),
53  hostname_(""),
54  bu_readlock_fd_(-1),
55  bu_writelock_fd_(-1),
60 
64  //bu_w_monitor_stream(0),
65  //bu_t_monitor_stream(0),
66  data_rw_stream(0),
67 
69 
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 
102  char * fuLockPollIntervalPtr = getenv("FFF_LOCKPOLLINTERVAL");
103  if (fuLockPollIntervalPtr) {
104  try {
105  fuLockPollInterval_=boost::lexical_cast<unsigned int>(std::string(fuLockPollIntervalPtr));
106  edm::LogInfo("Setting fu lock poll interval by environment string: ") << fuLockPollInterval_ << " us";
107  }
108  catch (...) {edm::LogWarning("Unable to parse environment string: ") << std::string(fuLockPollIntervalPtr);}
109  }
110 
111  char * emptyLumiModePtr = getenv("FFF_EMPTYLSMODE");
112  if (emptyLumiModePtr) {
113  emptyLumisectionMode_ = true;
114  edm::LogInfo("Setting empty lumisection mode");
115  }
116 
117  // check if base dir exists or create it accordingly
118  int retval = mkdir(base_dir_.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
119  if (retval != 0 && errno != EEXIST) {
120  throw cms::Exception("DaqDirector") << " Error checking for base dir -: "
121  << base_dir_ << " mkdir error:" << strerror(errno);
122  }
123 
124  //create run dir in base dir
125  umask(0);
126  retval = mkdir(run_dir_.c_str(),
127  S_IRWXU | S_IRWXG | S_IROTH | S_IRWXO | S_IXOTH);
128  if (retval != 0 && errno != EEXIST) {
129  throw cms::Exception("DaqDirector") << " Error creating run dir -: "
130  << run_dir_ << " mkdir error:" << strerror(errno);
131  }
132 
133  //create fu-local.lock in run open dir
134  if (!directorBu_) {
135 
137  std::string fulocal_lock_ = getRunOpenDirPath() +"/fu-local.lock";
138  fulocal_rwlock_fd_ = open(fulocal_lock_.c_str(), O_RDWR | O_CREAT, S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);//O_RDWR?
139  if (fulocal_rwlock_fd_==-1)
140  throw cms::Exception("DaqDirector") << " Error creating/opening a local lock file -: " << fulocal_lock_.c_str() << " : " << strerror(errno);
141  chmod(fulocal_lock_.c_str(),0777);
142  fsync(fulocal_rwlock_fd_);
143  //open second fd for another input source thread
144  fulocal_rwlock_fd2_ = open(fulocal_lock_.c_str(), O_RDWR, S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);//O_RDWR?
145  if (fulocal_rwlock_fd2_==-1)
146  throw cms::Exception("DaqDirector") << " Error opening a local lock file -: " << fulocal_lock_.c_str() << " : " << strerror(errno);
147  }
148 
149  //bu_run_dir: for FU, for which the base dir is local and the BU is remote, it is expected to be there
150  //for BU, it is created at this point
151  if (directorBu_)
152  {
154  std::string bulockfile = bu_run_dir_ + "/bu.lock";
155  std::string fulockfile = bu_run_dir_ + "/fu.lock";
156 
157  //make or find bu run dir
158  retval = mkdir(bu_run_dir_.c_str(),
159  S_IRWXU | S_IRWXG | S_IRWXO);
160  if (retval != 0 && errno != EEXIST) {
161  throw cms::Exception("DaqDirector")
162  << " Error creating bu run dir -: " << bu_run_dir_
163  << " mkdir error:" << strerror(errno) << "\n";
164  }
165  bu_run_open_dir_ = bu_run_dir_ + "/open";
166  retval = mkdir(bu_run_open_dir_.c_str(),
167  S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
168  if (retval != 0 && errno != EEXIST) {
169  throw cms::Exception("DaqDirector") << " Error creating bu run open dir -: "
170  << bu_run_open_dir_ << " mkdir error:" << strerror(errno)
171  << "\n";
172  }
173 
174  // the BU director does not need to know about the fu lock
175  bu_writelock_fd_ = open(bulockfile.c_str(),
176  O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU);
177  if (bu_writelock_fd_ == -1)
178  edm::LogWarning("EvFDaqDirector") << "problem with creating filedesc for buwritelock -: "
179  << strerror(errno);
180  else
181  edm::LogInfo("EvFDaqDirector") << "creating filedesc for buwritelock -: "
182  << bu_writelock_fd_;
183  bu_w_lock_stream = fdopen(bu_writelock_fd_, "w");
184  if (bu_w_lock_stream == 0)
185  edm::LogWarning("EvFDaqDirector")<< "Error creating write lock stream -: " << strerror(errno);
186 
187  // BU INITIALIZES LOCK FILE
188  // FU LOCK FILE OPEN
189  openFULockfileStream(fulockfile, true);
191  fflush(fu_rw_lock_stream);
192  close(fu_readwritelock_fd_);
193 
194  if (hltSourceDirectory_.size())
195  {
196  struct stat buf;
197  if (stat(hltSourceDirectory_.c_str(),&buf)==0) {
198  std::string hltdir=bu_run_dir_+"/hlt";
199  std::string tmphltdir=bu_run_open_dir_+"/hlt";
200  retval = mkdir(tmphltdir.c_str(),S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
201 
202  boost::filesystem::copy_file(hltSourceDirectory_+"/HltConfig.py",tmphltdir+"/HltConfig.py");
203  try {
204  boost::filesystem::copy_file(hltSourceDirectory_+"/CMSSW_VERSION",tmphltdir+"/CMSSW_VERSION");
205  boost::filesystem::copy_file(hltSourceDirectory_+"/SCRAM_ARCH",tmphltdir+"/SCRAM_ARCH");
206  } catch (...) {}
207 
208  boost::filesystem::copy_file(hltSourceDirectory_+"/fffParameters.jsn",tmphltdir+"/fffParameters.jsn");
209 
210  boost::filesystem::rename(tmphltdir,hltdir);
211  }
212  else
213  throw cms::Exception("DaqDirector") << " Error looking for HLT configuration -: " << hltSourceDirectory_;
214  }
215  //else{}//no configuration specified
216  }
217  else
218  {
219  // for FU, check if bu base dir exists
220 
221  retval = mkdir(bu_base_dir_.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
222  if (retval != 0 && errno != EEXIST) {
223  throw cms::Exception("DaqDirector") << " Error checking for bu base dir -: "
224  << bu_base_dir_ << " mkdir error:" << strerror(errno) << "\n";
225  }
226 
228  std::string fulockfile = bu_run_dir_ + "/fu.lock";
229  openFULockfileStream(fulockfile, false);
230  }
231 
232  pthread_mutex_init(&init_lock_,NULL);
233 
234  stopFilePath_ = run_dir_+"/CMSSW_STOP";
235  }
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_
struct flock fu_rw_fulk
std::string hltSourceDirectory_
std::string stopFilePath_
std::string bu_base_dir_
std::string selectedTransferMode_
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)
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 237 of file EvFDaqDirector.cc.

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

238  {
239  if (fulocal_rwlock_fd_!=-1) {
240  unlockFULocal();
241  close(fulocal_rwlock_fd_);
242  }
243 
244  if (fulocal_rwlock_fd2_!=-1) {
245  unlockFULocal2();
246  close(fulocal_rwlock_fd2_);
247  }
248 
249  }

Member Function Documentation

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

Definition at line 61 of file EvFDaqDirector.h.

References run_dir_.

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

Definition at line 62 of file EvFDaqDirector.h.

References bu_run_dir_.

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

Definition at line 63 of file EvFDaqDirector.h.

References bu_run_open_dir_.

63 {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 678 of file EvFDaqDirector.cc.

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

Referenced by updateFuLock().

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

Definition at line 868 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(), edm::getProcessParameterSet(), alignBH_cfg::mode, edm::ParameterSet::psetTable(), requireTSPSet_, and transferSystemJson_.

Referenced by preallocate().

869  {
870  transferSystemJson_.reset(new Json::Value);
871  if (edm::getProcessParameterSet().existsAs<edm::ParameterSet>("transferSystem",true))
872  {
873  const edm::ParameterSet& tsPset(edm::getProcessParameterSet().getParameterSet("transferSystem"));
874 
875  Json::Value destinationsVal(Json::arrayValue);
876  std::vector<std::string> destinations = tsPset.getParameter<std::vector<std::string>>("destinations");
877  for (auto & dest: destinations) destinationsVal.append(dest);
878  (*transferSystemJson_)["destinations"]=destinationsVal;
879 
880  Json::Value modesVal(Json::arrayValue);
881  std::vector<std::string> modes = tsPset.getParameter< std::vector<std::string> >("transferModes");
882  for (auto & mode: modes) modesVal.append(mode);
883  (*transferSystemJson_)["transferModes"]=modesVal;
884 
885  for (auto psKeyItr =tsPset.psetTable().begin();psKeyItr!=tsPset.psetTable().end(); ++ psKeyItr) {
886  if (psKeyItr->first!="destinations" && psKeyItr->first!="transferModes") {
887  const edm::ParameterSet & streamDef = tsPset.getParameterSet(psKeyItr->first);
888  Json::Value streamVal;
889  for (auto & mode : modes) {
890  //validation
891  if (!streamDef.existsAs<std::vector<std::string>>(mode,true))
892  throw cms::Exception("EvFDaqDirector") << " Missing transfer system specification for -:" << psKeyItr->first << " (transferMode " << mode << ")";
893  std::vector<std::string> streamDestinations = streamDef.getParameter<std::vector<std::string>>(mode);
894 
895  Json::Value sDestsValue(Json::arrayValue);
896 
897  if (!streamDestinations.size())
898  throw cms::Exception("EvFDaqDirector") << " Missing transter system destination(s) for -: "<< psKeyItr->first << ", mode:" << mode;
899 
900  for (auto & sdest:streamDestinations) {
901  bool sDestValid=false;
902  sDestsValue.append(sdest);
903  for (auto & dest: destinations) {
904  if (dest==sdest) sDestValid=true;
905  }
906  if (!sDestValid)
907  throw cms::Exception("EvFDaqDirector") << " Invalid transter system destination specified for -: "<< psKeyItr->first << ", mode:" << mode << ", dest:"<<sdest;
908  }
909  streamVal[mode]=sDestsValue;
910  }
911  (*transferSystemJson_)[psKeyItr->first] = streamVal;
912  }
913  }
914  }
915  else {
916  if (requireTSPSet_)
917  throw cms::Exception("EvFDaqDirector") << "transferSystem PSet not found";
918  }
919  }
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 & getProcessParameterSet()
Definition: Registry.cc:85
ParameterSet const & getParameterSet(std::string const &) const
tuple destinations
Definition: gather_cfg.py:120
array value (ordered list)
Definition: value.h:31
void evf::EvFDaqDirector::createProcessingNotificationMaybe ( ) const

Definition at line 968 of file EvFDaqDirector.cc.

References run_dir_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FedRawDataInputSource::checkNextEvent().

968  {
969  std::string proc_flag = run_dir_ + "/processing";
970  int proc_flag_fd = open(proc_flag.c_str(), O_RDWR | O_CREAT, S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);
971  close(proc_flag_fd);
972  }
void evf::EvFDaqDirector::createRunOpendirMaybe ( )

Definition at line 840 of file EvFDaqDirector.cc.

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

Referenced by EvFDaqDirector().

840  {
841  // create open dir if not already there
842 
844  if (!boost::filesystem::is_directory(openPath)) {
845  LogDebug("EvFDaqDirector") << "<open> FU dir not found. Creating... -:" << openPath.string();
846  boost::filesystem::create_directories(openPath);
847  }
848  }
#define LogDebug(id)
tuple path
else: Piece not in the list, fine.
std::string getRunOpenDirPath() const
bool evf::EvFDaqDirector::emptyLumisectionMode ( ) const
inline

Definition at line 117 of file EvFDaqDirector.h.

References emptyLumisectionMode_.

Referenced by FedRawDataInputSource::checkNextEvent().

117 {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 251 of file EvFDaqDirector.cc.

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

252  {
254  desc.setComment("Service used for file locking arbitration and for propagating information between other EvF components");
255  desc.addUntracked<std::string> ("baseDir", ".")->setComment("Local base directory for run output");
256  desc.addUntracked<std::string> ("buBaseDir", ".")->setComment("BU base ramdisk directory ");
257  desc.addUntracked<unsigned int> ("runNumber",0)->setComment("Run Number in ramdisk to open");
258  desc.addUntracked<bool>("outputAdler32Recheck",false)->setComment("Check Adler32 of per-process output files while micro-merging");
259  desc.addUntracked<bool>("requireTransfersPSet",false)->setComment("Require complete transferSystem PSet in the process configuration");
260  desc.addUntracked<std::string>("selectedTransferMode","")->setComment("Selected transfer mode (choice in Lvl0 propagated as Python parameter");
261  desc.addUntracked<unsigned int>("fuLockPollInterval",2000)->setComment("Lock polling interval in microseconds for the input directory file lock");
262  desc.addUntracked<bool>("emptyLumisectionMode",false)->setComment("Enables writing stream output metadata even when no events are processed in a lumisection");
263  desc.setAllowAnything();
264  descriptions.add("EvFDaqDirector", desc);
265  }
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 65 of file EvFDaqDirector.h.

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

65 { 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 425 of file EvFDaqDirector.cc.

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

Referenced by FedRawDataInputSource::createBoLSFile().

425  {
426  return run_dir_ + "/" + fffnaming::bolsFileName(run_,ls);
427  }
std::string bolsFileName(const unsigned int run, const unsigned int ls)
std::string evf::EvFDaqDirector::getEoLSFilePathOnBU ( const unsigned int  ls) const

Definition at line 417 of file EvFDaqDirector.cc.

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

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

417  {
418  return bu_run_dir_ + "/" + fffnaming::eolsFileName(run_,ls);
419  }
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 421 of file EvFDaqDirector.cc.

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

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

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

Definition at line 429 of file EvFDaqDirector.cc.

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

Referenced by updateFuLock().

429  {
430  return bu_run_dir_ + "/" + fffnaming::eorFileName(run_);
431  }
std::string eorFileName(const unsigned int run)
std::string bu_run_dir_
std::string evf::EvFDaqDirector::getEoRFilePathOnFU ( ) const

Definition at line 434 of file EvFDaqDirector.cc.

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

Referenced by FedRawDataInputSource::checkNextEvent().

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

Definition at line 389 of file EvFDaqDirector.cc.

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

Referenced by DQMFileSaver::globalBeginRun().

389  {
390  return run_dir_ + "/" + fffnaming::initFileNameWithPid(run_,0,stream);
391  }
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 348 of file EvFDaqDirector.cc.

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

Referenced by bumpFile().

348  {
350  }
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 381 of file EvFDaqDirector.cc.

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

381  {
383  }
std::string streamerDataChecksumFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string evf::EvFDaqDirector::getMergedDatFilePath ( const unsigned int  ls,
std::string const &  stream 
) const

Definition at line 377 of file EvFDaqDirector.cc.

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

Referenced by maybeCreateAndLockFileHeadForStream().

377  {
379  }
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 401 of file EvFDaqDirector.cc.

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

401  {
403  }
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 413 of file EvFDaqDirector.cc.

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

413  {
415  }
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 617 of file EvFDaqDirector.cc.

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

Referenced by bumpFile().

617  {
618 
619  boost::filesystem::ifstream ij(BUEoLSFile);
620  Json::Value deserializeRoot;
622 
623  if (!reader.parse(ij, deserializeRoot)) {
624  edm::LogError("EvFDaqDirector") << "Cannot deserialize input JSON file -:" << BUEoLSFile;
625  return -1;
626  }
627 
629  DataPoint dp;
630  dp.deserialize(deserializeRoot);
631 
632  //read definition
633  if (readEolsDefinition_) {
634  //std::string def = boost::algorithm::trim(dp.getDefinition());
636  if (!def.size()) readEolsDefinition_=false;
637  while (def.size()) {
638  std::string fullpath;
639  if (def.find('/')==0)
640  fullpath = def;
641  else
642  fullpath = bu_run_dir_+'/'+def;
643  struct stat buf;
644  if (stat(fullpath.c_str(), &buf) == 0) {
645  DataPointDefinition eolsDpd;
646  std::string defLabel = "legend";
647  DataPointDefinition::getDataPointDefinitionFor(fullpath, &eolsDpd,&defLabel);
648  if (eolsDpd.getNames().size()==0) {
649  //try with "data" label if "legend" format is not used
650  eolsDpd = DataPointDefinition();
651  defLabel="data";
652  DataPointDefinition::getDataPointDefinitionFor(fullpath, &eolsDpd,&defLabel);
653  }
654  for (unsigned int i=0;i<eolsDpd.getNames().size();i++)
655  if (eolsDpd.getNames().at(i)=="NFiles")
657  readEolsDefinition_=false;
658  break;
659  }
660  //check if we can still find definition
661  if (def.size()<=1 || def.find('/')==std::string::npos) {
662  readEolsDefinition_=false;
663  break;
664  }
665  def = def.substr(def.find('/')+1);
666  }
667  }
668 
669  if (dp.getData().size()>eolsNFilesIndex_)
670  data = dp.getData()[eolsNFilesIndex_];
671  else {
672  edm::LogError("EvFDaqDirector") << " error reading number of files from BU JSON -: " << BUEoLSFile;
673  return -1;
674  }
675  return boost::lexical_cast<int>(data);
676  }
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_
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 365 of file EvFDaqDirector.cc.

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

365  {
366  return run_dir_ + "/open/" + fffnaming::streamerDataFileNameWithPid(run_,ls,stream);
367  }
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 385 of file EvFDaqDirector.cc.

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

385  {
386  return run_dir_ + "/open/" + fffnaming::initFileNameWithPid(run_,0,stream);
387  }
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 361 of file EvFDaqDirector.cc.

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

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

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

369  {
370  return run_dir_ + "/open/" + fffnaming::streamerJsonFileNameWithPid(run_,ls,stream);
371  }
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 393 of file EvFDaqDirector.cc.

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

393  {
395  }
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 357 of file EvFDaqDirector.cc.

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

357  {
358  return bu_run_dir_ + "/open/" + fffnaming::inputRawFileName(run_,ls,index);
359  }
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 405 of file EvFDaqDirector.cc.

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

405  {
406  return run_dir_ + "/open/" + fffnaming::rootHistogramFileNameWithPid(run_,ls,stream);
407  }
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 373 of file EvFDaqDirector.cc.

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

373  {
375  }
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 397 of file EvFDaqDirector.cc.

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

397  {
399  }
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 353 of file EvFDaqDirector.cc.

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

Referenced by removeFile().

353  {
355  }
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 409 of file EvFDaqDirector.cc.

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

409  {
411  }
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 95 of file EvFDaqDirector.h.

References run_.

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

Definition at line 88 of file EvFDaqDirector.h.

References run_dir_.

Referenced by createRunOpendirMaybe(), and EvFDaqDirector().

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

Definition at line 921 of file EvFDaqDirector.cc.

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

922  {
923  std::string streamRequestName;
924  if (transferSystemJson_->isMember(stream.c_str()))
925  streamRequestName = stream;
926  else {
927  std::stringstream msg;
928  msg << "Transfer system mode definitions missing for -: " << stream;
929  if (requireTSPSet_)
930  throw cms::Exception("EvFDaqDirector") << msg.str();
931  else {
932  edm::LogWarning("EvFDaqDirector") << msg.str() << " (permissive mode)";
933  return std::string("Failsafe");
934  }
935  }
936  //return empty if strict check parameter is not on
938  edm::LogWarning("EvFDaqDirector") << "Selected mode string is not provided as DaqDirector parameter."
939  << "Switch on requireTSPSet parameter to enforce this requirement. Setting mode to empty string.";
940  return std::string("Failsafe");
941  }
943  throw cms::Exception("EvFDaqDirector") << "Selected mode string is not provided as DaqDirector parameter.";
944  }
945  //check if stream has properly listed transfer stream
946  if (!transferSystemJson_->get(streamRequestName, "").isMember(selectedTransferMode_.c_str()))
947  {
948  std::stringstream msg;
949  msg << "Selected transfer mode " << selectedTransferMode_ << " is not specified for stream " << streamRequestName;
950  if (requireTSPSet_)
951  throw cms::Exception("EvFDaqDirector") << msg.str();
952  else
953  edm::LogWarning("EvFDaqDirector") << msg.str() << " (permissive mode)";
954  return std::string("Failsafe");
955  }
956  Json::Value destsVec = transferSystemJson_->get(streamRequestName, "").get(selectedTransferMode_,"");
957 
958  //flatten string json::Array into CSV std::string
960  for (Json::Value::iterator it = destsVec.begin(); it!=destsVec.end(); it++)
961  {
962  if (ret!="") ret +=",";
963  ret+=(*it).asString();
964  }
965  return ret;
966  }
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 102 of file EvFDaqDirector.h.

References streamFileTracker_.

Referenced by FedRawDataInputSource::getNextEvent().

102 {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 103 of file EvFDaqDirector.h.

References nStreams_, and nThreads_.

Referenced by FedRawDataInputSource::getNextEvent().

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

Definition at line 818 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd_.

Referenced by updateFuLock().

818  {
819  //fcntl(fulocal_rwlock_fd_, F_SETLKW, &fulocal_rw_flk);
820  flock(fulocal_rwlock_fd_,LOCK_SH);
821  }
void evf::EvFDaqDirector::lockFULocal2 ( )

Definition at line 829 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd2_.

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

829  {
830  //fcntl(fulocal_rwlock_fd2_, F_SETLKW, &fulocal_rw_flk2);
831  flock(fulocal_rwlock_fd2_,LOCK_EX);
832  }
void evf::EvFDaqDirector::lockInitLock ( )

Definition at line 810 of file EvFDaqDirector.cc.

References init_lock_.

810  {
811  pthread_mutex_lock(&init_lock_);
812  }
pthread_mutex_t init_lock_
FILE * evf::EvFDaqDirector::maybeCreateAndLockFileHeadForStream ( unsigned int  ls,
std::string &  stream 
)

Definition at line 790 of file EvFDaqDirector.cc.

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

790  {
791  data_rw_stream = fopen(getMergedDatFilePath(ls,stream).c_str(), "a"); //open stream for appending
793  if (data_readwrite_fd_ == -1)
794  edm::LogError("EvFDaqDirector") << "problem with creating filedesc for datamerge "
795  << strerror(errno);
796  else
797  LogDebug("EvFDaqDirector") << "creating filedesc for datamerge -: "
799  fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_flk);
800 
801  return data_rw_stream;
802  }
#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 771 of file EvFDaqDirector.cc.

References fu_readwritelock_fd_, fu_rw_lock_stream, and LogDebug.

Referenced by EvFDaqDirector().

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

Definition at line 89 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 267 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().

267  {
268  close(bu_readlock_fd_);
269  close(bu_writelock_fd_);
270  if (directorBu_) {
271  std::string filename = bu_run_dir_ + "/bu.lock";
272  removeFile(filename);
273  }
274  }
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 276 of file EvFDaqDirector.cc.

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

Referenced by EvFDaqDirector().

276  {
277 
278  for (unsigned int i=0;i<bounds.maxNumberOfStreams();i++){
279  streamFileTracker_.push_back(-1);
280  }
281  nThreads_=bounds.maxNumberOfStreams();
282  nStreams_=bounds.maxNumberOfThreads();
283 
285  }
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 287 of file EvFDaqDirector.cc.

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

Referenced by EvFDaqDirector().

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

Definition at line 299 of file EvFDaqDirector.cc.

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

Referenced by EvFDaqDirector().

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

Definition at line 343 of file EvFDaqDirector.cc.

References currentFileIndex_, and streamFileTracker_.

Referenced by EvFDaqDirector().

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

Definition at line 851 of file EvFDaqDirector.cc.

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

Referenced by updateFuLock().

851  {
852 
853  boost::filesystem::ifstream ij(file);
854  Json::Value deserializeRoot;
856 
857  if (!reader.parse(ij, deserializeRoot)) {
858  edm::LogError("EvFDaqDirector") << "Cannot deserialize input JSON file -:" << file;
859  return -1;
860  }
861 
862  int ret = deserializeRoot.get("lastLS","").asInt();
863  return ret;
864 
865  }
Value get(UInt index, const Value &defaultValue) const
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 445 of file EvFDaqDirector.cc.

References getRawFilePath().

Referenced by postEndRun().

445  {
447  }
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 438 of file EvFDaqDirector.cc.

438  {
439  int retval = remove(filename.c_str());
440  if (retval != 0)
441  edm::LogError("EvFDaqDirector") << "Could not remove used file -: " << filename << ". error = "
442  << strerror(errno);
443  }
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 111 of file EvFDaqDirector.h.

References fileDeleteLockPtr_, and filesToDeletePtr_.

Referenced by FedRawDataInputSource::FedRawDataInputSource().

111  {
112  fileDeleteLockPtr_=fileDeleteLock;
113  filesToDeletePtr_ = filesToDelete;
114  }
std::list< std::pair< int, InputFile * > > * filesToDeletePtr_
std::mutex * fileDeleteLockPtr_
void evf::EvFDaqDirector::setFMS ( evf::FastMonitoringService fms)
inline

Definition at line 100 of file EvFDaqDirector.h.

References fms_.

Referenced by FedRawDataInputSource::FedRawDataInputSource().

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

Definition at line 760 of file EvFDaqDirector.cc.

References fu_rw_lock_stream, and getHLTprescales::readIndex().

Referenced by EvFDaqDirector().

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

Definition at line 804 of file EvFDaqDirector.cc.

References data_readwrite_fd_, data_rw_fulk, and data_rw_stream.

804  {
805  fflush(data_rw_stream);
806  fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_fulk);
807  fclose(data_rw_stream);
808  }
struct flock data_rw_fulk
void evf::EvFDaqDirector::unlockFULocal ( )

Definition at line 823 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd_.

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

823  {
824  //fcntl(fulocal_rwlock_fd_, F_SETLKW, &fulocal_rw_fulk);
825  flock(fulocal_rwlock_fd_,LOCK_UN);
826  }
void evf::EvFDaqDirector::unlockFULocal2 ( )

Definition at line 834 of file EvFDaqDirector.cc.

References fulocal_rwlock_fd2_.

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

834  {
835  //fcntl(fulocal_rwlock_fd2_, F_SETLKW, &fulocal_rw_fulk2);
836  flock(fulocal_rwlock_fd2_,LOCK_UN);
837  }
void evf::EvFDaqDirector::unlockInitLock ( )

Definition at line 814 of file EvFDaqDirector.cc.

References init_lock_.

814  {
815  pthread_mutex_unlock(&init_lock_);
816  }
pthread_mutex_t init_lock_
void evf::EvFDaqDirector::updateFileIndex ( int const &  fileIndex)
inline

Definition at line 101 of file EvFDaqDirector.h.

References currentFileIndex_.

Referenced by FedRawDataInputSource::getNextEvent().

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

Definition at line 449 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, python.rootplot.utilities::ls(), newFile, noFile, getHLTprescales::readIndex(), readLastLSEntry(), runEnded, and stopFilePath_.

Referenced by FedRawDataInputSource::readSupervisor().

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

Referenced by EvFDaqDirector().

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

Definition at line 134 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector().

struct flock evf::EvFDaqDirector::bu_r_flk
private

Definition at line 169 of file EvFDaqDirector.h.

struct flock evf::EvFDaqDirector::bu_r_fulk
private

Definition at line 171 of file EvFDaqDirector.h.

FILE* evf::EvFDaqDirector::bu_r_lock_stream
private

Definition at line 158 of file EvFDaqDirector.h.

int evf::EvFDaqDirector::bu_readlock_fd_
private

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

Referenced by buBaseRunOpenDir(), and EvFDaqDirector().

FILE* evf::EvFDaqDirector::bu_t_monitor_stream
private

Definition at line 161 of file EvFDaqDirector.h.

struct flock evf::EvFDaqDirector::bu_w_flk
private

Definition at line 168 of file EvFDaqDirector.h.

struct flock evf::EvFDaqDirector::bu_w_fulk
private

Definition at line 170 of file EvFDaqDirector.h.

FILE* evf::EvFDaqDirector::bu_w_lock_stream
private

Definition at line 157 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector().

FILE* evf::EvFDaqDirector::bu_w_monitor_stream
private

Definition at line 160 of file EvFDaqDirector.h.

int evf::EvFDaqDirector::bu_writelock_fd_
private

Definition at line 151 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), and postEndRun().

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

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

Referenced by maybeCreateAndLockFileHeadForStream().

struct flock evf::EvFDaqDirector::data_rw_fulk
private

Definition at line 175 of file EvFDaqDirector.h.

Referenced by unlockAndCloseMergeStream().

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

Definition at line 135 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), and postEndRun().

DirManager evf::EvFDaqDirector::dirManager_
private

Definition at line 164 of file EvFDaqDirector.h.

Referenced by findCurrentRunDir(), and preBeginRun().

bool evf::EvFDaqDirector::emptyLumisectionMode_
private

Definition at line 142 of file EvFDaqDirector.h.

Referenced by emptyLumisectionMode(), and EvFDaqDirector().

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

Definition at line 194 of file EvFDaqDirector.h.

Referenced by getNFilesFromEoLS().

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

Definition at line 185 of file EvFDaqDirector.h.

Referenced by preGlobalEndLumi(), and setDeleteTracking().

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

Definition at line 186 of file EvFDaqDirector.h.

Referenced by preGlobalEndLumi(), and setDeleteTracking().

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

Definition at line 181 of file EvFDaqDirector.h.

Referenced by bumpFile(), and setFMS().

int evf::EvFDaqDirector::fu_readwritelock_fd_
private

Definition at line 152 of file EvFDaqDirector.h.

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

struct flock evf::EvFDaqDirector::fu_rw_flk
private

Definition at line 172 of file EvFDaqDirector.h.

Referenced by updateFuLock().

struct flock evf::EvFDaqDirector::fu_rw_fulk
private

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

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

int evf::EvFDaqDirector::fulocal_rwlock_fd_
private

Definition at line 154 of file EvFDaqDirector.h.

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

unsigned int evf::EvFDaqDirector::fuLockPollInterval_
private

Definition at line 141 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), and updateFuLock().

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

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

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

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

Definition at line 190 of file EvFDaqDirector.h.

Referenced by isSingleStreamThread(), and preallocate().

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

Definition at line 191 of file EvFDaqDirector.h.

Referenced by isSingleStreamThread(), and preallocate().

bool evf::EvFDaqDirector::outputAdler32Recheck_
private

Definition at line 137 of file EvFDaqDirector.h.

Referenced by outputAdler32Recheck().

unsigned long evf::EvFDaqDirector::previousFileSize_
private

Definition at line 166 of file EvFDaqDirector.h.

Referenced by bumpFile().

bool evf::EvFDaqDirector::readEolsDefinition_ = true
private

Definition at line 193 of file EvFDaqDirector.h.

Referenced by getNFilesFromEoLS().

bool evf::EvFDaqDirector::requireTSPSet_
private

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

Referenced by EvFDaqDirector().

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

Definition at line 139 of file EvFDaqDirector.h.

Referenced by getStreamDestinations().

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

Definition at line 195 of file EvFDaqDirector.h.

Referenced by EvFDaqDirector(), and updateFuLock().

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

Definition at line 182 of file EvFDaqDirector.h.

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

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

Definition at line 197 of file EvFDaqDirector.h.

Referenced by checkTransferSystemPSet(), and getStreamDestinations().