From 08b8f07a0901ed3c5b625e2b514395ff6b0150c4 Mon Sep 17 00:00:00 2001 From: barate Date: Mon, 14 Jun 2010 09:01:45 +0000 Subject: [PATCH] Fixed time unit for parameter MAXWALLTIME in batch managers PBS and Local (minutes instead of seconds) --- src/Local/Batch_BatchManager_Local.cxx | 8 ++++---- src/PBS/Batch_Job_PBS.cxx | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Local/Batch_BatchManager_Local.cxx b/src/Local/Batch_BatchManager_Local.cxx index 4e356de..4456fec 100644 --- a/src/Local/Batch_BatchManager_Local.cxx +++ b/src/Local/Batch_BatchManager_Local.cxx @@ -601,15 +601,15 @@ namespace Batch { // On regarde si le fils n'a pas depasse son temps (wallclock time) time_t child_currenttime = time(NULL); - time_t child_elapsedtime = child_currenttime - child_starttime; + long child_elapsedtime_minutes = (child_currenttime - child_starttime) / 60L; if (param.find(MAXWALLTIME) != param.end()) { - int maxwalltime = param[MAXWALLTIME]; + long maxwalltime = param[MAXWALLTIME]; // cout << "child_starttime = " << child_starttime << endl // << "child_currenttime = " << child_currenttime << endl // << "child_elapsedtime = " << child_elapsedtime << endl // << "maxwalltime = " << maxwalltime << endl // << "int(maxwalltime * 1.1) = " << int(maxwalltime * 1.1) << endl; - if (child_elapsedtime > int(maxwalltime * 1.1) ) { // On se donne 10% de marge avant le KILL + if (child_elapsedtime_minutes > long((float)maxwalltime * 1.1) ) { // On se donne 10% de marge avant le KILL UNDER_LOCK( cout << "Father is sending KILL command to the thread " << _id << endl ); // On introduit une commande dans la queue du thread // @@@ --------> SECTION CRITIQUE <-------- @@@ @@ -620,7 +620,7 @@ namespace Batch { // @@@ --------> SECTION CRITIQUE <-------- @@@ - } else if (child_elapsedtime > maxwalltime ) { + } else if (child_elapsedtime_minutes > maxwalltime ) { UNDER_LOCK( cout << "Father is sending TERM command to the thread " << _id << endl ); // On introduit une commande dans la queue du thread // @@@ --------> SECTION CRITIQUE <-------- @@@ diff --git a/src/PBS/Batch_Job_PBS.cxx b/src/PBS/Batch_Job_PBS.cxx index 908c353..cd84b8f 100644 --- a/src/PBS/Batch_Job_PBS.cxx +++ b/src/PBS/Batch_Job_PBS.cxx @@ -171,11 +171,10 @@ namespace Batch { } else if ( (*it).first == MAXWALLTIME ) { char attr_value[32]; - long secondes = (*it).second; - long heures = secondes / 3600L; - long minutes = (secondes - 3600L * heures) / 60L; - secondes = secondes % 60L; - sprintf(attr_value, "%02ld:%02ld:%02ld", heures, minutes, secondes); + long minutes = (*it).second; + long heures = minutes / 60L; + minutes -= 60L * heures; + sprintf(attr_value, "%02ld:%02ld:00", heures, minutes); setResourceAttributeOP(_p_attr_list, ATTR_l, "walltime", attr_value); -- 2.39.2