Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove defaults, should be ensured by OpenQA::Setup already #5287

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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