CMS 3D CMS Logo

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