From: barate Date: Wed, 3 Apr 2013 08:06:39 +0000 (+0000) Subject: Fix bug with WallTime in OAR (minutes instead of seconds) X-Git-Tag: V2_0_0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4c6338d719c5637e8ded33f49a9302781c93756c;p=tools%2Flibbatch.git Fix bug with WallTime in OAR (minutes instead of seconds) --- diff --git a/src/COORM/BatchManager_COORM.cxx b/src/COORM/BatchManager_COORM.cxx index 9e50e5b..7873bc9 100644 --- a/src/COORM/BatchManager_COORM.cxx +++ b/src/COORM/BatchManager_COORM.cxx @@ -224,18 +224,6 @@ namespace Batch return remoteFileName; } - const string BatchManager_COORM::convertSecTo_H_M_S(const long seconds) - { - int h(seconds / 3600); - int m((seconds % 3600) / 60); - int s((seconds % 3600) % 60); - - stringstream ss; - ss << h << ":" << m << ":" << s; - - return ss.str(); - } - void BatchManager_COORM::exportInputFiles(const Job & job) { BatchManager::exportInputFiles(job); diff --git a/src/COORM/BatchManager_COORM.hxx b/src/COORM/BatchManager_COORM.hxx index 33790b2..037eaf3 100644 --- a/src/COORM/BatchManager_COORM.hxx +++ b/src/COORM/BatchManager_COORM.hxx @@ -56,7 +56,6 @@ namespace Batch protected: std::string buildBatchScript(const Job & job); - const std::string convertSecTo_H_M_S(const long seconds); void exportInputFiles(const Job & job); #ifdef SWIG diff --git a/src/OAR/BatchManager_OAR.cxx b/src/OAR/BatchManager_OAR.cxx index 5c050a9..6b28be0 100644 --- a/src/OAR/BatchManager_OAR.cxx +++ b/src/OAR/BatchManager_OAR.cxx @@ -134,7 +134,6 @@ namespace Batch string fileToExecute = ""; string tmpDir = ""; int nbproc = 0; - int edt = 0; int mem = 0; string queue = ""; @@ -154,8 +153,9 @@ namespace Batch int nbprocpernode = 1; if (params.find(NBPROCPERNODE) != params.end()) nbprocpernode = params[NBPROCPERNODE]; + long walltimeSecs = 0; if (params.find(MAXWALLTIME) != params.end()) - edt = params[MAXWALLTIME]; + walltimeSecs = (long)params[MAXWALLTIME] * 60; if (params.find(MAXRAMSIZE) != params.end()) mem = params[MAXRAMSIZE]; if (params.find(QUEUE) != params.end()) @@ -191,9 +191,9 @@ namespace Batch if (nb_full_nodes > 0) { tempOutputFile << "#OAR -l nodes=" << nb_full_nodes; - if (edt > 0) + if (walltimeSecs > 0) { - tempOutputFile << ",walltime=" << convertSecTo_H_M_S(edt) << endl; + tempOutputFile << ",walltime=" << convertSecTo_H_M_S(walltimeSecs) << endl; } else { @@ -202,9 +202,9 @@ namespace Batch } else { - if (edt > 0) + if (walltimeSecs > 0) { - tempOutputFile << "#OAR -l walltime=" << convertSecTo_H_M_S(edt) << endl; + tempOutputFile << "#OAR -l walltime=" << convertSecTo_H_M_S(walltimeSecs) << endl; } } @@ -237,7 +237,7 @@ namespace Batch return remoteFileName; } - const string BatchManager_OAR::convertSecTo_H_M_S(const long seconds) + string BatchManager_OAR::convertSecTo_H_M_S(long seconds) const { int h(seconds / 3600); int m((seconds % 3600) / 60); diff --git a/src/OAR/BatchManager_OAR.hxx b/src/OAR/BatchManager_OAR.hxx index eef325b..482a4e5 100644 --- a/src/OAR/BatchManager_OAR.hxx +++ b/src/OAR/BatchManager_OAR.hxx @@ -56,7 +56,7 @@ namespace Batch protected: std::string buildBatchScript(const Job & job); - const std::string convertSecTo_H_M_S(const long seconds); + std::string convertSecTo_H_M_S(long seconds) const; #ifdef SWIG public: