From e7f54aa1b756c6ecaa599e39c0bde709d8c4e4c7 Mon Sep 17 00:00:00 2001 From: Joachim Meyer Date: Wed, 3 Jul 2024 14:06:58 -0700 Subject: [PATCH] Don't monitor jobs with `+NoMonitoring=true`. --- src/htcondor_cc_sync_plugin.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/htcondor_cc_sync_plugin.cpp b/src/htcondor_cc_sync_plugin.cpp index 596017f..bb8a12a 100644 --- a/src/htcondor_cc_sync_plugin.cpp +++ b/src/htcondor_cc_sync_plugin.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -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() { if (initializing) { // HTCondor bug? We should'n be receiving events before // initialization is done. We will ignore them if it @@ -412,6 +422,13 @@ void CCSyncPlugin::endTransaction() { continue; } else 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) { auto jobBatchNameIt = job.find("JobBatchName");