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.
10 
16 
17 #include <iostream>
18 #include <sstream>
19 #include <sys/time.h>
20 #include <unistd.h>
21 #include <stdio.h>
22 #include <sys/file.h>
23 #include <boost/lexical_cast.hpp>
24 #include <boost/filesystem/fstream.hpp>
25 
26 //#define DEBUG
27 
28 using namespace jsoncollector;
29 
30 
31 namespace evf {
32 
33  //for enum MergeType
34  const std::vector<std::string> EvFDaqDirector::MergeTypeNames_ = {"","DAT","PB","JSNDATA"};
35 
36  namespace {
37  struct flock make_flock(short type, short whence, off_t start, off_t len, pid_t pid)
38  {
39 #ifdef __APPLE__
40  return {start, len, pid, type, whence};
41 #else
42  return {type, whence, start, len, pid};
43 #endif
44  }
45  }
46 
47  EvFDaqDirector::EvFDaqDirector(const edm::ParameterSet &pset,
48  edm::ActivityRegistry& reg) :
49  base_dir_(pset.getUntrackedParameter<std::string> ("baseDir", ".")),
50  bu_base_dir_(pset.getUntrackedParameter<std::string> ("buBaseDir", ".")),
51  directorBu_(pset.getUntrackedParameter<bool> ("directorIsBu", false)),
52  run_(pset.getUntrackedParameter<unsigned int> ("runNumber",0)),
53  outputAdler32Recheck_(pset.getUntrackedParameter<bool>("outputAdler32Recheck",false)),
54  requireTSPSet_(pset.getUntrackedParameter<bool>("requireTransfersPSet",false)),
55  selectedTransferMode_(pset.getUntrackedParameter<std::string>("selectedTransferMode","")),
56  hltSourceDirectory_(pset.getUntrackedParameter<std::string>("hltSourceDirectory","")),
57  fuLockPollInterval_(pset.getUntrackedParameter<unsigned int>("fuLockPollInterval",2000)),
58  emptyLumisectionMode_(pset.getUntrackedParameter<bool>("emptyLumisectionMode",true)),
59  microMergeDisabled_(pset.getUntrackedParameter<bool>("microMergeDisabled",true)),
60  mergeTypePset_(pset.getUntrackedParameter<std::string>("mergeTypePset","")),
61  hostname_(""),
62  bu_readlock_fd_(-1),
63  bu_writelock_fd_(-1),
64  fu_readwritelock_fd_(-1),
65  data_readwrite_fd_(-1),
66  fulocal_rwlock_fd_(-1),
67  fulocal_rwlock_fd2_(-1),
68 
69  bu_w_lock_stream(0),
70  bu_r_lock_stream(0),
71  fu_rw_lock_stream(0),
72  //bu_w_monitor_stream(0),
73  //bu_t_monitor_stream(0),
74  data_rw_stream(0),
75 
76  dirManager_(base_dir_),
77 
78  previousFileSize_(0),
79 
80  bu_w_flk( make_flock( F_WRLCK, SEEK_SET, 0, 0, 0 )),
81  bu_r_flk( make_flock( F_RDLCK, SEEK_SET, 0, 0, 0 )),
82  bu_w_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, 0 )),
83  bu_r_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, 0 )),
84  fu_rw_flk( make_flock ( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
85  fu_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() )),
86  data_rw_flk( make_flock ( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
87  data_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() ))
88  //fulocal_rw_flk( make_flock( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
89  //fulocal_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() )),
90  //fulocal_rw_flk2( make_flock( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
91  //fulocal_rw_fulk2( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() ))
92  {
93 
100 
101  //save hostname for later
102  char hostname[33];
103  gethostname(hostname,32);
104  hostname_ = hostname;
105 
106  char * fuLockPollIntervalPtr = getenv("FFF_LOCKPOLLINTERVAL");
107  if (fuLockPollIntervalPtr) {
108  try {
109  fuLockPollInterval_=boost::lexical_cast<unsigned int>(std::string(fuLockPollIntervalPtr));
110  edm::LogInfo("EvFDaqDirector") << "Setting fu lock poll interval by environment string: " << fuLockPollInterval_ << " us";
111  }
112  catch( boost::bad_lexical_cast const& ) {
113  edm::LogWarning("EvFDaqDirector") << "Bad lexical cast in parsing: " << std::string(fuLockPollIntervalPtr);
114  }
115  }
116 
117  char * emptyLumiModePtr = getenv("FFF_EMPTYLSMODE");
118  if (emptyLumiModePtr) {
119  emptyLumisectionMode_ = true;
120  edm::LogInfo("EvFDaqDirector") << "Setting empty lumisection mode";
121  }
122 
123  char * microMergeDisabledPtr = getenv("FFF_MICROMERGEDISABLED");
124  if (microMergeDisabledPtr) {
125  microMergeDisabled_ = true;
126  edm::LogInfo("EvFDaqDirector") << "Disabling dat file micro-merge by the HLT process (delegated to the hlt daemon)";
127  }
128  }
129 
131  {
132  std::stringstream ss;
133  ss << "run" << std::setfill('0') << std::setw(6) << run_;
134  run_string_ = ss.str();
136 
137  // check if base dir exists or create it accordingly
138  int retval = mkdir(base_dir_.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
139  if (retval != 0 && errno != EEXIST) {
140  throw cms::Exception("DaqDirector") << " Error checking for base dir -: "
141  << base_dir_ << " mkdir error:" << strerror(errno);
142  }
143 
144  //create run dir in base dir
145  umask(0);
146  retval = mkdir(run_dir_.c_str(),
147  S_IRWXU | S_IRWXG | S_IROTH | S_IRWXO | S_IXOTH);
148  if (retval != 0 && errno != EEXIST) {
149  throw cms::Exception("DaqDirector") << " Error creating run dir -: "
150  << run_dir_ << " mkdir error:" << strerror(errno);
151  }
152 
153  //create fu-local.lock in run open dir
154  if (!directorBu_) {
155 
157  std::string fulocal_lock_ = getRunOpenDirPath() +"/fu-local.lock";
158  fulocal_rwlock_fd_ = open(fulocal_lock_.c_str(), O_RDWR | O_CREAT, S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);//O_RDWR?
159  if (fulocal_rwlock_fd_==-1)
160  throw cms::Exception("DaqDirector") << " Error creating/opening a local lock file -: " << fulocal_lock_.c_str() << " : " << strerror(errno);
161  chmod(fulocal_lock_.c_str(),0777);
162  fsync(fulocal_rwlock_fd_);
163  //open second fd for another input source thread
164  fulocal_rwlock_fd2_ = open(fulocal_lock_.c_str(), O_RDWR, S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);//O_RDWR?
165  if (fulocal_rwlock_fd2_==-1)
166  throw cms::Exception("DaqDirector") << " Error opening a local lock file -: " << fulocal_lock_.c_str() << " : " << strerror(errno);
167  }
168 
169  //bu_run_dir: for FU, for which the base dir is local and the BU is remote, it is expected to be there
170  //for BU, it is created at this point
171  if (directorBu_)
172  {
174  std::string bulockfile = bu_run_dir_ + "/bu.lock";
175  std::string fulockfile = bu_run_dir_ + "/fu.lock";
176 
177  //make or find bu run dir
178  retval = mkdir(bu_run_dir_.c_str(),
179  S_IRWXU | S_IRWXG | S_IRWXO);
180  if (retval != 0 && errno != EEXIST) {
181  throw cms::Exception("DaqDirector")
182  << " Error creating bu run dir -: " << bu_run_dir_
183  << " mkdir error:" << strerror(errno) << "\n";
184  }
185  bu_run_open_dir_ = bu_run_dir_ + "/open";
186  retval = mkdir(bu_run_open_dir_.c_str(),
187  S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
188  if (retval != 0 && errno != EEXIST) {
189  throw cms::Exception("DaqDirector") << " Error creating bu run open dir -: "
190  << bu_run_open_dir_ << " mkdir error:" << strerror(errno)
191  << "\n";
192  }
193 
194  // the BU director does not need to know about the fu lock
195  bu_writelock_fd_ = open(bulockfile.c_str(),
196  O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU);
197  if (bu_writelock_fd_ == -1)
198  edm::LogWarning("EvFDaqDirector") << "problem with creating filedesc for buwritelock -: "
199  << strerror(errno);
200  else
201  edm::LogInfo("EvFDaqDirector") << "creating filedesc for buwritelock -: "
202  << bu_writelock_fd_;
203  bu_w_lock_stream = fdopen(bu_writelock_fd_, "w");
204  if (bu_w_lock_stream == 0)
205  edm::LogWarning("EvFDaqDirector")<< "Error creating write lock stream -: " << strerror(errno);
206 
207  // BU INITIALIZES LOCK FILE
208  // FU LOCK FILE OPEN
209  openFULockfileStream(fulockfile, true);
211  fflush(fu_rw_lock_stream);
212  close(fu_readwritelock_fd_);
213 
214  if (hltSourceDirectory_.size())
215  {
216  struct stat buf;
217  if (stat(hltSourceDirectory_.c_str(),&buf)==0) {
218  std::string hltdir=bu_run_dir_+"/hlt";
219  std::string tmphltdir=bu_run_open_dir_+"/hlt";
220  retval = mkdir(tmphltdir.c_str(),S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
221  if (retval != 0 && errno != EEXIST)
222  throw cms::Exception("DaqDirector")
223  << " Error creating bu run dir -: " << hltdir
224  << " mkdir error:" << strerror(errno) << "\n";
225 
226  boost::filesystem::copy_file(hltSourceDirectory_+"/HltConfig.py",tmphltdir+"/HltConfig.py");
227 
228  boost::filesystem::copy_file(hltSourceDirectory_+"/fffParameters.jsn",tmphltdir+"/fffParameters.jsn");
229 
230  boost::filesystem::rename(tmphltdir,hltdir);
231  }
232  else
233  throw cms::Exception("DaqDirector") << " Error looking for HLT configuration -: " << hltSourceDirectory_;
234  }
235  //else{}//no configuration specified
236  }
237  else
238  {
239  // for FU, check if bu base dir exists
240 
241  retval = mkdir(bu_base_dir_.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
242  if (retval != 0 && errno != EEXIST) {
243  throw cms::Exception("DaqDirector") << " Error checking for bu base dir -: "
244  << bu_base_dir_ << " mkdir error:" << strerror(errno) << "\n";
245  }
246 
248  std::string fulockfile = bu_run_dir_ + "/fu.lock";
249  openFULockfileStream(fulockfile, false);
250  }
251 
252  pthread_mutex_init(&init_lock_,NULL);
253 
254  stopFilePath_ = run_dir_+"/CMSSW_STOP";
255  }
256 
258  {
259  if (fulocal_rwlock_fd_!=-1) {
260  unlockFULocal();
261  close(fulocal_rwlock_fd_);
262  }
263 
264  if (fulocal_rwlock_fd2_!=-1) {
265  unlockFULocal2();
266  close(fulocal_rwlock_fd2_);
267  }
268 
269  }
270 
271 
273 
274  initRun();
275 
276  for (unsigned int i=0;i<bounds.maxNumberOfStreams();i++){
277  streamFileTracker_.push_back(-1);
278  }
279  nThreads_=bounds.maxNumberOfStreams();
280  nStreams_=bounds.maxNumberOfThreads();
281  }
282 
284  {
286  desc.setComment("Service used for file locking arbitration and for propagating information between other EvF components");
287  desc.addUntracked<std::string> ("baseDir", ".")->setComment("Local base directory for run output");
288  desc.addUntracked<std::string> ("buBaseDir", ".")->setComment("BU base ramdisk directory ");
289  desc.addUntracked<unsigned int> ("runNumber",0)->setComment("Run Number in ramdisk to open");
290  desc.addUntracked<bool>("outputAdler32Recheck",false)->setComment("Check Adler32 of per-process output files while micro-merging");
291  desc.addUntracked<bool>("requireTransfersPSet",false)->setComment("Require complete transferSystem PSet in the process configuration");
292  desc.addUntracked<std::string>("selectedTransferMode","")->setComment("Selected transfer mode (choice in Lvl0 propagated as Python parameter");
293  desc.addUntracked<unsigned int>("fuLockPollInterval",2000)->setComment("Lock polling interval in microseconds for the input directory file lock");
294  desc.addUntracked<bool>("emptyLumisectionMode",true)->setComment("Enables writing stream output metadata even when no events are processed in a lumisection");
295  desc.addUntracked<bool>("microMergeDisabled",true)->setComment("Disabled micro-merging by the Output Module, so it is later done by hltd service");
296  desc.addUntracked<std::string>("mergingPset","")->setComment("Name of merging PSet to look for merging type definitions for streams");
297  desc.setAllowAnything();
298  descriptions.add("EvFDaqDirector", desc);
299  }
300 
302  edm::ProcessContext const& pc) {
304  checkMergeTypePSet(pc);
305  }
306 
307  void EvFDaqDirector::preBeginRun(edm::GlobalContext const& globalContext) {
308 
309  //assert(run_ == id.run());
310 
311  // check if the requested run is the latest one - issue a warning if it isn't
313  edm::LogWarning("EvFDaqDirector") << "WARNING - checking run dir -: "
314  << run_dir_ << ". This is not the highest run "
316  }
317  }
318 
319  void EvFDaqDirector::postEndRun(edm::GlobalContext const& globalContext) {
320  close(bu_readlock_fd_);
321  close(bu_writelock_fd_);
322  if (directorBu_) {
323  std::string filename = bu_run_dir_ + "/bu.lock";
324  removeFile(filename);
325  }
326  }
327 
329  {
330  //delete all files belonging to just closed lumi
331  unsigned int ls = globalContext.luminosityBlockID().luminosityBlock();
333  edm::LogWarning("EvFDaqDirector") << " Handles to check for files to delete were not set by the input source...";
334  return;
335  }
336 
337  std::unique_lock<std::mutex> lkw(*fileDeleteLockPtr_);
338  auto it = filesToDeletePtr_->begin();
339  while (it!=filesToDeletePtr_->end()) {
340  if (it->second->lumi_ == ls) {
341  const boost::filesystem::path filePath(it->second->fileName_);
342  LogDebug("EvFDaqDirector") << "Deleting input file -:" << it->second->fileName_;
343  try {
344  //rarely this fails but file gets deleted
345  boost::filesystem::remove(filePath);
346  }
347  catch (const boost::filesystem::filesystem_error& ex)
348  {
349  edm::LogError("EvFDaqDirector") << " - deleteFile BOOST FILESYSTEM ERROR CAUGHT -: " << ex.what() << ". Trying again.";
350  usleep(10000);
351  try {
352  boost::filesystem::remove(filePath);
353  }
354  catch (const boost::filesystem::filesystem_error&) {/*file gets deleted first time but exception is still thrown*/}
355  }
356  catch (std::exception& ex)
357  {
358  edm::LogError("EvFDaqDirector") << " - deleteFile std::exception CAUGHT -: " << ex.what() << ". Trying again.";
359  usleep(10000);
360  try {
361  boost::filesystem::remove(filePath);
362  } catch (std::exception&) {/*file gets deleted first time but exception is still thrown*/}
363  }
364 
365  delete it->second;
366  it = filesToDeletePtr_->erase(it);
367  }
368  else it++;
369  }
370  }
371 
372  inline void EvFDaqDirector::preSourceEvent(edm::StreamID const& streamID) {
374  }
375 
376 
377  std::string EvFDaqDirector::getInputJsonFilePath(const unsigned int ls, const unsigned int index) const {
378  return bu_run_dir_ + "/" + fffnaming::inputJsonFileName(run_,ls,index);
379  }
380 
381 
382  std::string EvFDaqDirector::getRawFilePath(const unsigned int ls, const unsigned int index) const {
383  return bu_run_dir_ + "/" + fffnaming::inputRawFileName(run_,ls,index);
384  }
385 
386  std::string EvFDaqDirector::getOpenRawFilePath(const unsigned int ls, const unsigned int index) const {
387  return bu_run_dir_ + "/open/" + fffnaming::inputRawFileName(run_,ls,index);
388  }
389 
390  std::string EvFDaqDirector::getOpenInputJsonFilePath(const unsigned int ls, const unsigned int index) const {
391  return bu_run_dir_ + "/open/" + fffnaming::inputJsonFileName(run_,ls,index);
392  }
393 
394  std::string EvFDaqDirector::getDatFilePath(const unsigned int ls, std::string const& stream) const {
395  return run_dir_ + "/" + fffnaming::streamerDataFileNameWithPid(run_,ls,stream);
396  }
397 
398  std::string EvFDaqDirector::getOpenDatFilePath(const unsigned int ls, std::string const& stream) const {
399  return run_dir_ + "/open/" + fffnaming::streamerDataFileNameWithPid(run_,ls,stream);
400  }
401 
402  std::string EvFDaqDirector::getOpenOutputJsonFilePath(const unsigned int ls, std::string const& stream) const {
403  return run_dir_ + "/open/" + fffnaming::streamerJsonFileNameWithPid(run_,ls,stream);
404  }
405 
406  std::string EvFDaqDirector::getOutputJsonFilePath(const unsigned int ls, std::string const& stream) const {
407  return run_dir_ + "/" + fffnaming::streamerJsonFileNameWithPid(run_,ls,stream);
408  }
409 
410  std::string EvFDaqDirector::getMergedDatFilePath(const unsigned int ls, std::string const& stream) const {
412  }
413 
414  std::string EvFDaqDirector::getMergedDatChecksumFilePath(const unsigned int ls, std::string const& stream) const {
416  }
417 
419  return run_dir_ + "/open/" + fffnaming::initFileNameWithPid(run_,0,stream);
420  }
421 
423  return run_dir_ + "/" + fffnaming::initFileNameWithPid(run_,0,stream);
424  }
425 
427  return run_dir_ + "/open/" + fffnaming::protocolBufferHistogramFileNameWithPid(run_,ls,stream);
428  }
429 
432  }
433 
436  }
437 
438  std::string EvFDaqDirector::getOpenRootHistogramFilePath(const unsigned int ls, std::string const& stream) const {
439  return run_dir_ + "/open/" + fffnaming::rootHistogramFileNameWithPid(run_,ls,stream);
440  }
441 
442  std::string EvFDaqDirector::getRootHistogramFilePath(const unsigned int ls, std::string const& stream) const {
443  return run_dir_ + "/" + fffnaming::rootHistogramFileNameWithPid(run_,ls,stream);
444  }
445 
448  }
449 
451  return bu_run_dir_ + "/" + fffnaming::eolsFileName(run_,ls);
452  }
453 
455  return run_dir_ + "/" + fffnaming::eolsFileName(run_,ls);
456  }
457 
459  return run_dir_ + "/" + fffnaming::bolsFileName(run_,ls);
460  }
461 
463  return bu_run_dir_ + "/" + fffnaming::eorFileName(run_);
464  }
465 
466 
468  return run_dir_ + "/" + fffnaming::eorFileName(run_);
469  }
470 
472  int retval = remove(filename.c_str());
473  if (retval != 0)
474  edm::LogError("EvFDaqDirector") << "Could not remove used file -: " << filename << ". error = "
475  << strerror(errno);
476  }
477 
478  void EvFDaqDirector::removeFile(unsigned int ls, unsigned int index) {
479  removeFile(getRawFilePath(ls,index));
480  }
481 
482  EvFDaqDirector::FileStatus EvFDaqDirector::updateFuLock(unsigned int& ls, std::string& nextFile, uint32_t& fsize, uint64_t& lockWaitTime) {
483  EvFDaqDirector::FileStatus fileStatus = noFile;
484 
485  int retval = -1;
486  int lock_attempts = 0;
487 
488  struct stat buf;
489  int stopFileLS = -1;
490  if (stat(stopFilePath_.c_str(),&buf)==0) {
491  stopFileLS = readLastLSEntry(stopFilePath_);
492  if (!stop_ls_override_) {
493  //if lumisection is higher than in stop file, should quit at next from current
494  if (stopFileLS>=0 && (int)ls>=stopFileLS) stopFileLS = stop_ls_override_ = ls;
495  }
496  else stopFileLS = stop_ls_override_;
497  edm::LogWarning("EvFDaqDirector") << "Detected stop request from hltd. Ending run for this process after LS -: " << stopFileLS;
498  //return runEnded;
499  }
500  else //if file was removed before reaching stop condition, reset this
501  stop_ls_override_ = 0;
502 
503  timeval ts_lockbegin;
504  gettimeofday(&ts_lockbegin,0);
505 
506  while (retval==-1) {
507  retval = fcntl(fu_readwritelock_fd_, F_SETLK, &fu_rw_flk);
508  if (retval==-1) usleep(fuLockPollInterval_);
509  else continue;
510 
511  lock_attempts+=fuLockPollInterval_;
512  if (lock_attempts>5000000 || errno==116) {
513  if (errno==116)
514  edm::LogWarning("EvFDaqDirector") << "Stale lock file handle. Checking if run directory and fu.lock file are present" << std::endl;
515  else
516  edm::LogWarning("EvFDaqDirector") << "Unable to obtain a lock for 5 seconds. Checking if run directory and fu.lock file are present -: errno "
517  << errno <<":"<< strerror(errno) << std::endl;
518 
519 
520  if (stat(getEoLSFilePathOnFU(ls).c_str(),&buf)==0) {
521  edm::LogWarning("EvFDaqDirector") << "Detected local EoLS for lumisection "<< ls ;
522  ls++;
523  return noFile;
524  }
525 
526  if (stat(bu_run_dir_.c_str(), &buf)!=0) return runEnded;
527  if (stat((bu_run_dir_+"/fu.lock").c_str(), &buf)!=0) return runEnded;
528  lock_attempts=0;
529  }
530  }
531 
532  timeval ts_lockend;
533  gettimeofday(&ts_lockend,0);
534  long deltat = (ts_lockend.tv_usec-ts_lockbegin.tv_usec) + (ts_lockend.tv_sec-ts_lockbegin.tv_sec)*1000000;
535  if (deltat>0.) lockWaitTime=deltat;
536 
537 
538 
539  if(retval!=0) return fileStatus;
540 
541 #ifdef DEBUG
542  timeval ts_lockend;
543  gettimeofday(&ts_lockend,0);
544 #endif
545 
546  // if the stream is readable
547  if (fu_rw_lock_stream != 0) {
548  unsigned int readLs, readIndex;
549  int check = 0;
550  // rewind the stream
551  check = fseek(fu_rw_lock_stream, 0, SEEK_SET);
552  // if rewinded ok
553  if (check == 0) {
554  // read its' values
555  fscanf(fu_rw_lock_stream, "%u %u", &readLs, &readIndex);
556  edm::LogInfo("EvFDaqDirector") << "Read fu.lock file file -: " << readLs << ":" << readIndex;
557 
558  unsigned int currentLs = readLs;
559  bool bumpedOk = false;
560  //if next lumisection in a lock file is not +1 wrt. source, cycle through the next empty one, unless initial lumi not yet set
561  //no lock file write in this case
562  if (ls && ls+1 < currentLs) ls++;
563  else {
564  // try to bump (look for new index or EoLS file)
565  bumpedOk = bumpFile(readLs, readIndex, nextFile, fsize, stopFileLS);
566  //avoid 2 lumisections jump
567  if (ls && readLs>currentLs && currentLs > ls) {
568  ls++;
569  readLs=currentLs=ls;
570  readIndex=0;
571  bumpedOk=false;
572  //no write to lock file
573  }
574  else {
575  if (ls==0 && readLs>currentLs) {
576  //make sure to intialize always with LS found in the lock file, with possibility of grabbing index file immediately
577  //in this case there is no new file in the same LS
578  readLs=currentLs;
579  readIndex=0;
580  bumpedOk=false;
581  //no write to lock file
582  }
583  //update return LS value
584  ls = readLs;
585  }
586  }
587  if (bumpedOk) {
588  // there is a new index file to grab, lock file needs to be updated
589  check = fseek(fu_rw_lock_stream, 0, SEEK_SET);
590  if (check == 0) {
591  ftruncate(fu_readwritelock_fd_, 0);
592  // write next index in the file, which is the file the next process should take
593  fprintf(fu_rw_lock_stream, "%u %u", readLs, readIndex + 1);
594  fflush(fu_rw_lock_stream);
595  fsync(fu_readwritelock_fd_);
596  fileStatus = newFile;
597  LogDebug("EvFDaqDirector") << "Written to file -: " << readLs << ":" << readIndex + 1;
598  }
599  else {
600  throw cms::Exception("EvFDaqDirector") << "seek on fu read/write lock for updating failed with error " << strerror(errno);
601  }
602  }
603  else if (currentLs < readLs) {
604  //there is no new file in next LS (yet), but lock file can be updated to the next LS
605  check = fseek(fu_rw_lock_stream, 0, SEEK_SET);
606  if (check == 0) {
607  ftruncate(fu_readwritelock_fd_, 0);
608  // in this case LS was bumped, but no new file. Thus readIndex is 0 (set by bumpFile)
609  fprintf(fu_rw_lock_stream, "%u %u", readLs, readIndex);
610  fflush(fu_rw_lock_stream);
611  fsync(fu_readwritelock_fd_);
612  LogDebug("EvFDaqDirector") << "Written to file -: " << readLs << ":" << readIndex;
613  }
614  else {
615  throw cms::Exception("EvFDaqDirector") << "seek on fu read/write lock for updating failed with error " << strerror(errno);
616  }
617  }
618  } else {
619  edm::LogError("EvFDaqDirector") << "seek on fu read/write lock for reading failed with error " << strerror(errno);
620  }
621  } else {
622  edm::LogError("EvFDaqDirector") << "fu read/write lock stream is invalid " << strerror(errno);
623  }
624 
625 #ifdef DEBUG
626  timeval ts_preunlock;
627  gettimeofday(&ts_preunlock,0);
628  int locked_period_int = ts_preunlock.tv_sec - ts_lockend.tv_sec;
629  double locked_period=locked_period_int+double(ts_preunlock.tv_usec - ts_lockend.tv_usec)/1000000;
630 #endif
631 
632  //if new json is present, lock file which FedRawDataInputSource will later unlock
633  if (fileStatus==newFile) lockFULocal();
634 
635  //release lock at this point
636  int retvalu=-1;
637  retvalu=fcntl(fu_readwritelock_fd_, F_SETLKW, &fu_rw_fulk);
638  if (retvalu==-1) edm::LogError("EvFDaqDirector") << "Error unlocking the fu.lock " << strerror(errno);
639 
640 #ifdef DEBUG
641  edm::LogDebug("EvFDaqDirector") << "Waited during lock -: " << locked_period << " seconds";
642 #endif
643 
644  if ( fileStatus == noFile ) {
645  struct stat buf;
646  //edm::LogInfo("EvFDaqDirector") << " looking for EoR file: " << getEoRFilePath().c_str();
647  if ( stat(getEoRFilePath().c_str(), &buf) == 0 || stat(bu_run_dir_.c_str(), &buf)!=0)
648  fileStatus = runEnded;
649  if (stopFileLS>=0 && (int)ls > stopFileLS) {
650  edm::LogInfo("EvFDaqDirector") << "Reached maximum lumisection set by hltd";
651  fileStatus = runEnded;
652  }
653  }
654  return fileStatus;
655  }
656 
658 
659  boost::filesystem::ifstream ij(BUEoLSFile);
660  Json::Value deserializeRoot;
662 
663  if (!reader.parse(ij, deserializeRoot)) {
664  edm::LogError("EvFDaqDirector") << "Cannot deserialize input JSON file -:" << BUEoLSFile;
665  return -1;
666  }
667 
669  DataPoint dp;
670  dp.deserialize(deserializeRoot);
671 
672  //read definition
673  if (readEolsDefinition_) {
674  //std::string def = boost::algorithm::trim(dp.getDefinition());
676  if (!def.size()) readEolsDefinition_=false;
677  while (def.size()) {
678  std::string fullpath;
679  if (def.find('/')==0)
680  fullpath = def;
681  else
682  fullpath = bu_run_dir_+'/'+def;
683  struct stat buf;
684  if (stat(fullpath.c_str(), &buf) == 0) {
685  DataPointDefinition eolsDpd;
686  std::string defLabel = "legend";
687  DataPointDefinition::getDataPointDefinitionFor(fullpath, &eolsDpd,&defLabel);
688  if (eolsDpd.getNames().size()==0) {
689  //try with "data" label if "legend" format is not used
690  eolsDpd = DataPointDefinition();
691  defLabel="data";
692  DataPointDefinition::getDataPointDefinitionFor(fullpath, &eolsDpd,&defLabel);
693  }
694  for (unsigned int i=0;i<eolsDpd.getNames().size();i++)
695  if (eolsDpd.getNames().at(i)=="NFiles")
697  readEolsDefinition_=false;
698  break;
699  }
700  //check if we can still find definition
701  if (def.size()<=1 || def.find('/')==std::string::npos) {
702  readEolsDefinition_=false;
703  break;
704  }
705  def = def.substr(def.find('/')+1);
706  }
707  }
708 
709  if (dp.getData().size()>eolsNFilesIndex_)
710  data = dp.getData()[eolsNFilesIndex_];
711  else {
712  edm::LogError("EvFDaqDirector") << " error reading number of files from BU JSON -: " << BUEoLSFile;
713  return -1;
714  }
715  return boost::lexical_cast<int>(data);
716  }
717 
718  bool EvFDaqDirector::bumpFile(unsigned int& ls, unsigned int& index, std::string& nextFile, uint32_t& fsize, int maxLS) {
719 
720  if (previousFileSize_ != 0) {
721  if (!fms_) {
723  }
725  previousFileSize_ = 0;
726  }
727 
728  //reached limit
729  if (maxLS>=0 && ls > (unsigned int)maxLS) return false;
730 
731  struct stat buf;
732  std::stringstream ss;
733  unsigned int nextIndex = index;
734  nextIndex++;
735 
736  // 1. Check suggested file
737  nextFile = getInputJsonFilePath(ls,index);
738  if (stat(nextFile.c_str(), &buf) == 0) {
739 
740  previousFileSize_ = buf.st_size;
741  fsize = buf.st_size;
742  return true;
743  }
744  // 2. No file -> lumi ended? (and how many?)
745  else {
746  std::string BUEoLSFile = getEoLSFilePathOnBU(ls);
747  bool eolFound = (stat(BUEoLSFile.c_str(), &buf) == 0);
748  while (eolFound) {
749 
750  // recheck that no raw file appeared in the meantime
751  if (stat(nextFile.c_str(), &buf) == 0) {
752  previousFileSize_ = buf.st_size;
753  fsize = buf.st_size;
754  return true;
755  }
756 
757  int indexFilesInLS = getNFilesFromEoLS(BUEoLSFile);
758  if (indexFilesInLS < 0)
759  //parsing failed
760  return false;
761  else {
762  //check index
763  if ((int)index<indexFilesInLS) {
764  //we have 2 files, and check for 1 failed... retry (2 will never be here)
765  edm::LogError("EvFDaqDirector") << "Potential miss of index file in LS -: " << ls << ". Missing "
766  << nextFile << " because " << indexFilesInLS-1 << " is the highest index expected. Will not update fu.lock file";
767  return false;
768  }
769  }
770  // this lumi ended, check for files
771  ++ls;
772  index = 0;
773 
774  //reached limit
775  if (maxLS>=0 && ls > (unsigned int)maxLS) return false;
776 
777  nextFile = getInputJsonFilePath(ls,0);
778  if (stat(nextFile.c_str(), &buf) == 0) {
779  // a new file was found at new lumisection, index 0
780  previousFileSize_ = buf.st_size;
781  fsize = buf.st_size;
782  return true;
783  }
784  else {
785  //change of policy: we need to cycle through each LS
786  return false;
787  }
788  BUEoLSFile = getEoLSFilePathOnBU(ls);
789  eolFound = (stat(BUEoLSFile.c_str(), &buf) == 0);
790  }
791  }
792  // no new file found
793  return false;
794  }
795 
797  if (fu_rw_lock_stream == 0)
798  edm::LogError("EvFDaqDirector") << "Error creating fu read/write lock stream "
799  << strerror(errno);
800  else {
801  edm::LogInfo("EvFDaqDirector") << "Initializing FU LOCK FILE";
802  unsigned int readLs = 1, readIndex = 0;
803  fprintf(fu_rw_lock_stream, "%u %u", readLs, readIndex);
804  }
805  }
806 
808  if (create) {
809  fu_readwritelock_fd_ = open(fulockfile.c_str(), O_RDWR | O_CREAT,
810  S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);
811  chmod(fulockfile.c_str(),0766);
812  } else {
813  fu_readwritelock_fd_ = open(fulockfile.c_str(), O_RDWR, S_IRWXU);
814  }
815  if (fu_readwritelock_fd_ == -1)
816  edm::LogError("EvFDaqDirector") << "problem with creating filedesc for fuwritelock -: " << fulockfile.c_str()
817  << " create:" << create << " error:" << strerror(errno);
818  else
819  LogDebug("EvFDaqDirector") << "creating filedesc for fureadwritelock -: "
821 
822  fu_rw_lock_stream = fdopen(fu_readwritelock_fd_, "r+");
823  }
824 
825  //create if does not exist then lock the merge destination file
827  data_rw_stream = fopen(getMergedDatFilePath(ls,stream).c_str(), "a"); //open stream for appending
829  if (data_readwrite_fd_ == -1)
830  edm::LogError("EvFDaqDirector") << "problem with creating filedesc for datamerge "
831  << strerror(errno);
832  else
833  LogDebug("EvFDaqDirector") << "creating filedesc for datamerge -: "
835  fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_flk);
836 
837  return data_rw_stream;
838  }
839 
841  fflush(data_rw_stream);
842  fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_fulk);
843  fclose(data_rw_stream);
844  }
845 
847  pthread_mutex_lock(&init_lock_);
848  }
849 
851  pthread_mutex_unlock(&init_lock_);
852  }
853 
855  //fcntl(fulocal_rwlock_fd_, F_SETLKW, &fulocal_rw_flk);
856  flock(fulocal_rwlock_fd_,LOCK_SH);
857  }
858 
860  //fcntl(fulocal_rwlock_fd_, F_SETLKW, &fulocal_rw_fulk);
861  flock(fulocal_rwlock_fd_,LOCK_UN);
862  }
863 
864 
866  //fcntl(fulocal_rwlock_fd2_, F_SETLKW, &fulocal_rw_flk2);
867  flock(fulocal_rwlock_fd2_,LOCK_EX);
868  }
869 
871  //fcntl(fulocal_rwlock_fd2_, F_SETLKW, &fulocal_rw_fulk2);
872  flock(fulocal_rwlock_fd2_,LOCK_UN);
873  }
874 
875 
877  // create open dir if not already there
878 
880  if (!boost::filesystem::is_directory(openPath)) {
881  LogDebug("EvFDaqDirector") << "<open> FU dir not found. Creating... -:" << openPath.string();
882  boost::filesystem::create_directories(openPath);
883  }
884  }
885 
886 
888 
889  boost::filesystem::ifstream ij(file);
890  Json::Value deserializeRoot;
892 
893  if (!reader.parse(ij, deserializeRoot)) {
894  edm::LogError("EvFDaqDirector") << "Cannot deserialize input JSON file -:" << file;
895  return -1;
896  }
897 
898  int ret = deserializeRoot.get("lastLS","").asInt();
899  return ret;
900 
901  }
902 
903  //if transferSystem PSet is present in the menu, we require it to be complete and consistent for all specified streams
905  {
906  if(transferSystemJson_) return;
907 
908  transferSystemJson_.reset(new Json::Value);
910  if (topPset.existsAs<edm::ParameterSet>("transferSystem",true))
911  {
912  const edm::ParameterSet& tsPset(topPset.getParameterSet("transferSystem"));
913 
914  Json::Value destinationsVal(Json::arrayValue);
915  std::vector<std::string> destinations = tsPset.getParameter<std::vector<std::string>>("destinations");
916  for (auto & dest: destinations) destinationsVal.append(dest);
917  (*transferSystemJson_)["destinations"]=destinationsVal;
918 
919  Json::Value modesVal(Json::arrayValue);
920  std::vector<std::string> modes = tsPset.getParameter< std::vector<std::string> >("transferModes");
921  for (auto & mode: modes) modesVal.append(mode);
922  (*transferSystemJson_)["transferModes"]=modesVal;
923 
924  for (auto psKeyItr =tsPset.psetTable().begin();psKeyItr!=tsPset.psetTable().end(); ++ psKeyItr) {
925  if (psKeyItr->first!="destinations" && psKeyItr->first!="transferModes") {
926  const edm::ParameterSet & streamDef = tsPset.getParameterSet(psKeyItr->first);
927  Json::Value streamVal;
928  for (auto & mode : modes) {
929  //validation
930  if (!streamDef.existsAs<std::vector<std::string>>(mode,true))
931  throw cms::Exception("EvFDaqDirector") << " Missing transfer system specification for -:" << psKeyItr->first << " (transferMode " << mode << ")";
932  std::vector<std::string> streamDestinations = streamDef.getParameter<std::vector<std::string>>(mode);
933 
934  Json::Value sDestsValue(Json::arrayValue);
935 
936  if (!streamDestinations.size())
937  throw cms::Exception("EvFDaqDirector") << " Missing transter system destination(s) for -: "<< psKeyItr->first << ", mode:" << mode;
938 
939  for (auto & sdest:streamDestinations) {
940  bool sDestValid=false;
941  sDestsValue.append(sdest);
942  for (auto & dest: destinations) {
943  if (dest==sdest) sDestValid=true;
944  }
945  if (!sDestValid)
946  throw cms::Exception("EvFDaqDirector") << " Invalid transter system destination specified for -: "<< psKeyItr->first << ", mode:" << mode << ", dest:"<<sdest;
947  }
948  streamVal[mode]=sDestsValue;
949  }
950  (*transferSystemJson_)[psKeyItr->first] = streamVal;
951  }
952  }
953  }
954  else {
955  if (requireTSPSet_)
956  throw cms::Exception("EvFDaqDirector") << "transferSystem PSet not found";
957  }
958  }
959 
961  {
962  std::string streamRequestName;
963  if (transferSystemJson_->isMember(stream.c_str()))
964  streamRequestName = stream;
965  else {
966  std::stringstream msg;
967  msg << "Transfer system mode definitions missing for -: " << stream;
968  if (requireTSPSet_)
969  throw cms::Exception("EvFDaqDirector") << msg.str();
970  else {
971  edm::LogWarning("EvFDaqDirector") << msg.str() << " (permissive mode)";
972  return std::string("Failsafe");
973  }
974  }
975  //return empty if strict check parameter is not on
977  edm::LogWarning("EvFDaqDirector") << "Selected mode string is not provided as DaqDirector parameter."
978  << "Switch on requireTSPSet parameter to enforce this requirement. Setting mode to empty string.";
979  return std::string("Failsafe");
980  }
982  throw cms::Exception("EvFDaqDirector") << "Selected mode string is not provided as DaqDirector parameter.";
983  }
984  //check if stream has properly listed transfer stream
985  if (!transferSystemJson_->get(streamRequestName, "").isMember(selectedTransferMode_.c_str()))
986  {
987  std::stringstream msg;
988  msg << "Selected transfer mode " << selectedTransferMode_ << " is not specified for stream " << streamRequestName;
989  if (requireTSPSet_)
990  throw cms::Exception("EvFDaqDirector") << msg.str();
991  else
992  edm::LogWarning("EvFDaqDirector") << msg.str() << " (permissive mode)";
993  return std::string("Failsafe");
994  }
995  Json::Value destsVec = transferSystemJson_->get(streamRequestName, "").get(selectedTransferMode_,"");
996 
997  //flatten string json::Array into CSV std::string
999  for (Json::Value::iterator it = destsVec.begin(); it!=destsVec.end(); it++)
1000  {
1001  if (ret!="") ret +=",";
1002  ret+=(*it).asString();
1003  }
1004  return ret;
1005  }
1006 
1008  {
1009  if (mergeTypePset_.empty()) return;
1010  if(mergeTypeMap_.size()) return;
1011  edm::ParameterSet const& topPset = edm::getParameterSet(pc.parameterSetID());
1012  if (topPset.existsAs<edm::ParameterSet>(mergeTypePset_,true))
1013  {
1014  const edm::ParameterSet& tsPset(topPset.getParameterSet(mergeTypePset_));
1015  for (std::string pname : tsPset.getParameterNames()) {
1016  std::string streamType = tsPset.getParameter<std::string>(pname);
1017  mergeTypeMap_[pname]=streamType;
1018  }
1019  }
1020  }
1021 
1023  {
1024  auto mergeTypeItr = mergeTypeMap_.find(stream.c_str());
1025  if (mergeTypeItr == mergeTypeMap_.end()) {
1026  edm::LogInfo("EvFDaqDirector") << " No merging type specified for stream " << stream << ". Using default value";
1027  assert(defaultType<MergeTypeNames_.size());
1028  std::string defaultName = MergeTypeNames_[defaultType];
1029  mergeTypeMap_[stream] = defaultName;
1030  return defaultName;
1031  }
1032  return mergeTypeItr->second;
1033  }
1034 
1036  std::string proc_flag = run_dir_ + "/processing";
1037  int proc_flag_fd = open(proc_flag.c_str(), O_RDWR | O_CREAT, S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);
1038  close(proc_flag_fd);
1039  }
1040 
1041 }
#define LogDebug(id)
unsigned int nThreads_
type
Definition: HCALResponse.h:21
unsigned int maxNumberOfThreads() const
Definition: SystemBounds.h:46
T getParameter(std::string const &) const
std::string getStreamDestinations(std::string const &stream) const
Value get(UInt index, const Value &defaultValue) const
std::vector< std::string > & getData()
Definition: DataPoint.h:58
int i
Definition: DBlmapReader.cc:9
struct flock fu_rw_flk
tuple ret
prodAgent to be discontinued
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 bolsFileName(const unsigned int run, const unsigned int ls)
std::string streamerDataChecksumFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string getMergedProtocolBufferHistogramFilePath(const unsigned int ls, std::string const &stream) const
void watchPreallocate(Preallocate::slot_type const &iSlot)
std::vector< int > streamFileTracker_
const_iterator begin() 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::list< std::pair< int, InputFile * > > * filesToDeletePtr_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::string getMergedDatChecksumFilePath(const unsigned int ls, std::string const &stream) const
std::shared_ptr< Json::Value > transferSystemJson_
void setAllowAnything()
allow any parameter label/value pairs
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)
ParameterSet const & getParameterSet(ParameterSetID const &id)
assert(m_qm.get())
pthread_mutex_t init_lock_
LuminosityBlockID const & luminosityBlockID() const
Definition: GlobalContext.h:52
def ls
Definition: eostools.py:348
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 getOpenInitFilePath(std::string const &stream) const
std::string getOpenRawFilePath(const unsigned int ls, const unsigned int index) const
Value & append(const Value &value)
Append value to array at the end.
#define NULL
Definition: scimark2.h:8
struct flock data_rw_flk
void createProcessingNotificationMaybe() const
bool parse(const std::string &document, Value &root, bool collectComments=true)
Read a Value from a JSON document.
std::map< std::string, std::string > mergeTypeMap_
Represents a JSON value.
Definition: value.h:111
std::string getEoLSFilePathOnBU(const unsigned int ls) const
std::string getEoRFilePath() const
unsigned long previousFileSize_
ParameterSetID const & parameterSetID() const
def chmod
Definition: eostools.py:293
struct flock fu_rw_fulk
unsigned int maxNumberOfStreams() const
Definition: SystemBounds.h:43
std::string hltSourceDirectory_
std::string getOpenProtocolBufferHistogramFilePath(const unsigned int ls, std::string const &stream) const
void setComment(std::string const &value)
std::mutex * fileDeleteLockPtr_
std::string mergeTypePset_
std::string streamerDataFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string getMergedDatFilePath(const unsigned int ls, std::string const &stream) const
bool check(const std::string &)
std::string getStreamMergeType(std::string const &stream, MergeType defaultType)
FileStatus updateFuLock(unsigned int &ls, std::string &nextFile, uint32_t &fsize, uint64_t &lockWaitTime)
std::string getOpenOutputJsonFilePath(const unsigned int ls, std::string const &stream) const
std::string getOpenRootHistogramFilePath(const unsigned int ls, std::string const &stream) const
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)
std::string stopFilePath_
FILE * maybeCreateAndLockFileHeadForStream(unsigned int ls, std::string &stream)
std::string bu_base_dir_
void removeFile(unsigned int ls, unsigned int index)
unsigned int stop_ls_override_
std::string selectedTransferMode_
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)
int readLastLSEntry(std::string const &file)
virtual void deserialize(Json::Value &root)
Definition: DataPoint.cc:56
unsigned int eolsNFilesIndex_
std::string getDatFilePath(const unsigned int ls, std::string const &stream) const
void preBeginJob(edm::PathsAndConsumesOfModulesBase const &, edm::ProcessContext const &)
void watchPreGlobalBeginRun(PreGlobalBeginRun::slot_type const &iSlot)
std::string getOutputJsonFilePath(const unsigned int ls, std::string const &stream) const
int getNFilesFromEoLS(std::string BUEoLSFile)
void preBeginRun(edm::GlobalContext const &globalContext)
std::string rootHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
Int asInt() const
void preSourceEvent(edm::StreamID const &streamID)
std::string initFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
unsigned long long uint64_t
Definition: Time.h:15
void checkMergeTypePSet(edm::ProcessContext const &pc)
ParameterSet const & getParameterSet(std::string const &) const
void preGlobalEndLumi(edm::GlobalContext const &globalContext)
auto dp
Definition: deltaR.h:22
tuple pid
Definition: sysUtil.py:22
void watchPostGlobalEndRun(PostGlobalEndRun::slot_type const &iSlot)
LuminosityBlockNumber_t luminosityBlock() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::string & getDefinition()
Definition: DataPoint.h:59
evf::FastMonitoringService * fms_
void watchPreBeginJob(PreBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
std::string bu_run_dir_
std::string rootHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
def mkdir
Definition: eostools.py:250
std::string findHighestRunDir()
Definition: DirManager.cc:20
std::string getBoLSFilePathOnFU(const unsigned int ls) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void postEndRun(edm::GlobalContext const &globalContext)
tuple filename
Definition: lut2db_cfg.py:20
Unserialize a JSON document into a Value.
Definition: reader.h:16
static const std::vector< std::string > MergeTypeNames_
const_iterator end() const
void checkTransferSystemPSet(edm::ProcessContext const &pc)
std::vector< std::string > const & getNames()
std::string getEoLSFilePathOnFU(const unsigned int ls) const
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
bool bumpFile(unsigned int &ls, unsigned int &index, std::string &nextFile, uint32_t &fsize, int maxLS)
volatile std::atomic< bool > shutdown_flag false
void preallocate(edm::service::SystemBounds const &bounds)
struct flock data_rw_fulk
Iterator for object and array value.
Definition: value.h:1007
std::string getInputJsonFilePath(const unsigned int ls, const unsigned int index) const
std::string getRunOpenDirPath() const
JetCorrectorParameters::Definitions def
Definition: classes.h:6
std::string protocolBufferHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
unsigned int fuLockPollInterval_
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_
array value (ordered list)
Definition: value.h:31