Skip to content

Commit b71811f

Browse files
committed
Worker: use population as scale_factor
Remove unneeded import from worker
1 parent 48a399f commit b71811f

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

lib/OpenQA/Worker/Common.pm

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,21 +355,25 @@ sub calculate_status_timer {
355355
my ($hosts, $host) = @_;
356356
my $i = $hosts->{$host}{workerid} ? $hosts->{$host}{workerid} : looks_like_number($instance) ? $instance : 1;
357357
my $imax = $hosts->{$host}{population} ? $hosts->{$host}{population} : 1;
358-
my $scale_factor = 300;
358+
my $scale_factor = $imax;
359+
my $steps = 215;
360+
my $r = 3.81199961;
361+
362+
# my $scale_factor = 4;
363+
# my $scale_factor = (MAX_TIMER - MIN_TIMER)/MIN_TIMER;
364+
# log_debug("I: $i population: $imax scale_factor: $scale_factor");
359365

360366
# XXX: we are using now fixed values, to stick with a
361367
# predictable behavior but random intervals
362368
# seems to work as well.
363369
# my $steps = int(rand_range(2, 120));
364370
# my $r = rand_range(3.20, 3.88);
365371

366-
my $steps = 215;
367-
my $r = 3.81199961;
368-
my $population = feature_scaling($i, $imax, 0.1, 1);
372+
my $population = feature_scaling($i, $imax, 0, 1);
369373
my $status_timer
370-
= abs(feature_scaling(logistic_map_steps($steps, $r, $population), $imax, MIN_TIMER, MAX_TIMER) * $scale_factor);
371-
372-
$status_timer = $status_timer > MIN_TIMER && $status_timer < MAX_TIMER ? $status_timer : MIN_TIMER;
374+
= abs(feature_scaling(logistic_map_steps($steps, $r, $population) * $scale_factor, $imax, MIN_TIMER, MAX_TIMER));
375+
$status_timer = $status_timer > MIN_TIMER
376+
&& $status_timer < MAX_TIMER ? $status_timer : $status_timer > MAX_TIMER ? MAX_TIMER : MIN_TIMER;
373377
return int($status_timer);
374378
}
375379

script/worker

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ BEGIN {
100100

101101
use FindBin;
102102
use lib "$FindBin::Bin/../lib";
103-
use Scalar::Util 'looks_like_number';
104103
use Getopt::Long;
105104
Getopt::Long::Configure("no_ignore_case");
106105

0 commit comments

Comments
 (0)