Skip to content

Commit

Permalink
Remove defaults, should be ensured by OpenQA::Setup already
Browse files Browse the repository at this point in the history
  • Loading branch information
perlpunk committed Aug 17, 2023
1 parent 9dd2c86 commit acc5f55
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lib/OpenQA/Scheduler/Model/Jobs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ sub schedule ($self, $allocated_workers = {}, $allocated_jobs = {}) {
my $worker_count = $schema->resultset('Workers')->count;
my $free_worker_count = @$free_workers;
my $running = $schema->resultset('Jobs')->count({state => [OpenQA::Jobs::Constants::EXECUTION_STATES]});
my $limit = OpenQA::App->singleton->config->{scheduler}->{max_running_jobs} // -1;
my $limit = OpenQA::App->singleton->config->{scheduler}->{max_running_jobs};
if ($limit >= 0 && $running >= $limit) {
log_debug("max_running_jobs ($limit) exceeded, scheduling no additional jobs");
$self->emit('conclude');
Expand Down Expand Up @@ -361,8 +361,7 @@ sub _to_be_scheduled ($j, $scheduled) {

sub _update_scheduled_jobs ($self) {
my $cur_time = DateTime->now(time_zone => 'UTC');
my $max_job_scheduled_time = $self->{config}->{scheduler}->{max_job_scheduled_time}
// 7; # default value reused for testsuite
my $max_job_scheduled_time = OpenQA::App->singleton->config->{scheduler}->{max_job_scheduled_time};

# consider all scheduled jobs not being blocked by a parent job or Gru task
my $schema = OpenQA::Schema->singleton;
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/WebAPI/Controller/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ sub list_running_ajax {
});
}
my %response = (data => \@running);
my $max_running = OpenQA::App->singleton->config->{scheduler}->{max_running_jobs} // -1;
my $max_running = OpenQA::App->singleton->config->{scheduler}->{max_running_jobs};
$response{max_running_jobs} = $max_running if $max_running >= 0 && @running >= $max_running;
$self->render(json => \%response);
}
Expand Down
1 change: 1 addition & 0 deletions t/05-scheduler-capabilities.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use Mojo::Util 'monkey_patch';
use OpenQA::Test::TimeLimit '10';

setup_mojo_app_with_default_worker_timeout;
OpenQA::Setup::read_config(OpenQA::App->singleton);

my $schema = OpenQA::Test::Database->new->create;
my $sent = {};
Expand Down
1 change: 1 addition & 0 deletions t/05-scheduler-full.t
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ use OpenQA::Test::TimeLimit '150';
plan skip_all => "set FULLSTACK=1 (be careful)" unless $ENV{FULLSTACK};

setup_mojo_app_with_default_worker_timeout;
OpenQA::Setup::read_config(OpenQA::App->singleton);

# setup directories and database
my $tempdir = setup_fullstack_temp_dir('scheduler');
Expand Down
1 change: 1 addition & 0 deletions t/43-scheduling-and-worker-scalability.t
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ BEGIN {
}

setup_mojo_app_with_default_worker_timeout;
OpenQA::Setup::read_config(OpenQA::App->singleton);

# read number of workers to spawn from environment variable; skip test entirely if variable not present
# similar to other fullstack tests
Expand Down

0 comments on commit acc5f55

Please sign in to comment.