From a961df65870f17a221be316b165ac3a17bdc9d35 Mon Sep 17 00:00:00 2001 From: Matias Martinez Date: Wed, 3 Jul 2019 23:51:48 +0200 Subject: [PATCH] compute the grid5k timeout based on repair timeout (#16) --- script/config.py | 6 +++++- script/core/Support.py | 11 +++++++++++ script/core/runner/grid5k/Grid5kRunner.py | 4 ++-- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 script/core/Support.py diff --git a/script/config.py b/script/config.py index 10ca163a3..57240e654 100644 --- a/script/config.py +++ b/script/config.py @@ -1,5 +1,6 @@ import os from os.path import expanduser +from core.Support import getGridTime REPAIR_ROOT = os.path.join(os.path.dirname(__file__), '..') DATA_PATH = os.path.join(REPAIR_ROOT, "data") @@ -15,5 +16,8 @@ LOCAL_THREAD = 1 GRID5K_MAX_NODE = 50 - +##In minutes TOOL_TIMEOUT = "120" +#Format: HH:MM ## the fuction getGridTime calculates the timeout of the grid taking into account an overhead (expressed as percentage) +GRID5K_TIME_OUT = getGridTime(TOOL_TIMEOUT, overhead=0.33) + diff --git a/script/core/Support.py b/script/core/Support.py new file mode 100644 index 000000000..9b562ca7c --- /dev/null +++ b/script/core/Support.py @@ -0,0 +1,11 @@ + +def getGridTime(timeout, overhead = 0.33): + ''' computes the timeout of the grid based on the timeout (from the tool) received as parameter. + Moreover it adds an overhead with is a percentage of the original timeout''' + timetool = int(timeout) + timetooloverhead = timetool + (timetool * overhead) + hr_st = str(int(timetooloverhead // 60)) + minutes = int(timetooloverhead % 60) + mt_st = str(minutes) if minutes >=10 else ("0" + str(minutes)) + timestring = hr_st + ":" + mt_st + return timestring diff --git a/script/core/runner/grid5k/Grid5kRunner.py b/script/core/runner/grid5k/Grid5kRunner.py index bbce56a89..e496a7144 100644 --- a/script/core/runner/grid5k/Grid5kRunner.py +++ b/script/core/runner/grid5k/Grid5kRunner.py @@ -8,7 +8,7 @@ from core.runner.RepairTask import RepairTask from core.runner.Runner import Runner from core.renderer.renderer import get_renderer -from config import REPAIR_ROOT, OUTPUT_PATH, GRID5K_MAX_NODE +from config import REPAIR_ROOT, OUTPUT_PATH, GRID5K_MAX_NODE, GRID5K_TIME_OUT class Grid5kRunner(Runner): @@ -129,7 +129,7 @@ def start_task(self, task): node_cmd = "sudo-g5k apt-get install maven -y -qq > /dev/null; python %s" % node_cmd_args cmd = "oarsub -l nodes=1,walltime=%s -O %s -E %s \"%s\"" % ( - "2:15", + GRID5K_TIME_OUT, stdout_log, stderr_log, node_cmd)