CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EvFDaqDirector.cc
Go to the documentation of this file.
7 
11 
12 
13 #include <iostream>
14 #include <sstream>
15 #include <sys/time.h>
16 #include <unistd.h>
17 #include <stdio.h>
18 #include <sys/file.h>
19 
20 //#define DEBUG
21 
22 namespace evf {
23 
24  namespace {
25  struct flock make_flock(short type, short whence, off_t start, off_t len, pid_t pid)
26  {
27 #ifdef __APPLE__
28  return {start, len, pid, type, whence};
29 #else
30  return {type, whence, start, len, pid};
31 #endif
32  }
33  }
34 
36  edm::ActivityRegistry& reg) :
37  testModeNoBuilderUnit_(
38  pset.getUntrackedParameter<bool> ("testModeNoBuilderUnit",
39  false)
40  ),
41  base_dir_(
42  pset.getUntrackedParameter<std::string> ("baseDir", "/data")
43  ),
44  bu_base_dir_(
45  pset.getUntrackedParameter<std::string> ("buBaseDir", "/data")
46  ),
47  directorBu_(
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),
54  fu_readwritelock_fd_(-1),
55  data_readwrite_fd_(-1),
56  fulocal_rwlock_fd_(-1),
57  fulocal_rwlock_fd2_(-1),
58 
59  bu_w_lock_stream(0),
60  bu_r_lock_stream(0),
61  fu_rw_lock_stream(0),
62  //bu_w_monitor_stream(0),
63  //bu_t_monitor_stream(0),
64  data_rw_stream(0),
65 
66  dirManager_(base_dir_),
67 
68  previousFileSize_(0),
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  }
196 
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  }
210 
211  void EvFDaqDirector::postEndRun(edm::GlobalContext const& globalContext) {
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  }
219 
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  }
228 
229  void EvFDaqDirector::preBeginRun(edm::GlobalContext const& globalContext) {
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  }
240 
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  }
284 
285  inline void EvFDaqDirector::preSourceEvent(edm::StreamID const& streamID) {
287  }
288 
289 
290  std::string EvFDaqDirector::getInputJsonFilePath(const unsigned int ls, const unsigned int index) const {
291  return bu_run_dir_ + "/" + fffnaming::inputJsonFileName(run_,ls,index);
292  }
293 
294 
295  std::string EvFDaqDirector::getRawFilePath(const unsigned int ls, const unsigned int index) const {
296  return bu_run_dir_ + "/" + fffnaming::inputRawFileName(run_,ls,index);
297  }
298 
299  std::string EvFDaqDirector::getOpenRawFilePath(const unsigned int ls, const unsigned int index) const {
300  return bu_run_dir_ + "/open/" + fffnaming::inputRawFileName(run_,ls,index);
301  }
302 
303  std::string EvFDaqDirector::getOpenInputJsonFilePath(const unsigned int ls, const unsigned int index) const {
304  return bu_run_dir_ + "/open/" + fffnaming::inputJsonFileName(run_,ls,index);
305  }
306 
307 
309  return run_dir_ + "/open/" + fffnaming::streamerDataFileNameWithPid(run_,ls,stream);
310  }
311 
313  return run_dir_ + "/open/" + fffnaming::streamerJsonFileNameWithPid(run_,ls,stream);
314  }
315 
317  return run_dir_ + "/" + fffnaming::streamerJsonFileNameWithPid(run_,ls,stream);
318  }
319 
322  }
323 
325  return run_dir_ + "/" + fffnaming::initFileNameWithPid(run_,0,stream);
326  }
327 
329  return run_dir_ + "/open/" + fffnaming::protocolBufferHistogramFileNameWithPid(run_,ls,stream);
330  }
331 
334  }
335 
338  }
339 
341  return run_dir_ + "/open/" + fffnaming::rootHistogramFileNameWithPid(run_,ls,stream);
342  }
343 
345  return run_dir_ + "/" + fffnaming::rootHistogramFileNameWithPid(run_,ls,stream);
346  }
347 
350  }
351 
353  return bu_run_dir_ + "/" + fffnaming::eolsFileName(run_,ls);
354  }
355 
357  return run_dir_ + "/" + fffnaming::eolsFileName(run_,ls);
358  }
359 
361  return bu_run_dir_ + "/" + fffnaming::eorFileName(run_);
362  }
363 
364 
366  return run_dir_ + "/" + fffnaming::eorFileName(run_);
367  }
368 
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  }
375 
376  void EvFDaqDirector::removeFile(unsigned int ls, unsigned int index) {
377  removeFile(getRawFilePath(ls,index));
378  }
379 
380  EvFDaqDirector::FileStatus EvFDaqDirector::updateFuLock(unsigned int& ls, std::string& nextFile, uint32_t& fsize) {
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  }
486 
487 
488  bool EvFDaqDirector::bumpFile(unsigned int& ls, unsigned int& index, std::string& nextFile, uint32_t& fsize) {
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  }
561 
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  }
576 
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  }
594 
595  //create if does not exist then lock the merge destination file
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  }
609 
611  fflush(data_rw_stream);
612  fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_fulk);
613  fclose(data_rw_stream);
614  }
615 
617  pthread_mutex_lock(&init_lock_);
618  }
619 
621  pthread_mutex_unlock(&init_lock_);
622  }
623 
625  //fcntl(fulocal_rwlock_fd_, F_SETLKW, &fulocal_rw_flk);
626  flock(fulocal_rwlock_fd_,LOCK_EX);
627  }
628 
630  //fcntl(fulocal_rwlock_fd_, F_SETLKW, &fulocal_rw_fulk);
631  flock(fulocal_rwlock_fd_,LOCK_UN);
632  }
633 
634 
636  //fcntl(fulocal_rwlock_fd2_, F_SETLKW, &fulocal_rw_flk2);
637  flock(fulocal_rwlock_fd2_,LOCK_EX);
638  }
639 
641  //fcntl(fulocal_rwlock_fd2_, F_SETLKW, &fulocal_rw_fulk2);
642  flock(fulocal_rwlock_fd2_,LOCK_UN);
643  }
644 
645 
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  }
655 
656 }
#define LogDebug(id)
unsigned int nThreads_
type
Definition: HCALResponse.h:21
unsigned int maxNumberOfThreads() const
Definition: SystemBounds.h:46
int i
Definition: DBlmapReader.cc:9
struct flock fu_rw_flk
std::string run_string_
std::string protocolBufferHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
std::string getMergedProtocolBufferHistogramFilePath(const unsigned int ls, std::string const &stream) const
void watchPreallocate(Preallocate::slot_type const &iSlot)
std::vector< int > streamFileTracker_
std::list< std::pair< int, InputFile * > > * filesToDeletePtr_
void openFULockfileStream(std::string &fuLockFilePath, bool create)
void accumulateFileSize(unsigned int lumi, unsigned long fileSize)
void watchPreGlobalEndLumi(PreGlobalEndLumi::slot_type const &iSlot)
std::string getInitFilePath(std::string const &stream) const
std::string getMergedRootHistogramFilePath(const unsigned int ls, std::string const &stream) const
std::string inputRawFileName(const unsigned int run, const unsigned int ls, const unsigned int index)
pthread_mutex_t init_lock_
LuminosityBlockID const & luminosityBlockID() const
Definition: GlobalContext.h:52
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 getOpenRawFilePath(const unsigned int ls, const unsigned int index) const
#define NULL
Definition: scimark2.h:8
struct flock data_rw_flk
std::string getEoLSFilePathOnBU(const unsigned int ls) const
std::string getEoRFilePath() const
unsigned long previousFileSize_
unsigned int jumpIndex_
FileStatus updateFuLock(unsigned int &ls, std::string &nextFile, uint32_t &fsize)
struct flock fu_rw_fulk
unsigned int maxNumberOfStreams() const
Definition: SystemBounds.h:43
std::string getOpenProtocolBufferHistogramFilePath(const unsigned int ls, std::string const &stream) const
std::mutex * fileDeleteLockPtr_
std::string streamerDataFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
EvFDaqDirector(const edm::ParameterSet &pset, edm::ActivityRegistry &reg)
std::string getMergedDatFilePath(const unsigned int ls, std::string const &stream) const
std::string getOpenOutputJsonFilePath(const unsigned int ls, std::string const &stream) const
std::string getOpenRootHistogramFilePath(const unsigned int ls, std::string const &stream) const
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
std::string getRootHistogramFilePath(const unsigned int ls, std::string const &stream) const
std::string getOpenDatFilePath(const unsigned int ls, std::string const &stream) const
std::string inputJsonFileName(const unsigned int run, const unsigned int ls, const unsigned int index)
FILE * maybeCreateAndLockFileHeadForStream(unsigned int ls, std::string &stream)
std::string bu_base_dir_
void removeFile(unsigned int ls, unsigned int index)
std::string streamerJsonFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string getOpenInputJsonFilePath(const unsigned int ls, const unsigned int index) const
std::string eorFileName(const unsigned int run)
void watchPreGlobalBeginRun(PreGlobalBeginRun::slot_type const &iSlot)
std::string getOutputJsonFilePath(const unsigned int ls, std::string const &stream) const
bool bumpFile(unsigned int &ls, unsigned int &index, std::string &nextFile, uint32_t &fsize)
void preBeginRun(edm::GlobalContext const &globalContext)
std::string rootHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
void preSourceEvent(edm::StreamID const &streamID)
std::string initFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
void preGlobalEndLumi(edm::GlobalContext const &globalContext)
tuple pid
Definition: sysUtil.py:22
void watchPostGlobalEndRun(PostGlobalEndRun::slot_type const &iSlot)
LuminosityBlockNumber_t luminosityBlock() const
evf::FastMonitoringService * fms_
std::string bu_run_dir_
std::string rootHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string findHighestRunDir()
Definition: DirManager.cc:20
void postEndRun(edm::GlobalContext const &globalContext)
tuple filename
Definition: lut2db_cfg.py:20
unsigned int jumpLS_
std::string getEoLSFilePathOnFU(const unsigned int ls) const
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
volatile std::atomic< bool > shutdown_flag false
void preallocate(edm::service::SystemBounds const &bounds)
struct flock data_rw_fulk
std::string getInputJsonFilePath(const unsigned int ls, const unsigned int index) const
std::string getRunOpenDirPath() const
std::string protocolBufferHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
SurfaceDeformation * create(int type, const std::vector< double > &params)
std::string eolsFileName(const unsigned int run, const unsigned int ls)
unsigned int nStreams_
std::string streamerDataFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string getEoRFilePathOnFU() const
std::string bu_run_open_dir_