test
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  std::stringstream sstp;
256  sstp << stopFilePath_ << "_pid" << getpid();
257  stopFilePathPid_ = sstp.str();
258  }
259 
261  {
262  if (fulocal_rwlock_fd_!=-1) {
263  unlockFULocal();
264  close(fulocal_rwlock_fd_);
265  }
266 
267  if (fulocal_rwlock_fd2_!=-1) {
268  unlockFULocal2();
269  close(fulocal_rwlock_fd2_);
270  }
271 
272  }
273 
274 
276 
277  initRun();
278 
279  for (unsigned int i=0;i<bounds.maxNumberOfStreams();i++){
280  streamFileTracker_.push_back(-1);
281  }
282  nThreads_=bounds.maxNumberOfStreams();
283  nStreams_=bounds.maxNumberOfThreads();
284  }
285 
287  {
289  desc.setComment("Service used for file locking arbitration and for propagating information between other EvF components");
290  desc.addUntracked<std::string> ("baseDir", ".")->setComment("Local base directory for run output");
291  desc.addUntracked<std::string> ("buBaseDir", ".")->setComment("BU base ramdisk directory ");
292  desc.addUntracked<unsigned int> ("runNumber",0)->setComment("Run Number in ramdisk to open");
293  desc.addUntracked<bool>("outputAdler32Recheck",false)->setComment("Check Adler32 of per-process output files while micro-merging");
294  desc.addUntracked<bool>("requireTransfersPSet",false)->setComment("Require complete transferSystem PSet in the process configuration");
295  desc.addUntracked<std::string>("selectedTransferMode","")->setComment("Selected transfer mode (choice in Lvl0 propagated as Python parameter");
296  desc.addUntracked<unsigned int>("fuLockPollInterval",2000)->setComment("Lock polling interval in microseconds for the input directory file lock");
297  desc.addUntracked<bool>("emptyLumisectionMode",true)->setComment("Enables writing stream output metadata even when no events are processed in a lumisection");
298  desc.addUntracked<bool>("microMergeDisabled",true)->setComment("Disabled micro-merging by the Output Module, so it is later done by hltd service");
299  desc.addUntracked<std::string>("mergingPset","")->setComment("Name of merging PSet to look for merging type definitions for streams");
300  desc.setAllowAnything();
301  descriptions.add("EvFDaqDirector", desc);
302  }
303 
305  edm::ProcessContext const& pc) {
307  checkMergeTypePSet(pc);
308  }
309 
310  void EvFDaqDirector::preBeginRun(edm::GlobalContext const& globalContext) {
311 
312  //assert(run_ == id.run());
313 
314  // check if the requested run is the latest one - issue a warning if it isn't
316  edm::LogWarning("EvFDaqDirector") << "WARNING - checking run dir -: "
317  << run_dir_ << ". This is not the highest run "
319  }
320  }
321 
322  void EvFDaqDirector::postEndRun(edm::GlobalContext const& globalContext) {
323  close(bu_readlock_fd_);
324  close(bu_writelock_fd_);
325  if (directorBu_) {
326  std::string filename = bu_run_dir_ + "/bu.lock";
327  removeFile(filename);
328  }
329  }
330 
332  {
333  //delete all files belonging to just closed lumi
334  unsigned int ls = globalContext.luminosityBlockID().luminosityBlock();
336  edm::LogWarning("EvFDaqDirector") << " Handles to check for files to delete were not set by the input source...";
337  return;
338  }
339 
340  std::unique_lock<std::mutex> lkw(*fileDeleteLockPtr_);
341  auto it = filesToDeletePtr_->begin();
342  while (it!=filesToDeletePtr_->end()) {
343  if (it->second->lumi_ == ls) {
344  const boost::filesystem::path filePath(it->second->fileName_);
345  LogDebug("EvFDaqDirector") << "Deleting input file -:" << it->second->fileName_;
346  try {
347  //rarely this fails but file gets deleted
348  boost::filesystem::remove(filePath);
349  }
350  catch (const boost::filesystem::filesystem_error& ex)
351  {
352  edm::LogError("EvFDaqDirector") << " - deleteFile BOOST FILESYSTEM ERROR CAUGHT -: " << ex.what() << ". Trying again.";
353  usleep(10000);
354  try {
355  boost::filesystem::remove(filePath);
356  }
357  catch (const boost::filesystem::filesystem_error&) {/*file gets deleted first time but exception is still thrown*/}
358  }
359  catch (std::exception& ex)
360  {
361  edm::LogError("EvFDaqDirector") << " - deleteFile std::exception CAUGHT -: " << ex.what() << ". Trying again.";
362  usleep(10000);
363  try {
364  boost::filesystem::remove(filePath);
365  } catch (std::exception&) {/*file gets deleted first time but exception is still thrown*/}
366  }
367 
368  delete it->second;
369  it = filesToDeletePtr_->erase(it);
370  }
371  else it++;
372  }
373  }
374 
375  inline void EvFDaqDirector::preSourceEvent(edm::StreamID const& streamID) {
377  }
378 
379 
380  std::string EvFDaqDirector::getInputJsonFilePath(const unsigned int ls, const unsigned int index) const {
381  return bu_run_dir_ + "/" + fffnaming::inputJsonFileName(run_,ls,index);
382  }
383 
384 
385  std::string EvFDaqDirector::getRawFilePath(const unsigned int ls, const unsigned int index) const {
386  return bu_run_dir_ + "/" + fffnaming::inputRawFileName(run_,ls,index);
387  }
388 
389  std::string EvFDaqDirector::getOpenRawFilePath(const unsigned int ls, const unsigned int index) const {
390  return bu_run_dir_ + "/open/" + fffnaming::inputRawFileName(run_,ls,index);
391  }
392 
393  std::string EvFDaqDirector::getOpenInputJsonFilePath(const unsigned int ls, const unsigned int index) const {
394  return bu_run_dir_ + "/open/" + fffnaming::inputJsonFileName(run_,ls,index);
395  }
396 
397  std::string EvFDaqDirector::getDatFilePath(const unsigned int ls, std::string const& stream) const {
398  return run_dir_ + "/" + fffnaming::streamerDataFileNameWithPid(run_,ls,stream);
399  }
400 
401  std::string EvFDaqDirector::getOpenDatFilePath(const unsigned int ls, std::string const& stream) const {
402  return run_dir_ + "/open/" + fffnaming::streamerDataFileNameWithPid(run_,ls,stream);
403  }
404 
405  std::string EvFDaqDirector::getOpenOutputJsonFilePath(const unsigned int ls, std::string const& stream) const {
406  return run_dir_ + "/open/" + fffnaming::streamerJsonFileNameWithPid(run_,ls,stream);
407  }
408 
409  std::string EvFDaqDirector::getOutputJsonFilePath(const unsigned int ls, std::string const& stream) const {
410  return run_dir_ + "/" + fffnaming::streamerJsonFileNameWithPid(run_,ls,stream);
411  }
412 
413  std::string EvFDaqDirector::getMergedDatFilePath(const unsigned int ls, std::string const& stream) const {
415  }
416 
417  std::string EvFDaqDirector::getMergedDatChecksumFilePath(const unsigned int ls, std::string const& stream) const {
419  }
420 
422  return run_dir_ + "/open/" + fffnaming::initFileNameWithPid(run_,0,stream);
423  }
424 
426  return run_dir_ + "/" + fffnaming::initFileNameWithPid(run_,0,stream);
427  }
428 
430  return run_dir_ + "/open/" + fffnaming::protocolBufferHistogramFileNameWithPid(run_,ls,stream);
431  }
432 
435  }
436 
439  }
440 
441  std::string EvFDaqDirector::getOpenRootHistogramFilePath(const unsigned int ls, std::string const& stream) const {
442  return run_dir_ + "/open/" + fffnaming::rootHistogramFileNameWithPid(run_,ls,stream);
443  }
444 
445  std::string EvFDaqDirector::getRootHistogramFilePath(const unsigned int ls, std::string const& stream) const {
446  return run_dir_ + "/" + fffnaming::rootHistogramFileNameWithPid(run_,ls,stream);
447  }
448 
451  }
452 
454  return bu_run_dir_ + "/" + fffnaming::eolsFileName(run_,ls);
455  }
456 
458  return run_dir_ + "/" + fffnaming::eolsFileName(run_,ls);
459  }
460 
462  return run_dir_ + "/" + fffnaming::bolsFileName(run_,ls);
463  }
464 
466  return bu_run_dir_ + "/" + fffnaming::eorFileName(run_);
467  }
468 
469 
471  return run_dir_ + "/" + fffnaming::eorFileName(run_);
472  }
473 
475  int retval = remove(filename.c_str());
476  if (retval != 0)
477  edm::LogError("EvFDaqDirector") << "Could not remove used file -: " << filename << ". error = "
478  << strerror(errno);
479  }
480 
481  void EvFDaqDirector::removeFile(unsigned int ls, unsigned int index) {
482  removeFile(getRawFilePath(ls,index));
483  }
484 
485  EvFDaqDirector::FileStatus EvFDaqDirector::updateFuLock(unsigned int& ls, std::string& nextFile, uint32_t& fsize, uint64_t& lockWaitTime) {
486  EvFDaqDirector::FileStatus fileStatus = noFile;
487 
488  int retval = -1;
489  int lock_attempts = 0;
490 
491  struct stat buf;
492  int stopFileLS = -1;
493  int stopFileCheck = stat(stopFilePath_.c_str(),&buf);
494  int stopFilePidCheck = stat(stopFilePathPid_.c_str(),&buf);
495  if (stopFileCheck==0 || stopFilePidCheck==0) {
496  if (stopFileCheck==0)
497  stopFileLS = readLastLSEntry(stopFilePath_);
498  else
499  stopFileLS = 1;//stop without drain if only pid is stopped
500  if (!stop_ls_override_) {
501  //if lumisection is higher than in stop file, should quit at next from current
502  if (stopFileLS>=0 && (int)ls>=stopFileLS) stopFileLS = stop_ls_override_ = ls;
503  }
504  else stopFileLS = stop_ls_override_;
505  edm::LogWarning("EvFDaqDirector") << "Detected stop request from hltd. Ending run for this process after LS -: " << stopFileLS;
506  //return runEnded;
507  }
508  else //if file was removed before reaching stop condition, reset this
509  stop_ls_override_ = 0;
510 
511  timeval ts_lockbegin;
512  gettimeofday(&ts_lockbegin,0);
513 
514  while (retval==-1) {
515  retval = fcntl(fu_readwritelock_fd_, F_SETLK, &fu_rw_flk);
516  if (retval==-1) usleep(fuLockPollInterval_);
517  else continue;
518 
519  lock_attempts+=fuLockPollInterval_;
520  if (lock_attempts>5000000 || errno==116) {
521  if (errno==116)
522  edm::LogWarning("EvFDaqDirector") << "Stale lock file handle. Checking if run directory and fu.lock file are present" << std::endl;
523  else
524  edm::LogWarning("EvFDaqDirector") << "Unable to obtain a lock for 5 seconds. Checking if run directory and fu.lock file are present -: errno "
525  << errno <<":"<< strerror(errno) << std::endl;
526 
527 
528  if (stat(getEoLSFilePathOnFU(ls).c_str(),&buf)==0) {
529  edm::LogWarning("EvFDaqDirector") << "Detected local EoLS for lumisection "<< ls ;
530  ls++;
531  return noFile;
532  }
533 
534  if (stat(bu_run_dir_.c_str(), &buf)!=0) return runEnded;
535  if (stat((bu_run_dir_+"/fu.lock").c_str(), &buf)!=0) return runEnded;
536  lock_attempts=0;
537  }
538  }
539 
540  timeval ts_lockend;
541  gettimeofday(&ts_lockend,0);
542  long deltat = (ts_lockend.tv_usec-ts_lockbegin.tv_usec) + (ts_lockend.tv_sec-ts_lockbegin.tv_sec)*1000000;
543  if (deltat>0.) lockWaitTime=deltat;
544 
545 
546 
547  if(retval!=0) return fileStatus;
548 
549 #ifdef DEBUG
550  timeval ts_lockend;
551  gettimeofday(&ts_lockend,0);
552 #endif
553 
554  // if the stream is readable
555  if (fu_rw_lock_stream != 0) {
556  unsigned int readLs, readIndex;
557  int check = 0;
558  // rewind the stream
559  check = fseek(fu_rw_lock_stream, 0, SEEK_SET);
560  // if rewinded ok
561  if (check == 0) {
562  // read its' values
563  fscanf(fu_rw_lock_stream, "%u %u", &readLs, &readIndex);
564  edm::LogInfo("EvFDaqDirector") << "Read fu.lock file file -: " << readLs << ":" << readIndex;
565 
566  unsigned int currentLs = readLs;
567  bool bumpedOk = false;
568  //if next lumisection in a lock file is not +1 wrt. source, cycle through the next empty one, unless initial lumi not yet set
569  //no lock file write in this case
570  if (ls && ls+1 < currentLs) ls++;
571  else {
572  // try to bump (look for new index or EoLS file)
573  bumpedOk = bumpFile(readLs, readIndex, nextFile, fsize, stopFileLS);
574  //avoid 2 lumisections jump
575  if (ls && readLs>currentLs && currentLs > ls) {
576  ls++;
577  readLs=currentLs=ls;
578  readIndex=0;
579  bumpedOk=false;
580  //no write to lock file
581  }
582  else {
583  if (ls==0 && readLs>currentLs) {
584  //make sure to intialize always with LS found in the lock file, with possibility of grabbing index file immediately
585  //in this case there is no new file in the same LS
586  readLs=currentLs;
587  readIndex=0;
588  bumpedOk=false;
589  //no write to lock file
590  }
591  //update return LS value
592  ls = readLs;
593  }
594  }
595  if (bumpedOk) {
596  // there is a new index file to grab, lock file needs to be updated
597  check = fseek(fu_rw_lock_stream, 0, SEEK_SET);
598  if (check == 0) {
599  ftruncate(fu_readwritelock_fd_, 0);
600  // write next index in the file, which is the file the next process should take
601  fprintf(fu_rw_lock_stream, "%u %u", readLs, readIndex + 1);
602  fflush(fu_rw_lock_stream);
603  fsync(fu_readwritelock_fd_);
604  fileStatus = newFile;
605  LogDebug("EvFDaqDirector") << "Written to file -: " << readLs << ":" << readIndex + 1;
606  }
607  else {
608  throw cms::Exception("EvFDaqDirector") << "seek on fu read/write lock for updating failed with error " << strerror(errno);
609  }
610  }
611  else if (currentLs < readLs) {
612  //there is no new file in next LS (yet), but lock file can be updated to the next LS
613  check = fseek(fu_rw_lock_stream, 0, SEEK_SET);
614  if (check == 0) {
615  ftruncate(fu_readwritelock_fd_, 0);
616  // in this case LS was bumped, but no new file. Thus readIndex is 0 (set by bumpFile)
617  fprintf(fu_rw_lock_stream, "%u %u", readLs, readIndex);
618  fflush(fu_rw_lock_stream);
619  fsync(fu_readwritelock_fd_);
620  LogDebug("EvFDaqDirector") << "Written to file -: " << readLs << ":" << readIndex;
621  }
622  else {
623  throw cms::Exception("EvFDaqDirector") << "seek on fu read/write lock for updating failed with error " << strerror(errno);
624  }
625  }
626  } else {
627  edm::LogError("EvFDaqDirector") << "seek on fu read/write lock for reading failed with error " << strerror(errno);
628  }
629  } else {
630  edm::LogError("EvFDaqDirector") << "fu read/write lock stream is invalid " << strerror(errno);
631  }
632 
633 #ifdef DEBUG
634  timeval ts_preunlock;
635  gettimeofday(&ts_preunlock,0);
636  int locked_period_int = ts_preunlock.tv_sec - ts_lockend.tv_sec;
637  double locked_period=locked_period_int+double(ts_preunlock.tv_usec - ts_lockend.tv_usec)/1000000;
638 #endif
639 
640  //if new json is present, lock file which FedRawDataInputSource will later unlock
641  if (fileStatus==newFile) lockFULocal();
642 
643  //release lock at this point
644  int retvalu=-1;
645  retvalu=fcntl(fu_readwritelock_fd_, F_SETLKW, &fu_rw_fulk);
646  if (retvalu==-1) edm::LogError("EvFDaqDirector") << "Error unlocking the fu.lock " << strerror(errno);
647 
648 #ifdef DEBUG
649  edm::LogDebug("EvFDaqDirector") << "Waited during lock -: " << locked_period << " seconds";
650 #endif
651 
652  if ( fileStatus == noFile ) {
653  struct stat buf;
654  //edm::LogInfo("EvFDaqDirector") << " looking for EoR file: " << getEoRFilePath().c_str();
655  if ( stat(getEoRFilePath().c_str(), &buf) == 0 || stat(bu_run_dir_.c_str(), &buf)!=0)
656  fileStatus = runEnded;
657  if (stopFileLS>=0 && (int)ls > stopFileLS) {
658  edm::LogInfo("EvFDaqDirector") << "Reached maximum lumisection set by hltd";
659  fileStatus = runEnded;
660  }
661  }
662  return fileStatus;
663  }
664 
666 
667  boost::filesystem::ifstream ij(BUEoLSFile);
668  Json::Value deserializeRoot;
670 
671  if (!reader.parse(ij, deserializeRoot)) {
672  edm::LogError("EvFDaqDirector") << "Cannot deserialize input JSON file -:" << BUEoLSFile;
673  return -1;
674  }
675 
677  DataPoint dp;
678  dp.deserialize(deserializeRoot);
679 
680  //read definition
681  if (readEolsDefinition_) {
682  //std::string def = boost::algorithm::trim(dp.getDefinition());
684  if (!def.size()) readEolsDefinition_=false;
685  while (def.size()) {
686  std::string fullpath;
687  if (def.find('/')==0)
688  fullpath = def;
689  else
690  fullpath = bu_run_dir_+'/'+def;
691  struct stat buf;
692  if (stat(fullpath.c_str(), &buf) == 0) {
693  DataPointDefinition eolsDpd;
694  std::string defLabel = "legend";
695  DataPointDefinition::getDataPointDefinitionFor(fullpath, &eolsDpd,&defLabel);
696  if (eolsDpd.getNames().size()==0) {
697  //try with "data" label if "legend" format is not used
698  eolsDpd = DataPointDefinition();
699  defLabel="data";
700  DataPointDefinition::getDataPointDefinitionFor(fullpath, &eolsDpd,&defLabel);
701  }
702  for (unsigned int i=0;i<eolsDpd.getNames().size();i++)
703  if (eolsDpd.getNames().at(i)=="NFiles")
705  readEolsDefinition_=false;
706  break;
707  }
708  //check if we can still find definition
709  if (def.size()<=1 || def.find('/')==std::string::npos) {
710  readEolsDefinition_=false;
711  break;
712  }
713  def = def.substr(def.find('/')+1);
714  }
715  }
716 
717  if (dp.getData().size()>eolsNFilesIndex_)
718  data = dp.getData()[eolsNFilesIndex_];
719  else {
720  edm::LogError("EvFDaqDirector") << " error reading number of files from BU JSON -: " << BUEoLSFile;
721  return -1;
722  }
723  return boost::lexical_cast<int>(data);
724  }
725 
726  bool EvFDaqDirector::bumpFile(unsigned int& ls, unsigned int& index, std::string& nextFile, uint32_t& fsize, int maxLS) {
727 
728  if (previousFileSize_ != 0) {
729  if (!fms_) {
731  }
733  previousFileSize_ = 0;
734  }
735 
736  //reached limit
737  if (maxLS>=0 && ls > (unsigned int)maxLS) return false;
738 
739  struct stat buf;
740  std::stringstream ss;
741  unsigned int nextIndex = index;
742  nextIndex++;
743 
744  // 1. Check suggested file
745  nextFile = getInputJsonFilePath(ls,index);
746  if (stat(nextFile.c_str(), &buf) == 0) {
747 
748  previousFileSize_ = buf.st_size;
749  fsize = buf.st_size;
750  return true;
751  }
752  // 2. No file -> lumi ended? (and how many?)
753  else {
754  std::string BUEoLSFile = getEoLSFilePathOnBU(ls);
755  bool eolFound = (stat(BUEoLSFile.c_str(), &buf) == 0);
756  while (eolFound) {
757 
758  // recheck that no raw file appeared in the meantime
759  if (stat(nextFile.c_str(), &buf) == 0) {
760  previousFileSize_ = buf.st_size;
761  fsize = buf.st_size;
762  return true;
763  }
764 
765  int indexFilesInLS = getNFilesFromEoLS(BUEoLSFile);
766  if (indexFilesInLS < 0)
767  //parsing failed
768  return false;
769  else {
770  //check index
771  if ((int)index<indexFilesInLS) {
772  //we have 2 files, and check for 1 failed... retry (2 will never be here)
773  edm::LogError("EvFDaqDirector") << "Potential miss of index file in LS -: " << ls << ". Missing "
774  << nextFile << " because " << indexFilesInLS-1 << " is the highest index expected. Will not update fu.lock file";
775  return false;
776  }
777  }
778  // this lumi ended, check for files
779  ++ls;
780  index = 0;
781 
782  //reached limit
783  if (maxLS>=0 && ls > (unsigned int)maxLS) return false;
784 
785  nextFile = getInputJsonFilePath(ls,0);
786  if (stat(nextFile.c_str(), &buf) == 0) {
787  // a new file was found at new lumisection, index 0
788  previousFileSize_ = buf.st_size;
789  fsize = buf.st_size;
790  return true;
791  }
792  else {
793  //change of policy: we need to cycle through each LS
794  return false;
795  }
796  BUEoLSFile = getEoLSFilePathOnBU(ls);
797  eolFound = (stat(BUEoLSFile.c_str(), &buf) == 0);
798  }
799  }
800  // no new file found
801  return false;
802  }
803 
805  if (fu_rw_lock_stream == 0)
806  edm::LogError("EvFDaqDirector") << "Error creating fu read/write lock stream "
807  << strerror(errno);
808  else {
809  edm::LogInfo("EvFDaqDirector") << "Initializing FU LOCK FILE";
810  unsigned int readLs = 1, readIndex = 0;
811  fprintf(fu_rw_lock_stream, "%u %u", readLs, readIndex);
812  }
813  }
814 
816  if (create) {
817  fu_readwritelock_fd_ = open(fulockfile.c_str(), O_RDWR | O_CREAT,
818  S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);
819  chmod(fulockfile.c_str(),0766);
820  } else {
821  fu_readwritelock_fd_ = open(fulockfile.c_str(), O_RDWR, S_IRWXU);
822  }
823  if (fu_readwritelock_fd_ == -1)
824  edm::LogError("EvFDaqDirector") << "problem with creating filedesc for fuwritelock -: " << fulockfile.c_str()
825  << " create:" << create << " error:" << strerror(errno);
826  else
827  LogDebug("EvFDaqDirector") << "creating filedesc for fureadwritelock -: "
829 
830  fu_rw_lock_stream = fdopen(fu_readwritelock_fd_, "r+");
831  }
832 
833  //create if does not exist then lock the merge destination file
835  data_rw_stream = fopen(getMergedDatFilePath(ls,stream).c_str(), "a"); //open stream for appending
837  if (data_readwrite_fd_ == -1)
838  edm::LogError("EvFDaqDirector") << "problem with creating filedesc for datamerge "
839  << strerror(errno);
840  else
841  LogDebug("EvFDaqDirector") << "creating filedesc for datamerge -: "
843  fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_flk);
844 
845  return data_rw_stream;
846  }
847 
849  fflush(data_rw_stream);
850  fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_fulk);
851  fclose(data_rw_stream);
852  }
853 
855  pthread_mutex_lock(&init_lock_);
856  }
857 
859  pthread_mutex_unlock(&init_lock_);
860  }
861 
863  //fcntl(fulocal_rwlock_fd_, F_SETLKW, &fulocal_rw_flk);
864  flock(fulocal_rwlock_fd_,LOCK_SH);
865  }
866 
868  //fcntl(fulocal_rwlock_fd_, F_SETLKW, &fulocal_rw_fulk);
869  flock(fulocal_rwlock_fd_,LOCK_UN);
870  }
871 
872 
874  //fcntl(fulocal_rwlock_fd2_, F_SETLKW, &fulocal_rw_flk2);
875  flock(fulocal_rwlock_fd2_,LOCK_EX);
876  }
877 
879  //fcntl(fulocal_rwlock_fd2_, F_SETLKW, &fulocal_rw_fulk2);
880  flock(fulocal_rwlock_fd2_,LOCK_UN);
881  }
882 
883 
885  // create open dir if not already there
886 
888  if (!boost::filesystem::is_directory(openPath)) {
889  LogDebug("EvFDaqDirector") << "<open> FU dir not found. Creating... -:" << openPath.string();
890  boost::filesystem::create_directories(openPath);
891  }
892  }
893 
894 
896 
897  boost::filesystem::ifstream ij(file);
898  Json::Value deserializeRoot;
900 
901  if (!reader.parse(ij, deserializeRoot)) {
902  edm::LogError("EvFDaqDirector") << "Cannot deserialize input JSON file -:" << file;
903  return -1;
904  }
905 
906  int ret = deserializeRoot.get("lastLS","").asInt();
907  return ret;
908 
909  }
910 
911  //if transferSystem PSet is present in the menu, we require it to be complete and consistent for all specified streams
913  {
914  if(transferSystemJson_) return;
915 
916  transferSystemJson_.reset(new Json::Value);
918  if (topPset.existsAs<edm::ParameterSet>("transferSystem",true))
919  {
920  const edm::ParameterSet& tsPset(topPset.getParameterSet("transferSystem"));
921 
922  Json::Value destinationsVal(Json::arrayValue);
923  std::vector<std::string> destinations = tsPset.getParameter<std::vector<std::string>>("destinations");
924  for (auto & dest: destinations) destinationsVal.append(dest);
925  (*transferSystemJson_)["destinations"]=destinationsVal;
926 
927  Json::Value modesVal(Json::arrayValue);
928  std::vector<std::string> modes = tsPset.getParameter< std::vector<std::string> >("transferModes");
929  for (auto & mode: modes) modesVal.append(mode);
930  (*transferSystemJson_)["transferModes"]=modesVal;
931 
932  for (auto psKeyItr =tsPset.psetTable().begin();psKeyItr!=tsPset.psetTable().end(); ++ psKeyItr) {
933  if (psKeyItr->first!="destinations" && psKeyItr->first!="transferModes") {
934  const edm::ParameterSet & streamDef = tsPset.getParameterSet(psKeyItr->first);
935  Json::Value streamVal;
936  for (auto & mode : modes) {
937  //validation
938  if (!streamDef.existsAs<std::vector<std::string>>(mode,true))
939  throw cms::Exception("EvFDaqDirector") << " Missing transfer system specification for -:" << psKeyItr->first << " (transferMode " << mode << ")";
940  std::vector<std::string> streamDestinations = streamDef.getParameter<std::vector<std::string>>(mode);
941 
942  Json::Value sDestsValue(Json::arrayValue);
943 
944  if (!streamDestinations.size())
945  throw cms::Exception("EvFDaqDirector") << " Missing transter system destination(s) for -: "<< psKeyItr->first << ", mode:" << mode;
946 
947  for (auto & sdest:streamDestinations) {
948  bool sDestValid=false;
949  sDestsValue.append(sdest);
950  for (auto & dest: destinations) {
951  if (dest==sdest) sDestValid=true;
952  }
953  if (!sDestValid)
954  throw cms::Exception("EvFDaqDirector") << " Invalid transter system destination specified for -: "<< psKeyItr->first << ", mode:" << mode << ", dest:"<<sdest;
955  }
956  streamVal[mode]=sDestsValue;
957  }
958  (*transferSystemJson_)[psKeyItr->first] = streamVal;
959  }
960  }
961  }
962  else {
963  if (requireTSPSet_)
964  throw cms::Exception("EvFDaqDirector") << "transferSystem PSet not found";
965  }
966  }
967 
969  {
970  std::string streamRequestName;
971  if (transferSystemJson_->isMember(stream.c_str()))
972  streamRequestName = stream;
973  else {
974  std::stringstream msg;
975  msg << "Transfer system mode definitions missing for -: " << stream;
976  if (requireTSPSet_)
977  throw cms::Exception("EvFDaqDirector") << msg.str();
978  else {
979  edm::LogWarning("EvFDaqDirector") << msg.str() << " (permissive mode)";
980  return std::string("Failsafe");
981  }
982  }
983  //return empty if strict check parameter is not on
985  edm::LogWarning("EvFDaqDirector") << "Selected mode string is not provided as DaqDirector parameter."
986  << "Switch on requireTSPSet parameter to enforce this requirement. Setting mode to empty string.";
987  return std::string("Failsafe");
988  }
990  throw cms::Exception("EvFDaqDirector") << "Selected mode string is not provided as DaqDirector parameter.";
991  }
992  //check if stream has properly listed transfer stream
993  if (!transferSystemJson_->get(streamRequestName, "").isMember(selectedTransferMode_.c_str()))
994  {
995  std::stringstream msg;
996  msg << "Selected transfer mode " << selectedTransferMode_ << " is not specified for stream " << streamRequestName;
997  if (requireTSPSet_)
998  throw cms::Exception("EvFDaqDirector") << msg.str();
999  else
1000  edm::LogWarning("EvFDaqDirector") << msg.str() << " (permissive mode)";
1001  return std::string("Failsafe");
1002  }
1003  Json::Value destsVec = transferSystemJson_->get(streamRequestName, "").get(selectedTransferMode_,"");
1004 
1005  //flatten string json::Array into CSV std::string
1006  std::string ret;
1007  for (Json::Value::iterator it = destsVec.begin(); it!=destsVec.end(); it++)
1008  {
1009  if (ret!="") ret +=",";
1010  ret+=(*it).asString();
1011  }
1012  return ret;
1013  }
1014 
1016  {
1017  if (mergeTypePset_.empty()) return;
1018  if(mergeTypeMap_.size()) return;
1019  edm::ParameterSet const& topPset = edm::getParameterSet(pc.parameterSetID());
1020  if (topPset.existsAs<edm::ParameterSet>(mergeTypePset_,true))
1021  {
1022  const edm::ParameterSet& tsPset(topPset.getParameterSet(mergeTypePset_));
1023  for (std::string pname : tsPset.getParameterNames()) {
1024  std::string streamType = tsPset.getParameter<std::string>(pname);
1025  mergeTypeMap_[pname]=streamType;
1026  }
1027  }
1028  }
1029 
1031  {
1032  auto mergeTypeItr = mergeTypeMap_.find(stream.c_str());
1033  if (mergeTypeItr == mergeTypeMap_.end()) {
1034  edm::LogInfo("EvFDaqDirector") << " No merging type specified for stream " << stream << ". Using default value";
1035  assert(defaultType<MergeTypeNames_.size());
1036  std::string defaultName = MergeTypeNames_[defaultType];
1037  mergeTypeMap_[stream] = defaultName;
1038  return defaultName;
1039  }
1040  return mergeTypeItr->second;
1041  }
1042 
1044  std::string proc_flag = run_dir_ + "/processing";
1045  int proc_flag_fd = open(proc_flag.c_str(), O_RDWR | O_CREAT, S_IRWXU | S_IWGRP | S_IRGRP | S_IWOTH | S_IROTH);
1046  close(proc_flag_fd);
1047  }
1048 
1049 }
#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
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
std::string stopFilePathPid_
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_
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