To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

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

exclude weekends from daytime quota

parent 85fd64b8
......@@ -20,7 +20,7 @@ cleanuptime = 120
pidfolder = /tmp/flocklab/ ;Folder for pid files
allowparalleltests = 0 ;Allow parallel test execution on the same observer if resource conflicts avoided
powerprofilinglimit = 1000000 ;Max number of samples per test (sum accross all observers)
quota_daytime = 60 ;Limits the max. runtime (in minutes) per user during daytime (set to 0 to disable this feature)
quota_daytime = 60 ;Limits the max. runtime (in minutes) per user during daytime (Mo-Fr); set to 0 to disable this feature
daytime_start = 7 ;Daytime start hour (UTC)
daytime_end = 17 ;Daytime end hour (UTC)
......
......@@ -521,17 +521,16 @@ function check_quota($testconfig, $exclude_test = NULL, &$quota = NULL) {
// get scheduled tests / time for this user during office hours
$runtime_daytime = 0;
if ($CONFIG['tests']['quota_daytime']) {
$now = new DateTime();
$now->setTimeZone(new DateTimeZone("UTC"));
$curr_hour = intval($now->format('G'));
$this_start = -1;
if (isset($testconfig->generalConf->schedule->start)) {
$startdt = new DateTime($testconfig->generalConf->schedule->start);
$startdt->setTimeZone(new DateTimeZone("UTC"));
$this_start = intval($startdt->format('G'));
} else {
$startdt = new DateTime();
}
if (($this_start < 0 && $curr_hour >= $CONFIG['tests']['daytime_start'] && $curr_hour < $CONFIG['tests']['daytime_end']) ||
($this_start > $CONFIG['tests']['daytime_start'] && $this_start < $CONFIG['tests']['daytime_end'])) {
$startdt->setTimeZone(new DateTimeZone("UTC"));
$this_start = intval($startdt->format('G'));
$this_dayofweek = intval($startdt->format('N'));
if ($this_start >= $CONFIG['tests']['daytime_start'] && $this_start <= $CONFIG['tests']['daytime_end'] && $this_dayofweek < 6) {
// test starts during daytime (Mo-Fr)
$runtime_daytime = $this_runtime;
$sql = 'SELECT SUM(TIME_TO_SEC(TIMEDIFF(`time_end_wish`,`time_start_wish`)))/60 as runtime, COUNT(*) as test_num
FROM `tbl_serv_tests`
......
Markdown is supported
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