From 71eca080e9af3445f661012cc39397f1c6e4c5ca Mon Sep 17 00:00:00 2001 From: Zach Marshall <zach.marshall@cern.ch> Date: Thu, 29 Sep 2022 19:09:22 +0200 Subject: [PATCH] BugFix to GridTools for proxy time output parsing BugFix to GridTools for proxy time output parsing If grid tools aren't installed as an RPM (as they are on lxplus by default), then we get slightly different output from the associated commands. This requires a change to the parsing. Addresses an issue raised today in PATHelp. --- .../D3PDTools/SampleHandler/Root/GridTools.cxx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/PhysicsAnalysis/D3PDTools/SampleHandler/Root/GridTools.cxx b/PhysicsAnalysis/D3PDTools/SampleHandler/Root/GridTools.cxx index fa87a2a10700..1505e4336558 100644 --- a/PhysicsAnalysis/D3PDTools/SampleHandler/Root/GridTools.cxx +++ b/PhysicsAnalysis/D3PDTools/SampleHandler/Root/GridTools.cxx @@ -68,14 +68,25 @@ namespace SH { std::istringstream str (output); unsigned seconds = 0; + if (!(str >> seconds)) { - ANA_MSG_INFO ("failed to parse command output: " << output); + // Output format is more complicated if RPM isn't installed + std::istringstream str2 (output.substr(output.rfind('\n',output.size()-2)+1,std::string::npos)); + + if (!(str2 >> seconds)){ + ANA_MSG_INFO ("failed to parse command output: " << output); + } else + { + proxyExpiration = clock::now() + std::chrono::seconds (seconds); + haveProxy = true; + } // Second try was successful + } else { proxyExpiration = clock::now() + std::chrono::seconds (seconds); haveProxy = true; - } + } // First try was successful } } @@ -497,7 +508,7 @@ namespace SH RucioDownloadResult result; result.did = readLine (output, "DID "); - result.totalFiles = readLineUnsigned (output, "Total files: "); + result.totalFiles = readLineUnsigned (output, "Total files (DID): "); result.downloadedFiles = readLineUnsigned (output, "Downloaded files: "); result.alreadyLocal = readLineUnsigned (output, "Files already found locally: "); result.notDownloaded = readLineUnsigned (output, "Files that cannot be downloaded: "); -- GitLab