CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
edm::service::CondorStatusService Class Reference

Public Member Functions

 CondorStatusService (ParameterSet const &pset, edm::ActivityRegistry &ar)
 
 CondorStatusService (const CondorStatusService &)=delete
 
CondorStatusServiceoperator= (const CondorStatusService &)=delete
 
 ~CondorStatusService ()
 

Static Public Member Functions

static void fillDescriptions (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginPost ()
 
void beginPre (PathsAndConsumesOfModulesBase const &, ProcessContext const &processContext)
 
void endPost ()
 
void eventPost (StreamContext const &iContext)
 
void filePost (std::string const &, bool)
 
void firstUpdate ()
 
bool isChirpSupported ()
 
void lastUpdate ()
 
void lumiPost (GlobalContext const &)
 
void preSourceConstruction (ModuleDescription const &md, int maxEvents, int maxLumis, int maxSecondsUntilRampdown)
 
void runPost (GlobalContext const &)
 
void update ()
 
template<typename T >
bool updateChirp (const std::string &key_suffix, const T &value)
 
bool updateChirpImpl (std::string const &key, std::string const &value)
 
bool updateChirpQuoted (const std::string &key_suffix, const std::string &value)
 
void updateImpl (time_t secsSinceLastUpdate)
 

Private Attributes

time_t m_beginJob = 0
 
bool m_debug
 
float m_emaInterval = m_defaultEmaInterval
 
std::atomic< std::uint_least64_t > m_events
 
std::atomic< std::uint_least64_t > m_files
 
std::uint_least64_t m_lastEventCount = 0
 
std::atomic< time_t > m_lastUpdate
 
std::atomic< std::uint_least64_t > m_lumis
 
edm::ParameterSetID m_processParameterSetID
 
float m_rate = 0
 
std::atomic< std::uint_least64_t > m_runs
 
std::atomic_flag m_shouldUpdate
 
std::string m_tag
 
time_t m_updateInterval = m_defaultUpdateInterval
 

Static Private Attributes

static float m_defaultEmaInterval = 15 * 60
 
static unsigned int m_defaultUpdateInterval = 3 * 60
 

Detailed Description

Definition at line 35 of file CondorStatusUpdater.cc.

Constructor & Destructor Documentation

CondorStatusService::CondorStatusService ( ParameterSet const &  pset,
edm::ActivityRegistry ar 
)
explicit

Definition at line 92 of file CondorStatusUpdater.cc.

References beginPost(), beginPre(), endPost(), eventPost(), edm::ParameterSet::exists(), filePost(), firstUpdate(), edm::ParameterSet::getUntrackedParameter(), isChirpSupported(), lumiPost(), m_debug, m_emaInterval, m_shouldUpdate, m_tag, m_updateInterval, runPost(), AlCaHLTBitMon_QueryRunRegistry::string, edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostCloseFile(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostEvent(), edm::ActivityRegistry::watchPostGlobalEndLumi(), edm::ActivityRegistry::watchPostGlobalEndRun(), and edm::ActivityRegistry::watchPreBeginJob().

Referenced by ~CondorStatusService().

93  : m_debug(false), m_lastUpdate(0), m_events(0), m_lumis(0), m_runs(0), m_files(0) {
94  m_shouldUpdate.clear();
95  if (pset.exists("debug")) {
96  m_debug = true;
97  }
98  if (!isChirpSupported()) {
99  return;
100  }
101 
102  firstUpdate();
103 
111 
112  if (pset.exists("updateIntervalSeconds")) {
113  m_updateInterval = pset.getUntrackedParameter<unsigned int>("updateIntervalSeconds");
114  }
115  if (pset.exists("EMAInterval")) {
116  m_emaInterval = pset.getUntrackedParameter<double>("EMAInterval");
117  }
118  if (pset.exists("tag")) {
119  m_tag = pset.getUntrackedParameter<std::string>("tag");
120  }
121 }
void runPost(GlobalContext const &)
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void beginPre(PathsAndConsumesOfModulesBase const &, ProcessContext const &processContext)
std::atomic< std::uint_least64_t > m_events
void watchPostEvent(PostEvent::slot_type const &iSlot)
void lumiPost(GlobalContext const &)
std::atomic< std::uint_least64_t > m_lumis
void watchPostCloseFile(PostCloseFile::slot_type const &iSlot)
std::atomic< std::uint_least64_t > m_runs
void watchPostGlobalEndLumi(PostGlobalEndLumi::slot_type const &iSlot)
void eventPost(StreamContext const &iContext)
void watchPostGlobalEndRun(PostGlobalEndRun::slot_type const &iSlot)
void watchPreBeginJob(PreBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
std::atomic< std::uint_least64_t > m_files
void filePost(std::string const &, bool)
edm::service::CondorStatusService::~CondorStatusService ( )
inline
edm::service::CondorStatusService::CondorStatusService ( const CondorStatusService )
delete

Member Function Documentation

void CondorStatusService::beginPost ( )
private

Definition at line 149 of file CondorStatusUpdater.cc.

References LaserTracksInput_cfi::fileNames, edm::ParameterSet::getParameterSet(), edm::getParameterSet(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), m_beginJob, m_processParameterSetID, Data_TkAlMinBias_Run2018C_PromptReco_v3_cff::maxEvents, edm::LuminosityBlockID::maxLuminosityBlockNumber(), cmsPerfSuiteHarvest::now, muonDTDigis_cfi::pset, edm::sortAndRemoveOverlaps(), update(), and updateChirp().

Referenced by CondorStatusService(), and ~CondorStatusService().

149  {
150  ParameterSet const &processParameterSet = edm::getParameterSet(m_processParameterSetID);
151  const edm::ParameterSet &pset = processParameterSet.getParameterSet("@main_input");
152  // PSet info from edm::ScheduleItems
153  int maxEvents =
154  processParameterSet.getUntrackedParameterSet("maxEvents", ParameterSet()).getUntrackedParameter<int>("input", -1);
155  int maxLumis = processParameterSet.getUntrackedParameterSet("maxLuminosityBlocks", ParameterSet())
156  .getUntrackedParameter<int>("input", -1);
157 
158  // lumisToProcess from EventSkipperByID (PoolSource and similar)
159  std::vector<edm::LuminosityBlockRange> toProcess = pset.getUntrackedParameter<std::vector<LuminosityBlockRange>>(
160  "lumisToProcess", std::vector<LuminosityBlockRange>());
161  edm::sortAndRemoveOverlaps(toProcess);
162  uint64_t lumiCount = 0;
163  for (auto const &range : toProcess) {
164  if (range.startRun() != range.endRun()) {
165  break;
166  }
167  if (range.endLumi() >= edm::LuminosityBlockID::maxLuminosityBlockNumber()) {
168  break;
169  }
170  lumiCount += (range.endLumi() - range.startLumi());
171  }
172  // Handle sources deriving from ProducerSourceBase
173  unsigned int eventsPerLumi = pset.getUntrackedParameter<unsigned int>("numberEventsInLuminosityBlock", 0);
174  if ((lumiCount == 0) && (maxEvents > 0) && (eventsPerLumi > 0)) {
175  lumiCount = static_cast<unsigned int>(std::ceil(static_cast<float>(maxEvents) / static_cast<float>(eventsPerLumi)));
176  }
177 
178  std::vector<std::string> fileNames =
179  pset.getUntrackedParameter<std::vector<std::string>>("fileNames", std::vector<std::string>());
180  std::stringstream ss_max_files;
181  ss_max_files << fileNames.size();
182  updateChirp("MaxFiles", ss_max_files.str());
183 
184  if (lumiCount > 0) {
185  if (maxLumis < 0) {
186  maxLumis = lumiCount;
187  }
188  if (maxLumis > static_cast<int>(lumiCount)) {
189  maxLumis = lumiCount;
190  }
191  }
192  if (maxEvents > 0) {
193  std::stringstream ss_max_events;
194  ss_max_events << maxEvents;
195  updateChirp("MaxEvents", ss_max_events.str());
196  }
197  if (maxLumis > 0) {
198  std::stringstream ss_max_lumis;
199  ss_max_lumis << maxLumis;
200  updateChirp("MaxLumis", ss_max_lumis.str());
201  }
202 
203  m_beginJob = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
204  update();
205 }
T getUntrackedParameter(std::string const &, T const &) const
ParameterSet const & getParameterSet(ParameterSetID const &id)
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
unsigned long long uint64_t
Definition: Time.h:15
bool updateChirp(const std::string &key_suffix, const T &value)
std::vector< EventRange > & sortAndRemoveOverlaps(std::vector< EventRange > &eventRange)
Definition: EventRange.cc:102
void CondorStatusService::beginPre ( PathsAndConsumesOfModulesBase const &  ,
ProcessContext const &  processContext 
)
private

Definition at line 143 of file CondorStatusUpdater.cc.

References edm::Hash< I >::isValid(), m_processParameterSetID, and edm::ProcessContext::parameterSetID().

Referenced by CondorStatusService(), and ~CondorStatusService().

143  {
145  m_processParameterSetID = processContext.parameterSetID();
146  }
147 }
bool isValid() const
Definition: Hash.h:154
void CondorStatusService::endPost ( )
private

Definition at line 207 of file CondorStatusUpdater.cc.

References lastUpdate().

Referenced by CondorStatusService(), and ~CondorStatusService().

void CondorStatusService::eventPost ( StreamContext const &  iContext)
private

Definition at line 123 of file CondorStatusUpdater.cc.

References m_events, and update().

Referenced by CondorStatusService(), and ~CondorStatusService().

123  {
124  m_events++;
125  update();
126 }
std::atomic< std::uint_least64_t > m_events
void CondorStatusService::filePost ( std::string const &  ,
bool   
)
private

Definition at line 138 of file CondorStatusUpdater.cc.

References m_files, and update().

Referenced by CondorStatusService(), and ~CondorStatusService().

138  {
139  m_files++;
140  update();
141 }
std::atomic< std::uint_least64_t > m_files
void CondorStatusService::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 407 of file CondorStatusUpdater.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addOptionalUntracked(), m_defaultEmaInterval, m_defaultUpdateInterval, edm::ParameterSetDescription::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~CondorStatusService().

407  {
409  desc.setComment("Service to update HTCondor with the current CMSSW status.");
410  desc.addOptionalUntracked<unsigned int>("updateIntervalSeconds", m_defaultUpdateInterval)
411  ->setComment("Interval, in seconds, for HTCondor updates");
412  desc.addOptionalUntracked<bool>("debug", false)->setComment("Enable debugging of this service");
413  desc.addOptionalUntracked<double>("EMAInterval", m_defaultEmaInterval)
414  ->setComment("Interval, in seconds, to calculate event rate over (using EMA)");
415  desc.addOptionalUntracked<std::string>("tag")->setComment(
416  "Identifier tag for this process (a value of 'Foo' results in ClassAd attributes of the form 'ChirpCMSSWFoo*')");
417  descriptions.add("CondorStatusService", desc);
418 }
void CondorStatusService::firstUpdate ( )
private

Definition at line 217 of file CondorStatusUpdater.cc.

References edm::CPUServiceBase::cpuInfo(), edm::Service< T >::isAvailable(), AlCaHLTBitMon_QueryRunRegistry::string, updateChirp(), updateChirpQuoted(), and updateImpl().

Referenced by CondorStatusService(), and ~CondorStatusService().

217  {
218  // Note we always update all our statistics to 0 / false / -1
219  // This allows us to overwrite the activities of a previous cmsRun process
220  // within this HTCondor job.
221  updateImpl(0);
222  updateChirp("MaxFiles", "-1");
223  updateChirp("MaxEvents", "-1");
224  updateChirp("MaxLumis", "-1");
225  updateChirp("Done", "false");
226 
229  double avgSpeed;
230  if (cpusvc.isAvailable() && cpusvc->cpuInfo(models, avgSpeed)) {
231  updateChirpQuoted("CPUModels", models);
232  updateChirp("CPUSpeed", avgSpeed);
233  }
234 }
virtual bool cpuInfo(std::string &models, double &avgSpeed)=0
CPU information - the models present and average speed.
void updateImpl(time_t secsSinceLastUpdate)
Definition: models.py:1
bool updateChirpQuoted(const std::string &key_suffix, const std::string &value)
bool isAvailable() const
Definition: Service.h:40
bool updateChirp(const std::string &key_suffix, const T &value)
bool CondorStatusService::isChirpSupported ( )
private

Definition at line 209 of file CondorStatusUpdater.cc.

References m_debug, and updateChirp().

Referenced by CondorStatusService(), and ~CondorStatusService().

209  {
210  if (m_debug) {
211  return true;
212  }
213 
214  return getenv("_CONDOR_CHIRP_CONFIG") && updateChirp("Elapsed", "0");
215 }
bool updateChirp(const std::string &key_suffix, const T &value)
void CondorStatusService::lastUpdate ( )
private

Definition at line 236 of file CondorStatusUpdater.cc.

References gather_cfg::cout, edm::Service< T >::isAvailable(), m_lastUpdate, cmsPerfSuiteHarvest::now, updateChirp(), and updateImpl().

Referenced by endPost(), and ~CondorStatusService().

236  {
237  time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
238  updateImpl(now - m_lastUpdate);
239  updateChirp("Done", "true");
241  if (!cpusvc.isAvailable()) {
242  std::cout << "At post, CPU service is NOT available.\n";
243  }
244 }
void updateImpl(time_t secsSinceLastUpdate)
bool isAvailable() const
Definition: Service.h:40
bool updateChirp(const std::string &key_suffix, const T &value)
void CondorStatusService::lumiPost ( GlobalContext const &  )
private

Definition at line 128 of file CondorStatusUpdater.cc.

References m_lumis, and update().

Referenced by CondorStatusService(), and ~CondorStatusService().

128  {
129  m_lumis++;
130  update();
131 }
std::atomic< std::uint_least64_t > m_lumis
CondorStatusService& edm::service::CondorStatusService::operator= ( const CondorStatusService )
delete

Referenced by ~CondorStatusService().

void edm::service::CondorStatusService::preSourceConstruction ( ModuleDescription const &  md,
int  maxEvents,
int  maxLumis,
int  maxSecondsUntilRampdown 
)
private

Referenced by ~CondorStatusService().

void CondorStatusService::runPost ( GlobalContext const &  )
private

Definition at line 133 of file CondorStatusUpdater.cc.

References m_runs, and update().

Referenced by CondorStatusService(), and ~CondorStatusService().

133  {
134  m_runs++;
135  update();
136 }
std::atomic< std::uint_least64_t > m_runs
void CondorStatusService::update ( )
inlineprivate

Definition at line 246 of file CondorStatusUpdater.cc.

References m_lastUpdate, m_shouldUpdate, m_updateInterval, cmsPerfSuiteHarvest::now, and updateImpl().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), beginPost(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), eventPost(), filePost(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), lumiPost(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), runPost(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), Vispa.Gui.PortConnection.PointToPointConnection::updateConnection(), and ~CondorStatusService().

246  {
247  time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
248  if ((now - m_lastUpdate.load(std::memory_order_relaxed)) > m_updateInterval) {
249  if (!m_shouldUpdate.test_and_set(std::memory_order_acquire)) {
250  try {
251  time_t sinceLastUpdate = now - m_lastUpdate;
252  m_lastUpdate = now;
253  updateImpl(sinceLastUpdate);
254  m_shouldUpdate.clear(std::memory_order_release);
255  } catch (...) {
256  m_shouldUpdate.clear(std::memory_order_release);
257  throw;
258  }
259  }
260  }
261 }
void updateImpl(time_t secsSinceLastUpdate)
template<typename T >
bool CondorStatusService::updateChirp ( const std::string &  key_suffix,
const T value 
)
private

Definition at line 354 of file CondorStatusUpdater.cc.

References updateChirpImpl(), and relativeConstraints::value.

Referenced by beginPost(), firstUpdate(), isChirpSupported(), lastUpdate(), updateImpl(), and ~CondorStatusService().

354  {
355  std::stringstream ss;
356  ss << value;
357  return updateChirpImpl(key_suffix, ss.str());
358 }
bool updateChirpImpl(std::string const &key, std::string const &value)
bool CondorStatusService::updateChirpImpl ( std::string const &  key,
std::string const &  value 
)
private

Definition at line 372 of file CondorStatusUpdater.cc.

References cmsBatch::argv, gather_cfg::cout, crabWrapper::key, m_debug, m_tag, sysUtil::pid, mps_update::status, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by updateChirp(), updateChirpQuoted(), and ~CondorStatusService().

372  {
373  std::stringstream ss;
374  ss << "ChirpCMSSW" << m_tag << key_suffix;
375  std::string key = ss.str();
376  if (m_debug) {
377  std::cout << "condor_chirp set_job_attr_delayed " << key << " " << value << std::endl;
378  }
379  int pid = 0;
380  posix_spawn_file_actions_t file_actions;
381  int devnull_fd = open("/dev/null", O_RDWR);
382  if (devnull_fd == -1) {
383  return false;
384  }
385  posix_spawn_file_actions_init(&file_actions);
386  posix_spawn_file_actions_adddup2(&file_actions, devnull_fd, 1);
387  posix_spawn_file_actions_adddup2(&file_actions, devnull_fd, 2);
388  const std::string chirp_name = "condor_chirp";
389  const std::string set_job_attr = "set_job_attr_delayed";
390  std::vector<const char *> argv;
391  argv.push_back(chirp_name.c_str());
392  argv.push_back(set_job_attr.c_str());
393  argv.push_back(key.c_str());
394  argv.push_back(value.c_str());
395  argv.push_back(nullptr);
396  int status = posix_spawnp(&pid, "condor_chirp", &file_actions, nullptr, const_cast<char *const *>(&argv[0]), environ);
397  close(devnull_fd);
398  posix_spawn_file_actions_destroy(&file_actions);
399  if (status) {
400  return false;
401  }
402  while ((waitpid(pid, &status, 0) == -1) && errno == -EINTR) {
403  }
404  return status == 0;
405 }
Definition: value.py:1
bool CondorStatusService::updateChirpQuoted ( const std::string &  key_suffix,
const std::string &  value 
)
private

Definition at line 360 of file CondorStatusUpdater.cc.

References EnergyCorrector::c, AlCaHLTBitMon_QueryRunRegistry::string, updateChirpImpl(), and relativeConstraints::value.

Referenced by firstUpdate(), and ~CondorStatusService().

360  {
361  std::string value_copy = value;
362  // Remove double-quotes or the \ character (as it has special escaping semantics in ClassAds).
363  // Make sure we have ASCII characters.
364  // Otherwise, remainder is allowed (including tabs, newlines, single-quotes).
365  value_copy.erase(
366  remove_if(
367  value_copy.begin(), value_copy.end(), [](const char &c) { return !isascii(c) || (c == '"') || (c == '\\'); }),
368  value_copy.end());
369  return updateChirpImpl(key_suffix, "\"" + value_copy + "\"");
370 }
bool updateChirpImpl(std::string const &key, std::string const &value)
void CondorStatusService::updateImpl ( time_t  secsSinceLastUpdate)
private

Definition at line 263 of file CondorStatusUpdater.cc.

References XrdAdaptor::XrdStatisticsService::condorUpdate(), JetChargeProducer_cfi::exp, f, edm::TimingServiceBase::getTotalCPU(), edm::Service< T >::isAvailable(), m_beginJob, m_emaInterval, m_events, m_files, m_lastEventCount, m_lumis, m_rate, m_runs, SiStripPI::max, min(), cmsPerfSuiteHarvest::now, StorageAccount::read, StorageAccount::readv, AlCaHLTBitMon_QueryRunRegistry::string, StorageAccount::summary(), StorageAccount::tokenForStorageClassName(), updateChirp(), StorageAccount::write, and StorageAccount::writev.

Referenced by firstUpdate(), lastUpdate(), update(), and ~CondorStatusService().

263  {
264  time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
265  time_t jobTime = now - m_beginJob;
266 
268  if (timingsvc.isAvailable()) {
269  updateChirp("TotalCPU", timingsvc->getTotalCPU());
270  }
271 
272  updateChirp("LastUpdate", now);
273 
274  if (!m_events || (m_events > m_lastEventCount)) {
275  updateChirp("Events", m_events);
276  }
277 
278  updateChirp("Lumis", m_lumis);
279 
280  updateChirp("Runs", m_runs);
281 
282  updateChirp("Files", m_files);
283 
284  float ema_coeff = 1 - std::exp(-static_cast<float>(sinceLastUpdate) /
285  std::max(std::min(m_emaInterval, static_cast<float>(jobTime)), 1.0f));
286  if (sinceLastUpdate > 0) {
287  updateChirp("Elapsed", jobTime);
288  m_rate = ema_coeff * static_cast<float>(m_events - m_lastEventCount) / static_cast<float>(sinceLastUpdate) +
289  (1.0 - ema_coeff) * m_rate;
291  updateChirp("EventRate", m_rate);
292  }
293 
294  // If Xrootd was used, pull the statistics from there.
296  if (xrdsvc.isAvailable()) {
297  for (auto const &iter : xrdsvc->condorUpdate()) {
298  std::string site = iter.first;
299  site.erase(std::remove_if(site.begin(), site.end(), [](char x) { return !isalnum(x) && (x != '_'); }),
300  site.end());
301  auto &iostats = iter.second;
302  updateChirp("IOSite_" + site + "_ReadBytes", iostats.bytesRead);
303  updateChirp("IOSite_" + site + "_ReadTimeMS",
304  std::chrono::duration_cast<std::chrono::milliseconds>(iostats.transferTime).count());
305  }
306  }
307 
308  // Update storage account information
309  auto const &stats = StorageAccount::summary();
310  uint64_t readOps = 0;
311  uint64_t readVOps = 0;
312  uint64_t readSegs = 0;
313  uint64_t readBytes = 0;
314  uint64_t readTimeTotal = 0;
315  uint64_t writeBytes = 0;
316  uint64_t writeTimeTotal = 0;
317  const auto token = StorageAccount::tokenForStorageClassName("tstoragefile");
318  for (const auto &storage : stats) {
319  // StorageAccount records statistics for both the TFile layer and the
320  // StorageFactory layer. However, the StorageFactory statistics tend to
321  // be more accurate as various backends may alter the incoming read requests
322  // (such as when lazy-download is used).
323  if (storage.first == token.value()) {
324  continue;
325  }
326  for (const auto &counter : storage.second) {
327  if (counter.first == static_cast<int>(StorageAccount::Operation::read)) {
328  readOps += counter.second.successes;
329  readSegs++;
330  readBytes += counter.second.amount;
331  readTimeTotal += counter.second.timeTotal;
332  } else if (counter.first == static_cast<int>(StorageAccount::Operation::readv)) {
333  readVOps += counter.second.successes;
334  readSegs += counter.second.vector_count;
335  readBytes += counter.second.amount;
336  readTimeTotal += counter.second.timeTotal;
337  } else if ((counter.first == static_cast<int>(StorageAccount::Operation::write)) ||
338  (counter.first == static_cast<int>(StorageAccount::Operation::writev))) {
339  writeBytes += counter.second.amount;
340  writeTimeTotal += counter.second.timeTotal;
341  }
342  }
343  }
344  updateChirp("ReadOps", readOps);
345  updateChirp("ReadVOps", readVOps);
346  updateChirp("ReadSegments", readSegs);
347  updateChirp("ReadBytes", readBytes);
348  updateChirp("ReadTimeMsecs", readTimeTotal / (1000 * 1000));
349  updateChirp("WriteBytes", writeBytes);
350  updateChirp("WriteTimeMsecs", writeTimeTotal / (1000 * 1000));
351 }
std::atomic< std::uint_least64_t > m_events
static const StorageStats & summary(void)
std::atomic< std::uint_least64_t > m_lumis
std::vector< std::pair< std::string, CondorIOStats > > condorUpdate()
static StorageClassToken tokenForStorageClassName(std::string const &iName)
std::atomic< std::uint_least64_t > m_runs
bool isAvailable() const
Definition: Service.h:40
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
virtual double getTotalCPU() const =0
unsigned long long uint64_t
Definition: Time.h:15
bool updateChirp(const std::string &key_suffix, const T &value)
std::atomic< std::uint_least64_t > m_files

Member Data Documentation

time_t edm::service::CondorStatusService::m_beginJob = 0
private

Definition at line 66 of file CondorStatusUpdater.cc.

Referenced by beginPost(), and updateImpl().

bool edm::service::CondorStatusService::m_debug
private

Definition at line 64 of file CondorStatusUpdater.cc.

Referenced by CondorStatusService(), isChirpSupported(), and updateChirpImpl().

float CondorStatusService::m_defaultEmaInterval = 15 * 60
staticprivate

Definition at line 70 of file CondorStatusUpdater.cc.

Referenced by fillDescriptions().

const unsigned int CondorStatusService::m_defaultUpdateInterval = 3 * 60
staticprivate

Definition at line 71 of file CondorStatusUpdater.cc.

Referenced by fillDescriptions().

float edm::service::CondorStatusService::m_emaInterval = m_defaultEmaInterval
private

Definition at line 68 of file CondorStatusUpdater.cc.

Referenced by CondorStatusService(), and updateImpl().

std::atomic<std::uint_least64_t> edm::service::CondorStatusService::m_events
private

Definition at line 73 of file CondorStatusUpdater.cc.

Referenced by eventPost(), and updateImpl().

std::atomic<std::uint_least64_t> edm::service::CondorStatusService::m_files
private

Definition at line 76 of file CondorStatusUpdater.cc.

Referenced by filePost(), and updateImpl().

std::uint_least64_t edm::service::CondorStatusService::m_lastEventCount = 0
private

Definition at line 80 of file CondorStatusUpdater.cc.

Referenced by updateImpl().

std::atomic<time_t> edm::service::CondorStatusService::m_lastUpdate
private

Definition at line 72 of file CondorStatusUpdater.cc.

Referenced by lastUpdate(), and update().

std::atomic<std::uint_least64_t> edm::service::CondorStatusService::m_lumis
private

Definition at line 74 of file CondorStatusUpdater.cc.

Referenced by lumiPost(), and updateImpl().

edm::ParameterSetID edm::service::CondorStatusService::m_processParameterSetID
private

Definition at line 78 of file CondorStatusUpdater.cc.

Referenced by beginPost(), and beginPre().

float edm::service::CondorStatusService::m_rate = 0
private

Definition at line 69 of file CondorStatusUpdater.cc.

Referenced by updateImpl().

std::atomic<std::uint_least64_t> edm::service::CondorStatusService::m_runs
private

Definition at line 75 of file CondorStatusUpdater.cc.

Referenced by runPost(), and updateImpl().

std::atomic_flag edm::service::CondorStatusService::m_shouldUpdate
private

Definition at line 65 of file CondorStatusUpdater.cc.

Referenced by CondorStatusService(), and update().

std::string edm::service::CondorStatusService::m_tag
private

Definition at line 77 of file CondorStatusUpdater.cc.

Referenced by CondorStatusService(), and updateChirpImpl().

time_t edm::service::CondorStatusService::m_updateInterval = m_defaultUpdateInterval
private

Definition at line 67 of file CondorStatusUpdater.cc.

Referenced by CondorStatusService(), and update().