Don't monitor jobs with +NoMonitoring=true.

This commit is contained in:
Joachim Meyer 2024-07-03 14:06:58 -07:00
parent 0a70035977
commit e7f54aa1b7

View File

@ -13,6 +13,7 @@
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <condition_variable> #include <condition_variable>
#include <cstddef>
#include <cstdlib> #include <cstdlib>
#include <ctime> #include <ctime>
#include <deque> #include <deque>
@ -379,6 +380,15 @@ void CCSyncPlugin::sendPostRequest(const std::string &route,
} }
} }
bool toBool(const std::string &value) {
if (std::atoi(value.c_str()))
return true;
std::string lower;
std::transform(value.begin(), value.end(), std::back_inserter(lower),
::tolower);
return lower == "true" || lower == "yes" || lower == "on";
}
void CCSyncPlugin::endTransaction() { void CCSyncPlugin::endTransaction() {
if (initializing) { // HTCondor bug? We should'n be receiving events before if (initializing) { // HTCondor bug? We should'n be receiving events before
// initialization is done. We will ignore them if it // initialization is done. We will ignore them if it
@ -412,6 +422,13 @@ void CCSyncPlugin::endTransaction() {
continue; continue;
} else } else
continue; continue;
if (auto noMonitoringIt = job.find("NoMonitoring");
noMonitoringIt != job.end() && toBool(noMonitoringIt->second)) {
dprintf(D_VERBOSE,
"Upon NoMonitoring ClassAd, not monitoring job %d.%d\n",
jobId.first, jobId.second);
continue;
}
if (state == RUNNING) { if (state == RUNNING) {
auto jobBatchNameIt = job.find("JobBatchName"); auto jobBatchNameIt = job.find("JobBatchName");