Skip to content

Commit

Permalink
compute the grid5k timeout based on repair timeout (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinezmatias authored and tdurieux committed Jul 3, 2019
1 parent e2f3ff0 commit a961df6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
6 changes: 5 additions & 1 deletion script/config.py
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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)

11 changes: 11 additions & 0 deletions script/core/Support.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions script/core/runner/grid5k/Grid5kRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a961df6

Please sign in to comment.