Commit ff7cfbae authored by Reto Da Forno's avatar Reto Da Forno
Browse files

setup and cleanup time converted from minutes to seconds, guard time config...

setup and cleanup time converted from minutes to seconds, guard time config for resource allocations removed (unused)
parent 817feea5
......@@ -15,11 +15,9 @@ timeformat = %%Y-%%m-%%d %%H:%%M:%%S
; test config
[tests]
setuptime = 2 ;Minutes needed for test setup
cleanuptime = 2 ;Minutes needed for test cleanup
setuptime = 120 ;Seconds needed for test setup
cleanuptime = 120 ;Seconds needed for test cleanup
pidfolder = /tmp/flocklab/ ;Folder for pid files
guard_starttime = 1 ;Minutes needed to start the test (reset pin)
guard_stoptime = 1 ;Minutes needed to stop the test (reset pin)
allowparalleltests = 0 ;Allow parallel test execution on the same observer if resource conflicts avoided
; Observer config
......
......@@ -116,6 +116,7 @@ class StartTestThread(threading.Thread):
errors = []
testconfigfolder = "%s/%d" % (flocklab.config.get("observer", "testconfigfolder"), self._testid)
obsdataport = flocklab.config.getint('serialproxy', 'obsdataport')
starttime = time.time()
try:
logger.debug("Start StartTestThread for observer ID %d" % (self._obsdict_key[self._obskey][1]))
# First test if the observer is online and if the SD card is mounted:
......@@ -180,7 +181,7 @@ class StartTestThread(threading.Thread):
errors.append(("Test start script on observer ID %s failed with error code %d." % (self._obsdict_key[self._obskey][1], rs), rs, self._obsdict_key[self._obskey][1]))
logger.error("Test start script on observer ID %s failed with error code %d and message:\n%s" % (str(self._obsdict_key[self._obskey][1]), rs, str(out)))
else:
logger.debug("Test start script on observer ID %s succeeded." % (self._obsdict_key[self._obskey][1]))
logger.debug("Test start script on observer ID %s succeeded (took %us)." % (self._obsdict_key[self._obskey][1], int(time.time() - starttime)))
# Remove image file and xml on server:
os.remove(self._xmldict_key[self._obskey][0])
logger.debug("Removed XML config %s for observer ID %s" % (self._xmldict_key[self._obskey][0], self._obsdict_key[self._obskey][1]))
......@@ -248,7 +249,7 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id):
# Image processing ---
# Get all images from the database:
imagedict_key = {}
sql_image = """ SELECT `t`.`binary`, `m`.`observer_fk`, `m`.`node_id`, LOWER(`a`.`architecture`), `t`.`serv_targetimages_key`, LOWER(`p`.`name`) AS `platname`, `a`.`core` AS `core`
sql_image = """ SELECT `t`.`binary`, `m`.`observer_fk`, `m`.`node_id`, LOWER(`a`.`architecture`), `t`.`serv_targetimages_key`, LOWER(`p`.`name`) AS `platname`, `a`.`core` AS `core`
FROM `tbl_serv_targetimages` AS `t`
LEFT JOIN `tbl_serv_map_test_observer_targetimages` AS `m`
ON `t`.`serv_targetimages_key` = `m`.`targetimage_fk`
......@@ -259,7 +260,7 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id):
LEFT JOIN `tbl_serv_architectures` AS `a`
ON `t`.`core` = `a`.`core` AND `p`.`serv_platforms_key` = `a`.`platforms_fk`
WHERE `m`.`test_fk` = %d
"""
"""
cur.execute(sql_image%testid)
ret = cur.fetchall()
for r in ret:
......@@ -691,7 +692,7 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id):
# Wait for all threads to finish:
for (thread, obskey) in thread_list:
# Wait max 75% of the setuptime:
thread.join(timeout=(flocklab.config.getint('tests','setuptime')*0.75*60))
thread.join(timeout=(flocklab.config.getint('tests','setuptime')*0.75))
if thread.isAlive():
# Timeout occurred. Signal the thread to abort:
logger.error("Telling thread for test start on observer ID %s to abort..." % (str(obsdict_key[obskey][1])))
......@@ -902,7 +903,7 @@ def stop_test(testid, cur, cn, obsdict_key, obsdict_id, abort=False):
logger.debug("Started thread for test stop on observer ID %s" %(str(obsdict_key[obskey][1])))
# Wait for all threads to finish:
for (thread, obskey) in thread_list:
thread.join(timeout=(flocklab.config.getint('tests','cleanuptime')*0.75*60))
thread.join(timeout=(flocklab.config.getint('tests','cleanuptime') * 0.75))
if thread.isAlive():
# Timeout occurred. Signal the thread to abort:
msg = "Telling thread for test stop on observer ID %s to abort..." %(str(obsdict_key[obskey][1]))
......@@ -1160,7 +1161,7 @@ def db_register_activity(testid, cur, cn, action, obskeys):
spin = False
try:
# remove obsolete values, just in case there was something going wrong..
sql = 'DELETE FROM tbl_serv_dispatcher_activity WHERE (`time_start` < date_add(NOW(), interval - %d minute))' % (max((flocklab.config.getint('tests','setuptime'),flocklab.config.getint('tests','cleanuptime'))) * 2)
sql = 'DELETE FROM tbl_serv_dispatcher_activity WHERE (`time_start` < date_add(NOW(), interval - %d second))' % (max((flocklab.config.getint('tests','setuptime'),flocklab.config.getint('tests','cleanuptime'))) * 2)
cur.execute(sql)
for obskey in obskeys:
sql = 'INSERT INTO tbl_serv_dispatcher_activity (`pid`,`action`,`observer_fk`,`test_fk`,`time_start`) VALUES (%d,"%s",%d,%d,NOW())' % (pid,action,obskey,testid)
......@@ -1366,7 +1367,7 @@ def main(argv):
errors, warnings = stop_test(testid, cur, cn, obsdict_key, obsdict_id, abort)
# Record time needed to set up test for statistics in DB:
time_needed = time.time() - starttime
sql = """ UPDATE `tbl_serv_tests`
sql = """ UPDATE `tbl_serv_tests`
SET `cleanuptime` = %d
WHERE `serv_tests_key` = %d;
"""
......
......@@ -128,7 +128,6 @@ def main(argv):
(cn, cur) = flocklab.connect_to_db()
except:
flocklab.error_logandexit("Could not connect to database", errno.EAGAIN)
#logger.debug("Connected to database")
try:
flocklab.acquire_db_lock(cur, cn, 'scheduler', 5)
......@@ -143,8 +142,8 @@ def main(argv):
# Check for work ---
# Check if a new test is to be started ---
# Calculate the time frame in which a test can be started: at least the setuptime ahead, at most 5 minutes more ahead
earlieststart = (datetime.datetime.now() + datetime.timedelta(minutes=float(flocklab.config.get("tests", "setuptime"))) - datetime.timedelta(seconds=10)).strftime(flocklab.config.get("database", "timeformat"))
lateststart = (datetime.datetime.now() + datetime.timedelta(minutes=int(flocklab.config.get("tests", "setuptime"))) + datetime.timedelta(minutes=2)).strftime(flocklab.config.get("database", "timeformat"))
earlieststart = (datetime.datetime.now() + datetime.timedelta(seconds=flocklab.config.getint("tests", "setuptime")) - datetime.timedelta(seconds=10)).strftime(flocklab.config.get("database", "timeformat"))
lateststart = (datetime.datetime.now() + datetime.timedelta(seconds=flocklab.config.getint("tests", "setuptime")) + datetime.timedelta(minutes=2)).strftime(flocklab.config.get("database", "timeformat"))
# Check if a test is going to start soon:
sql = """SELECT `serv_tests_key`,`time_start_wish`
FROM `tbl_serv_tests`
......@@ -153,7 +152,7 @@ def main(argv):
AND (`test_status` = 'planned')
AND (`dispatched` = 0)
""" % (earlieststart, lateststart)
logger.debug("Looking in DB for tests with start time between %s and %s and test status planned..."%(now, lateststart))
logger.debug("Looking in DB for tests with start time between %s and %s and test status planned..." % (now, lateststart))
cur.execute(sql)
# start thread for each test to start
......@@ -161,14 +160,14 @@ def main(argv):
if rs:
for test in rs:
testid = int(test[0])
delay = int(calendar.timegm(time.strptime(str(test[1]), '%Y-%m-%d %H:%M:%S'))) - (int(flocklab.config.get("tests", "setuptime"))*60) - int(time.time())
delay = int(calendar.timegm(time.strptime(str(test[1]), '%Y-%m-%d %H:%M:%S'))) - flocklab.config.getint("tests", "setuptime") - int(time.time())
if delay < 0:
delay = 0
logger.info("Call process to start test %s with delay %s"%(testid,delay))
p = multiprocessing.Process(target=test_startstopabort,args=(testid, 'start', delay))
p.start()
else:
logger.debug("No test is to be started within the next %s minutes"%(flocklab.config.get("tests", "setuptime")))
logger.debug("No test is to be started within the next %s seconds" % (flocklab.config.get("tests", "setuptime")))
# Check for test which have been missed ---
sql1 = """SELECT `serv_tests_key`
FROM `tbl_serv_tests`
......
......@@ -18,25 +18,19 @@
$mini = isset($_GET['mini']) && $_GET['mini']==TRUE;
// Connect to database and get the corresponding events:
$guard_setup_min = $CONFIG['tests']['setuptime'];
$guard_cleanup_min = $CONFIG['tests']['cleanuptime'];
$guard_setup_sec = $CONFIG['tests']['setuptime'];
$guard_cleanup_sec = $CONFIG['tests']['cleanuptime'];
$db = db_connect();
// planned tests
$sql = "SELECT `a`.serv_tests_key, `a`.title, `a`.description, `a`.time_start_wish, `a`.time_end_wish, `a`.owner_fk, `b`.username, `b`.firstname, `b`.lastname, `a`.time_start_act, `a`.time_end_act, `a`.test_status,
DATE_ADD(`a`.time_start_wish, INTERVAL -".$guard_setup_min." MINUTE) as time_start_offset,
DATE_ADD(`a`.time_end_wish, INTERVAL ".$guard_cleanup_min." MINUTE) as time_end_offset
$sql = "SELECT `a`.serv_tests_key, `a`.title, `a`.description, `a`.time_start_wish, `a`.time_end_wish, `a`.owner_fk,
`b`.username, `b`.firstname, `b`.lastname, `a`.time_start_act, `a`.time_end_act, `a`.test_status,
DATE_ADD(`a`.time_start_wish, INTERVAL -".$guard_setup_sec." SECOND) as time_start_offset,
DATE_ADD(`a`.time_end_wish, INTERVAL ".$guard_cleanup_sec." SECOND) as time_end_offset
FROM `tbl_serv_tests` AS `a`
LEFT JOIN `tbl_serv_users` AS `b` ON `a`.owner_fk = `b`.serv_users_key
WHERE
(
(`a`.test_status NOT IN ('not schedulable', 'todelete', 'deleted') OR (`a`.test_status_preserved IS NOT NULL AND `a`.test_status_preserved IN ('finished','failed')))
AND
(
(`a`.time_start_wish BETWEEN '" . $mysqlstart . "' AND '" . $mysqlend . "')
OR (`a`.time_end_wish BETWEEN '" . $mysqlstart . "' AND '" . $mysqlend . "')
)
) ORDER BY `a`.time_start_wish
";
WHERE (`a`.test_status NOT IN ('not schedulable', 'todelete', 'deleted') OR (`a`.test_status_preserved IS NOT NULL AND `a`.test_status_preserved IN ('finished','failed')))
AND ( (`a`.time_start_wish BETWEEN '" . $mysqlstart . "' AND '" . $mysqlend . "') OR (`a`.time_end_wish BETWEEN '" . $mysqlstart . "' AND '" . $mysqlend . "') )
ORDER BY `a`.time_start_wish";
$rs = mysqli_query($db, $sql) or flocklab_die('Cannot get calendar data from database because: ' . mysqli_error($db));
// Build the array of events:
......@@ -45,7 +39,7 @@
// Create the event depending on the owner: if it is an event which belongs to the logged-in user, show more info and color it differently.
if ($row['owner_fk'] == $_SESSION['serv_users_key']) {
if ($row['test_status'] == 'failed' || $row['test_status'] == 'finished' || $row['test_status'] == 'retention expiring' || $row['test_status'] == 'deleted' || $row['test_status'] == 'todelete' ) {
$events[] = array(
$events[] = array(
'id' => $row['serv_tests_key'],
'title' => 'Test ' . $row['serv_tests_key'] . ': ' . $row['title'],
'description' => $mini?'':'Test-ID: ' . $row['serv_tests_key'] . '<br/>Duration: '.date("H:i", strtotime($row['time_start_act'])).' - '.date("H:i", strtotime($row['time_end_act'])).'<br/>Title: ' . $row['title'] . '<br/> Description: ' . $row['description'].'<br />Status: '.$row['test_status'],
......
......@@ -548,9 +548,9 @@ function check_quota($testconfig, $exclude_test = NULL, &$quota = NULL) {
function check_schedulability($testconfig, $exclude_test = NULL) {
global $CONFIG;
$db = db_connect();
$guard_min = $CONFIG['tests']['setuptime'] + $CONFIG['tests']['cleanuptime'];
$guard_setup_min = $CONFIG['tests']['setuptime'];
$guard_cleanup_min = $CONFIG['tests']['cleanuptime'];
$guard_sec = $CONFIG['tests']['setuptime'] + $CONFIG['tests']['cleanuptime'];
$guard_setup_sec = $CONFIG['tests']['setuptime'];
$guard_cleanup_sec = $CONFIG['tests']['cleanuptime'];
$start = new DateTime($testconfig->generalConf->scheduleAbsolute->start);
$end = new DateTime($testconfig->generalConf->scheduleAbsolute->end);
$start->setTimeZone(new DateTimeZone("UTC"));
......@@ -558,7 +558,7 @@ function check_schedulability($testconfig, $exclude_test = NULL) {
$now = new DateTime ();
$now->setTimeZone(new DateTimeZone("UTC"));
// check setup time
if ($start->format("U") - ($guard_setup_min * 60) < $now->format("U")) {
if ($start->format("U") - $guard_setup_sec < $now->format("U")) {
$sched=false;
}
else {
......@@ -568,8 +568,8 @@ function check_schedulability($testconfig, $exclude_test = NULL) {
WHERE ' .(is_null($exclude_test)?'':' `serv_tests_key`!='.$exclude_test.' AND ').' ('.
// planned tests
'`test_status` NOT IN("finished","failed", "deleted", "todelete", "syncing", "synced", "retention expiring") AND (
(`time_start_wish` > DATE_ADD("'.$start->format(DATE_ISO8601).'", INTERVAL '.(- $guard_min).' MINUTE) AND `time_end_wish` < DATE_ADD("'.$end->format(DATE_ISO8601).'", INTERVAL '.($guard_min).' MINUTE))
OR (`time_start_wish` < DATE_ADD("'.$end->format(DATE_ISO8601).'", INTERVAL '.($guard_min).' MINUTE) AND `time_end_wish` > DATE_ADD("'.$start->format(DATE_ISO8601).'", INTERVAL '.(- $guard_min).' MINUTE))))';
(`time_start_wish` > DATE_ADD("'.$start->format(DATE_ISO8601).'", INTERVAL '.(- $guard_sec).' SECOND) AND `time_end_wish` < DATE_ADD("'.$end->format(DATE_ISO8601).'", INTERVAL '.($guard_sec).' SECOND))
OR (`time_start_wish` < DATE_ADD("'.$end->format(DATE_ISO8601).'", INTERVAL '.($guard_sec).' SECOND) AND `time_end_wish` > DATE_ADD("'.$start->format(DATE_ISO8601).'", INTERVAL '.(- $guard_sec).' SECOND))))';
$res = mysqli_query($db, $sql) or flocklab_die('Cannot check schedulability: ' . mysqli_error($db));
$row = mysqli_fetch_assoc($res);
$sched = $row['test_num']==0;
......@@ -577,7 +577,7 @@ function check_schedulability($testconfig, $exclude_test = NULL) {
if ($sched) {
$sql = 'SELECT max(`user_fk` = '.$_SESSION['serv_users_key'].') as `reservation_match`
FROM `tbl_serv_reservations` LEFT JOIN `tbl_serv_user_groups` ON `group_fk`=`group_id_fk`
WHERE (`time_start` < DATE_ADD("'.$end->format(DATE_ISO8601).'", INTERVAL '.($guard_min).' MINUTE) AND `time_end` > DATE_ADD("'.$start->format(DATE_ISO8601).'", INTERVAL '.(- $guard_min).' MINUTE))';
WHERE (`time_start` < DATE_ADD("'.$end->format(DATE_ISO8601).'", INTERVAL '.($guard_sec).' SECOND) AND `time_end` > DATE_ADD("'.$start->format(DATE_ISO8601).'", INTERVAL '.(- $guard_sec).' SECOND))';
$res = mysqli_query($db, $sql) or flocklab_die('Cannot check schedulability: ' . mysqli_error($db));
if (mysqli_num_rows($res) > 0) {
$row = mysqli_fetch_assoc($res);
......@@ -772,7 +772,7 @@ function resource_slots($duration, $targetnodes) {
$res = mysqli_query($db, $sql);
if (mysqli_num_rows($res) == 1) {
$row = mysqli_fetch_assoc($res);
array_push($resources, Array('time_start'=>0, 'time_end'=>$duration + ($CONFIG['tests']['setuptime'] + $CONFIG['tests']['cleanuptime']) * 60, 'obsid'=>$tn['obsid'], 'restype'=>'slot_'.$row['slot']));
array_push($resources, Array('time_start'=>0, 'time_end'=>$duration + $CONFIG['tests']['setuptime'] + $CONFIG['tests']['cleanuptime'], 'obsid'=>$tn['obsid'], 'restype'=>'slot_'.$row['slot']));
}
}
mysqli_close($db);
......@@ -799,7 +799,7 @@ function resource_freq($duration, $targetnodes) {
foreach($targetnodes as $tn) {
foreach(Array('freq_2400', 'freq_868', 'freq_433') as $restype) {
if ($freqs[$tn['platform']][$restype] == 1)
array_push($resources, Array('time_start'=>$CONFIG['tests']['setuptime'] * 60, 'time_end'=>$duration + $CONFIG['tests']['setuptime'] * 60, 'obsid'=>$tn['obsid'], 'restype'=>$restype));
array_push($resources, Array('time_start'=>$CONFIG['tests']['setuptime'], 'time_end'=>$duration + $CONFIG['tests']['setuptime'], 'obsid'=>$tn['obsid'], 'restype'=>$restype));
}
}
return $resources;
......@@ -824,7 +824,7 @@ function resource_multiplexer($duration, $targetnodes, $xmlconfig) {
continue;
foreach(explodeobsids($c->obsIds) as $obsid) {
if (! in_array($obsid, $ignoreObs)) {
array_push($resources, Array('time_start'=>0, 'time_end'=>$duration + ($CONFIG['tests']['setuptime'] + $CONFIG['tests']['cleanuptime']) * 60, 'obsid'=>(int)$obsid, 'restype'=>'mux'));
array_push($resources, Array('time_start'=>0, 'time_end'=>$duration + $CONFIG['tests']['setuptime'] + $CONFIG['tests']['cleanuptime'], 'obsid'=>(int)$obsid, 'restype'=>'mux'));
array_push($ignoreObs, $obsid);
}
}
......@@ -833,12 +833,12 @@ function resource_multiplexer($duration, $targetnodes, $xmlconfig) {
foreach($targetnodes as $tn) {
//if (! in_array($tn['obsid'], $ignoreObs)) {
if ($duration > ($CONFIG['tests']['guard_starttime'] + $CONFIG['tests']['guard_stoptime']) * 60) {
array_push($resources, Array('time_start'=>0, 'time_end'=>($CONFIG['tests']['setuptime'] + $CONFIG['tests']['guard_starttime'])*60, 'obsid'=>$tn['obsid'], 'restype'=>'mux'));
array_push($resources, Array('time_start'=>($CONFIG['tests']['setuptime'] - $CONFIG['tests']['guard_stoptime']) * 60 + $duration, 'time_end'=>$duration + ($CONFIG['tests']['setuptime'] + $CONFIG['tests']['cleanuptime'])*60, 'obsid'=>$tn['obsid'], 'restype'=>'mux'));
if ($duration > ($CONFIG['tests']['setuptime'] + $CONFIG['tests']['cleanuptime'])) {
array_push($resources, Array('time_start'=>0, 'time_end'=>($CONFIG['tests']['setuptime'] + $CONFIG['tests']['setuptime']), 'obsid'=>$tn['obsid'], 'restype'=>'mux'));
array_push($resources, Array('time_start'=>($CONFIG['tests']['setuptime'] - $CONFIG['tests']['cleanuptime']) + $duration, 'time_end'=>$duration + ($CONFIG['tests']['setuptime'] + $CONFIG['tests']['cleanuptime']), 'obsid'=>$tn['obsid'], 'restype'=>'mux'));
}
else {
array_push($resources, Array('time_start'=>0, 'time_end'=>$duration + ($CONFIG['tests']['setuptime'] + $CONFIG['tests']['cleanuptime'])*60, 'obsid'=>$tn['obsid'], 'restype'=>'mux'));
array_push($resources, Array('time_start'=>0, 'time_end'=>$duration + ($CONFIG['tests']['setuptime'] + $CONFIG['tests']['cleanuptime']), 'obsid'=>$tn['obsid'], 'restype'=>'mux'));
}
//}
}
......@@ -870,8 +870,8 @@ function resource_cleanup($targetnodes) {
$res = mysqli_query($db, $sql);
if (mysqli_num_rows($res) == 1) {
$row = mysqli_fetch_assoc($res);
array_push($resources, Array('time_start'=>0, 'time_end'=>$CONFIG['tests']['cleanuptime'] * 60, 'obsid'=>$tn['obsid'], 'restype'=>'slot_'.$row['slot']));
array_push($resources, Array('time_start'=>0, 'time_end'=>$CONFIG['tests']['cleanuptime'] * 60, 'obsid'=>$tn['obsid'], 'restype'=>'mux'));
array_push($resources, Array('time_start'=>0, 'time_end'=>$CONFIG['tests']['cleanuptime'], 'obsid'=>$tn['obsid'], 'restype'=>'slot_'.$row['slot']));
array_push($resources, Array('time_start'=>0, 'time_end'=>$CONFIG['tests']['cleanuptime'], 'obsid'=>$tn['obsid'], 'restype'=>'mux'));
}
}
mysqli_close($db);
......@@ -892,8 +892,8 @@ function resource_cleanup($targetnodes) {
function schedule_test($testconfig, $resources, $exclude_test = NULL) {
global $CONFIG;
$db = db_connect();
$guard_setup_min = $CONFIG['tests']['setuptime'];
$guard_cleanup_min = $CONFIG['tests']['cleanuptime'];
$guard_setup_sec = $CONFIG['tests']['setuptime'];
$guard_cleanup_sec = $CONFIG['tests']['cleanuptime'];
$allow_parallel_tests = $CONFIG['tests']['allowparalleltests'];
$isAsap = isset($testconfig->generalConf->scheduleAsap);
$now = new DateTime ();
......@@ -905,8 +905,8 @@ function schedule_test($testconfig, $resources, $exclude_test = NULL) {
$end = new DateTime($testconfig->generalConf->scheduleAbsolute->end);
$start->setTimeZone(new DateTimeZone("UTC"));
$end->setTimeZone(new DateTimeZone("UTC"));
$start->modify('-'.$guard_setup_min.' minutes');
$end->modify('+'.$guard_cleanup_min.' minutes');
$start->modify('-'.$guard_setup_sec.' seconds');
$end->modify('+'.$guard_cleanup_sec.' seconds');
if ($start->format("U") < $now->format("U")) {
return Array('feasible'=>False, 'start_time'=>$start, 'end_time'=>$end);
}
......@@ -917,7 +917,7 @@ function schedule_test($testconfig, $resources, $exclude_test = NULL) {
$start->setTimeZone(new DateTimeZone("UTC"));
$end->setTimeZone(new DateTimeZone("UTC"));
$end->modify('+'.$testconfig->generalConf->scheduleAsap->durationSecs.' seconds');
$end->modify('+'.($guard_setup_min + $guard_cleanup_min).' minutes');
$end->modify('+'.($guard_setup_sec + $guard_cleanup_sec).' seconds');
}
$resourcesdict = Array();
foreach($resources as $r) {
......@@ -999,8 +999,8 @@ function schedule_test($testconfig, $resources, $exclude_test = NULL) {
mysqli_close($db);
$start->modify('+'.($testShift - $shiftOffset).' seconds');
$end->modify('+'.($testShift - $shiftOffset).' seconds');
$start->modify('+'.$guard_setup_min.' minutes');
$end->modify('-'.$guard_cleanup_min.' minutes');
$start->modify('+'.$guard_setup_sec.' seconds');
$end->modify('-'.$guard_cleanup_sec.' seconds');
return Array('feasible'=>True,'start_time'=>$start, 'end_time'=>$end);
}
......@@ -1023,7 +1023,7 @@ function asap_to_absolute(&$testconfig, $starttime, $endtime) {
function add_resource_allocation($testId, $resources, $starttime) {
global $CONFIG;
$db = db_connect();
$starttime->modify('-'.$CONFIG['tests']['setuptime'].' minutes');
$starttime->modify('-'.$CONFIG['tests']['setuptime'].' seconds');
foreach($resources as $r) {
$start = clone $starttime;
$end = clone $starttime;
......@@ -1186,7 +1186,7 @@ function update_add_test($xml_config, &$errors, $existing_test_id = NULL, $abort
if (! isset($testconfig->generalConf->scheduleAsap)) {
unset($testconfig->generalConf->scheduleAbsolute);
$testconfig->generalConf->addChild('scheduleAsap');
$testconfig->generalConf->scheduleAsap->addChild('durationSecs', -60 * $CONFIG['tests']['setuptime']); // no setup time, only cleanup
$testconfig->generalConf->scheduleAsap->addChild('durationSecs', -1 * $CONFIG['tests']['setuptime']); // no setup time, only cleanup
}
}
else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment