Commit 12f45fdb authored by Grzegorz Bizon's avatar Grzegorz Bizon

Split ci_queuing_disaster_recovery into two feature flags

parent f7ccd64c
...@@ -18,7 +18,7 @@ module Ci ...@@ -18,7 +18,7 @@ module Ci
.joins('LEFT JOIN project_features ON ci_builds.project_id = project_features.project_id') .joins('LEFT JOIN project_features ON ci_builds.project_id = project_features.project_id')
.where('project_features.builds_access_level IS NULL or project_features.builds_access_level > 0') .where('project_features.builds_access_level IS NULL or project_features.builds_access_level > 0')
if Feature.enabled?(:ci_queueing_disaster_recovery, runner, type: :ops, default_enabled: :yaml) if Feature.enabled?(:ci_queueing_disaster_recovery_disable_fair_scheduling, runner, type: :ops, default_enabled: :yaml)
# if disaster recovery is enabled, we fallback to FIFO scheduling # if disaster recovery is enabled, we fallback to FIFO scheduling
relation.order('ci_builds.id ASC') relation.order('ci_builds.id ASC')
else else
......
...@@ -18,7 +18,7 @@ module Ci ...@@ -18,7 +18,7 @@ module Ci
.joins('LEFT JOIN project_features ON ci_pending_builds.project_id = project_features.project_id') .joins('LEFT JOIN project_features ON ci_pending_builds.project_id = project_features.project_id')
.where('project_features.builds_access_level IS NULL or project_features.builds_access_level > 0') .where('project_features.builds_access_level IS NULL or project_features.builds_access_level > 0')
if Feature.enabled?(:ci_queueing_disaster_recovery, runner, type: :ops, default_enabled: :yaml) if Feature.enabled?(:ci_queueing_disaster_recovery_disable_fair_scheduling, runner, type: :ops, default_enabled: :yaml)
# if disaster recovery is enabled, we fallback to FIFO scheduling # if disaster recovery is enabled, we fallback to FIFO scheduling
relation.order('ci_pending_builds.build_id ASC') relation.order('ci_pending_builds.build_id ASC')
else else
......
---
name: ci_queueing_disaster_recovery_disable_fair_scheduling
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56658
rollout_issue_url:
milestone: "13.12"
type: ops
group: group::pipeline execution
default_enabled: false
---
name: ci_queueing_disaster_recovery_disable_quota
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56658
rollout_issue_url:
milestone: "13.12"
type: ops
group: group::pipeline execution
default_enabled: false
...@@ -10,7 +10,7 @@ type: reference ...@@ -10,7 +10,7 @@ type: reference
This document describes a feature that allows you to disable some important but computationally This document describes a feature that allows you to disable some important but computationally
expensive parts of the application to relieve stress on the database during an ongoing downtime. expensive parts of the application to relieve stress on the database during an ongoing downtime.
## `ci_queueing_disaster_recovery` ## `ci_queueing_disaster_recovery_disable_fair_scheduling`
This feature flag, if temporarily enabled, disables fair scheduling on shared runners. This feature flag, if temporarily enabled, disables fair scheduling on shared runners.
This can help to reduce system resource usage on the `jobs/request` endpoint This can help to reduce system resource usage on the `jobs/request` endpoint
...@@ -20,6 +20,16 @@ Side effects: ...@@ -20,6 +20,16 @@ Side effects:
- In case of a large backlog of jobs, the jobs are processed in the order - In case of a large backlog of jobs, the jobs are processed in the order
they were put in the system, instead of balancing the jobs across many projects. they were put in the system, instead of balancing the jobs across many projects.
## `ci_queueing_disaster_recovery_disable_quota`
This feature flag, if temporarily enabled, disables enforcing CI minutes quota
on shared runners. This can help to reduce system resource usage on the
`jobs/request` endpoint by significantly reducing the computations being
performed.
Side effects:
- Projects which are out of quota will be run. This affects - Projects which are out of quota will be run. This affects
only jobs created during the last hour, as prior jobs are canceled only jobs created during the last hour, as prior jobs are canceled
by a periodic background worker (`StuckCiJobsWorker`). by a periodic background worker (`StuckCiJobsWorker`).
...@@ -10,7 +10,7 @@ module EE ...@@ -10,7 +10,7 @@ module EE
override :builds_for_shared_runner override :builds_for_shared_runner
def builds_for_shared_runner def builds_for_shared_runner
# if disaster recovery is enabled, we disable quota # if disaster recovery is enabled, we disable quota
if ::Feature.enabled?(:ci_queueing_disaster_recovery, runner, type: :ops, default_enabled: :yaml) if ::Feature.enabled?(:ci_queueing_disaster_recovery_disable_quota, runner, type: :ops, default_enabled: :yaml)
super super
else else
enforce_minutes_based_on_cost_factors(super) enforce_minutes_based_on_cost_factors(super)
......
...@@ -37,7 +37,7 @@ RSpec.describe Ci::RegisterJobService, '#execute' do ...@@ -37,7 +37,7 @@ RSpec.describe Ci::RegisterJobService, '#execute' do
end end
it 'when in disaster recovery it ignores quota and returns anyway' do it 'when in disaster recovery it ignores quota and returns anyway' do
stub_feature_flags(ci_queueing_disaster_recovery: true) stub_feature_flags(ci_queueing_disaster_recovery_disable_quota: true)
is_expected.to be_kind_of(Ci::Build) is_expected.to be_kind_of(Ci::Build)
end end
...@@ -67,7 +67,7 @@ RSpec.describe Ci::RegisterJobService, '#execute' do ...@@ -67,7 +67,7 @@ RSpec.describe Ci::RegisterJobService, '#execute' do
end end
it 'when in disaster recovery it ignores quota and returns anyway' do it 'when in disaster recovery it ignores quota and returns anyway' do
stub_feature_flags(ci_queueing_disaster_recovery: true) stub_feature_flags(ci_queueing_disaster_recovery_disable_quota: true)
is_expected.to be_kind_of(Ci::Build) is_expected.to be_kind_of(Ci::Build)
end end
......
...@@ -145,7 +145,7 @@ module Ci ...@@ -145,7 +145,7 @@ module Ci
context 'when using DEFCON mode that disables fair scheduling' do context 'when using DEFCON mode that disables fair scheduling' do
before do before do
stub_feature_flags(ci_queueing_disaster_recovery: true) stub_feature_flags(ci_queueing_disaster_recovery_disable_fair_scheduling: true)
end end
context 'when all builds are pending' do context 'when all builds are pending' do
......
...@@ -260,8 +260,9 @@ RSpec.configure do |config| ...@@ -260,8 +260,9 @@ RSpec.configure do |config|
# tests, until we introduce it in user settings # tests, until we introduce it in user settings
stub_feature_flags(forti_token_cloud: false) stub_feature_flags(forti_token_cloud: false)
# This feature flag is by default disabled and used in disaster recovery mode # These feature flag are by default disabled and used in disaster recovery mode
stub_feature_flags(ci_queueing_disaster_recovery: false) stub_feature_flags(ci_queueing_disaster_recovery_disable_fair_scheduling: false)
stub_feature_flags(ci_queueing_disaster_recovery_disable_quota: false)
enable_rugged = example.metadata[:enable_rugged].present? enable_rugged = example.metadata[:enable_rugged].present?
......
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