diff --git a/Utilities/StorageFactory/BuildFile.xml b/Utilities/StorageFactory/BuildFile.xml index 356c6fa6da0a7..310b419ddef13 100644 --- a/Utilities/StorageFactory/BuildFile.xml +++ b/Utilities/StorageFactory/BuildFile.xml @@ -2,6 +2,7 @@ + diff --git a/Utilities/StorageFactory/src/StatisticsSenderService.cc b/Utilities/StorageFactory/src/StatisticsSenderService.cc index 342aa0da0eb07..aca9ed9c46473 100644 --- a/Utilities/StorageFactory/src/StatisticsSenderService.cc +++ b/Utilities/StorageFactory/src/StatisticsSenderService.cc @@ -6,6 +6,7 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/processGUID.h" +#include "FWCore/Version/interface/GetReleaseVersion.h" #include #include @@ -383,6 +384,9 @@ void StatisticsSenderService::fillUDP(const std::string &siteName, if (!siteName.empty()) { os << "\"site_name\":\"" << siteName << "\", "; } + // edm::getReleaseVersion() returns a string that includes quotation + // marks, therefore they are not added here + os << "\"cmssw_version\":" << edm::getReleaseVersion() << ", "; if (usedFallback) { os << "\"fallback\": true, "; } else { diff --git a/Utilities/StorageFactory/test/test_file_statistics_sender.sh b/Utilities/StorageFactory/test/test_file_statistics_sender.sh index 523da45696e34..a9c16531db365 100755 --- a/Utilities/StorageFactory/test/test_file_statistics_sender.sh +++ b/Utilities/StorageFactory/test/test_file_statistics_sender.sh @@ -3,6 +3,24 @@ # Pass in name and status function die { echo $1: status $2 ; exit $2; } +function testJSON { + # The JSON document is on one line, using an arbitrary key here to + # extract all of the documents into a separte file + grep cmssw_version $1 > test.json + python3 < test_single_file_statistics_sender.log || die "cmsRun test_single_file_statistics_sender_cfg.py" $? grep -q '"file_lfn":"file:stat_sender_first.root"' test_single_file_statistics_sender.log || die "no StatisticsSenderService output for single file" 1 +grep -q "\"cmssw_version\":\"$CMSSW_VERSION\"" test_single_file_statistics_sender.log || die "no StatisticsSenderService output for CMSSW version" 1 +testJSON test_single_file_statistics_sender.log rm test_single_file_statistics_sender.log cmsRun ${LOCAL_TEST_DIR}/test_multiple_files_file_statistics_sender_cfg.py &> test_multiple_files_file_statistics_sender.log || die "cmsRun test_multiple_files_file_statistics_sender_cfg.py" $? @@ -23,11 +43,13 @@ grep -q '"file_lfn":"file:stat_sender_b.root"' test_multiple_files_file_statisti grep -q '"file_lfn":"file:stat_sender_c.root"' test_multiple_files_file_statistics_sender.log || die "no StatisticsSenderService output for file c in multiple files" 1 grep -q '"file_lfn":"file:stat_sender_d.root"' test_multiple_files_file_statistics_sender.log || die "no StatisticsSenderService output for file d in multiple files" 1 grep -q '"file_lfn":"file:stat_sender_e.root"' test_multiple_files_file_statistics_sender.log || die "no StatisticsSenderService output for file e in multiple files" 1 +testJSON test_multiple_files_file_statistics_sender.log rm test_multiple_files_file_statistics_sender.log cmsRun ${LOCAL_TEST_DIR}/test_multi_file_statistics_sender_cfg.py &> test_multi_file_statistics_sender.log || die "cmsRun test_multi_file_statistics_sender_cfg.py" $? grep -q '"file_lfn":"file:stat_sender_first.root"' test_multi_file_statistics_sender.log || die "no StatisticsSenderService output for file first in multi file" 1 grep -q '"file_lfn":"file:stat_sender_second.root"' test_multi_file_statistics_sender.log || die "no StatisticsSenderService output for file second in multi file" 1 +testJSON test_multi_file_statistics_sender.log rm test_multi_file_statistics_sender.log cmsRun ${LOCAL_TEST_DIR}/test_secondary_file_statistics_sender_cfg.py &> test_secondary_file_statistics_sender.log || die "cmsRun test_secondary_file_statistics_sender_cfg.py" $? @@ -36,6 +58,7 @@ grep -q '"file_lfn":"file:stat_sender_b.root"' test_secondary_file_statistics_se grep -q '"file_lfn":"file:stat_sender_c.root"' test_secondary_file_statistics_sender.log || die "no StatisticsSenderService output for file 'c' in secondary files" 1 grep -q '"file_lfn":"file:stat_sender_d.root"' test_secondary_file_statistics_sender.log || die "no StatisticsSenderService output for file 'd' in secondary files" 1 grep -q '"file_lfn":"file:stat_sender_e.root"' test_secondary_file_statistics_sender.log || die "no StatisticsSenderService output for file 'e' in secondary files" 1 +testJSON test_secondary_file_statistics_sender.log rm test_secondary_file_statistics_sender.log -popd \ No newline at end of file +popd