Skip to content

Commit

Permalink
Merge pull request #4762 from smorovic/run-dir-check-71X
Browse files Browse the repository at this point in the history
Run dir check fix for 71X
  • Loading branch information
davidlange6 committed Jul 24, 2014
2 parents 44388e1 + c99aa0e commit 00b85a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions EventFilter/Utilities/plugins/RecoEventOutputModuleForFU.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ namespace evf {
// create open dir if not already there
edm::Service<evf::EvFDaqDirector>()->createRunOpendirMaybe();

//replace hltOutoputA with stream if the HLT menu uses this convention
std::string testPrefix="hltOutput";
if (stream_label_.find(testPrefix)==0)
stream_label_=std::string("stream")+stream_label_.substr(testPrefix.size());

fms_ = (evf::FastMonitoringService *)(edm::Service<evf::MicroStateService>().operator->());

processed_.setName("Processed");
Expand Down Expand Up @@ -203,6 +208,7 @@ namespace evf {
fread(outBuf_,toRead,1,src);
fwrite(outBuf_,toRead,1,des);
readInput+=toRead;
filesize+=toRead;
}

//if(des != 0 && src !=0){
Expand Down
16 changes: 16 additions & 0 deletions EventFilter/Utilities/src/EvFDaqDirector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,25 @@ namespace evf {
EvFDaqDirector::FileStatus fileStatus = noFile;

int retval = -1;
int lock_attempts = 0;

while (retval==-1) {
retval = fcntl(fu_readwritelock_fd_, F_SETLK, &fu_rw_flk);
if (retval==-1) usleep(50000);
else continue;

lock_attempts++;
if (lock_attempts>100 || errno==116) {
if (errno==116)
edm::LogWarning("EvFDaqDirector") << "Stale lock file handle. Checking if run directory and fu.lock file are present" << std::endl;
else
edm::LogWarning("EvFDaqDirector") << "Unable to obtain a lock for 5 seconds. Checking if run directory and fu.lock file are present -: errno "<< errno <<":"<< strerror(errno) << std::endl;

struct stat buf;
if (stat(bu_run_dir_.c_str(), &buf)!=0) return runEnded;
if (stat((bu_run_dir_+"/fu.lock").c_str(), &buf)!=0) return runEnded;
lock_attempts=0;
}
}
if(retval!=0) return fileStatus;

Expand Down

0 comments on commit 00b85a7

Please sign in to comment.