Skip to content

Commit

Permalink
Add flag with which dynamic job priorities can be enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
svkrieger committed Apr 9, 2024
1 parent e5f4b15 commit 9147d99
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions jobs/cloud_controller_ng/spec
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ properties:
description: "The longest this job can take before it is cancelled"
cc.jobs.priorities:
description: "List of hashes containing delayed jobs 'display_name' and its desired priority. This will overwrite the default priority of ccng"
cc.jobs.enable_dynamic_job_priorities:
description: "When enabled, the priority of asynchronous jobs will be increased by 1 for each active asynchronous job for that user.
This prevents that a single user, who creates many asynchronous jobs, slows down job execution for other users."
default: false

cc.temporary_disable_deployments:
description: "Do not allow the API client to create app deployments (temporary)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ reserved_private_domains: <%= p("cc.reserved_private_domains", nil) %>
disable_private_domain_cross_space_context_path_route_sharing: <%= p("cc.disable_private_domain_cross_space_context_path_route_sharing", false) %>

jobs:
enable_dynamic_job_priorities: <%= p("cc.jobs.enable_dynamic_job_priorities") %>
global:
timeout_in_seconds: <%= p("cc.jobs.global.timeout_in_seconds") %>
<% if_p("cc.jobs.blobstore_delete.timeout_in_seconds") do |timeout| %>
Expand Down
20 changes: 20 additions & 0 deletions spec/cloud_controller_ng/cloud_controller_ng_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,26 @@ module Test
end
end
end

describe 'enable_dynamic_job_priorities' do
context "when 'enable_dynamic_job_priorities' is set to true" do
before do
merged_manifest_properties['cc']['jobs'] = { 'enable_dynamic_job_priorities' => true }
end

it 'renders true into ccng config' do
template_hash = YAML.safe_load(template.render(merged_manifest_properties, consumes: links))
expect(template_hash['jobs']['enable_dynamic_job_priorities']).to be(true)
end
end

context "when 'enable_dynamic_job_priorities' is not set" do
it 'renders false into ccng config' do
template_hash = YAML.safe_load(template.render(merged_manifest_properties, consumes: links))
expect(template_hash['jobs']['enable_dynamic_job_priorities']).to be(false)
end
end
end
end
end
end
Expand Down

0 comments on commit 9147d99

Please sign in to comment.