70 std::atomic<std::uint_least64_t>
m_runs;
82 using namespace edm::service;
113 if (pset.
exists(
"updateIntervalSeconds"))
117 if (pset.
exists(
"EMAInterval"))
180 std::vector<edm::LuminosityBlockRange> toProcess = pset.
getUntrackedParameter<std::vector<LuminosityBlockRange> >(
"lumisToProcess", std::vector<LuminosityBlockRange>());
183 for (
auto const &range : toProcess)
185 if (range.startRun() != range.endRun()) {
break;}
187 lumiCount += (range.endLumi()-range.startLumi());
190 unsigned int eventsPerLumi = pset.
getUntrackedParameter<
unsigned int>(
"numberEventsInLuminosityBlock", 0);
191 if ((lumiCount == 0) && (maxEvents > 0) && (eventsPerLumi > 0))
193 lumiCount =
static_cast<unsigned int>(std::ceil(static_cast<float>(maxEvents) / static_cast<float>(eventsPerLumi)));
197 std::stringstream ss_max_files; ss_max_files << fileNames.size();
202 if (maxLumis < 0) {maxLumis = lumiCount;}
203 if (maxLumis > static_cast<int>(lumiCount))
205 maxLumis = lumiCount;
210 std::stringstream ss_max_events; ss_max_events <<
maxEvents;
215 std::stringstream ss_max_lumis; ss_max_lumis << maxLumis;
236 return getenv(
"_CONDOR_CHIRP_CONFIG") &&
updateChirp(
"Elapsed",
"0");
308 if (sinceLastUpdate > 0)
326 for (
const auto & storage : stats)
332 if (storage.first ==
token.value()) {
continue;}
333 for (
const auto &
counter : storage.second)
337 readOps +=
counter.second.successes;
339 readBytes +=
counter.second.amount;
340 readTimeTotal +=
counter.second.timeTotal;
344 readVOps +=
counter.second.successes;
345 readSegs +=
counter.second.vector_count;
346 readBytes +=
counter.second.amount;
347 readTimeTotal +=
counter.second.timeTotal;
351 writeBytes +=
counter.second.amount;
352 writeTimeTotal +=
counter.second.timeTotal;
360 updateChirp(
"ReadTimeMsecs", readTimeTotal/(1000*1000));
362 updateChirp(
"WriteTimeMsecs", writeTimeTotal/(1000*1000));
366 template<
typename T>
bool
369 std::stringstream
ss; ss <<
value;
377 std::stringstream
ss; ss <<
"ChirpCMSSW" <<
m_tag << key_suffix;
381 std::cout <<
"condor_chirp set_job_attr_delayed " << key <<
" " << value << std::endl;
384 posix_spawn_file_actions_t file_actions;
385 int devnull_fd = open(
"/dev/null", O_RDWR);
386 if (devnull_fd == -1) {
return false;}
387 posix_spawn_file_actions_init(&file_actions);
388 posix_spawn_file_actions_adddup2(&file_actions, devnull_fd, 1);
389 posix_spawn_file_actions_adddup2(&file_actions, devnull_fd, 2);
391 const std::string set_job_attr =
"set_job_attr_delayed";
392 std::vector<const char *>
argv;
393 argv.push_back(chirp_name.c_str());
394 argv.push_back(set_job_attr.c_str());
395 argv.push_back(key.c_str());
396 argv.push_back(value.c_str());
397 argv.push_back(
NULL);
398 int status = posix_spawnp(&pid,
"condor_chirp", &file_actions,
NULL, const_cast<char* const*>(&argv[0]), environ);
400 posix_spawn_file_actions_destroy(&file_actions);
405 while ((waitpid(pid, &status, 0) == -1) && errno == -EINTR) {}
414 desc.
setComment(
"Service to update HTCondor with the current CMSSW status.");
416 ->setComment(
"Interval, in seconds, for HTCondor updates");
418 ->setComment(
"Enable debugging of this service");
420 ->setComment(
"Interval, in seconds, to calculate event rate over (using EMA)");
422 ->setComment(
"Identifier tag for this process (a value of 'Foo' results in ClassAd attributes of the form 'ChirpCMSSWFoo*')");
423 descriptions.
add(
"CondorStatusService", desc);
std::atomic< time_t > m_lastUpdate
static float m_defaultEmaInterval
T getUntrackedParameter(std::string const &, T const &) const
CondorStatusService(ParameterSet const &pset, edm::ActivityRegistry &ar)
void preSourceConstruction(ModuleDescription const &md, int maxEvents, int maxLumis, int maxSecondsUntilRampdown)
#define DEFINE_FWK_SERVICE_MAKER(concrete, maker)
void runPost(GlobalContext const &)
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void beginPre(PathsAndConsumesOfModulesBase const &, ProcessContext const &processContext)
void updateImpl(time_t secsSinceLastUpdate)
std::atomic< std::uint_least64_t > m_events
edm::serviceregistry::AllArgsMaker< edm::service::CondorStatusService > CondorStatusServiceMaker
ParameterSet const & getParameterSet(ParameterSetID const &id)
void watchPostEvent(PostEvent::slot_type const &iSlot)
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
static const StorageStats & summary(void)
void lumiPost(GlobalContext const &)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
std::atomic< std::uint_least64_t > m_lumis
ParameterSetID const & parameterSetID() const
void setComment(std::string const &value)
void watchPostCloseFile(PostCloseFile::slot_type const &iSlot)
static StorageClassToken tokenForStorageClassName(std::string const &iName)
CondorStatusService & operator=(const CondorStatusService &)=delete
std::atomic< std::uint_least64_t > m_runs
void watchPostGlobalEndLumi(PostGlobalEndLumi::slot_type const &iSlot)
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
std::uint_least64_t m_lastEventCount
void eventPost(StreamContext const &iContext)
unsigned long long uint64_t
ParameterSet const & getParameterSet(std::string const &) const
void watchPostGlobalEndRun(PostGlobalEndRun::slot_type const &iSlot)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void watchPreBeginJob(PreBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
static unsigned int m_defaultUpdateInterval
edm::ParameterSetID m_processParameterSetID
bool updateChirp(const std::string &key_suffix, const T &value)
static std::atomic< unsigned int > counter
std::vector< EventRange > & sortAndRemoveOverlaps(std::vector< EventRange > &eventRange)
std::atomic_flag m_shouldUpdate
ParameterDescriptionBase * addOptionalUntracked(U const &iLabel, T const &value)
volatile std::atomic< bool > shutdown_flag false
static void fillDescriptions(ConfigurationDescriptions &descriptions)
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)