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

Add timeout parameter for generic queue #466

Merged
merged 1 commit into from
Sep 17, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions jobs/cloud_controller_ng/spec
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ properties:
cc.jobs.global.timeout_in_seconds:
description: "The longest any job can take before it is cancelled unless overridden per job"
default: 14400 # 4 hours
cc.jobs.queues.cc_generic.timeout_in_seconds:
description: "The longest jobs in the cc-generic queue can take before they are cancelled"
cc.jobs.blobstore_delete.timeout_in_seconds:
description: "The longest this job can take before it is cancelled"
cc.jobs.droplet_upload.timeout_in_seconds:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ jobs:
enable_dynamic_job_priorities: <%= p("cc.jobs.enable_dynamic_job_priorities") %>
global:
timeout_in_seconds: <%= p("cc.jobs.global.timeout_in_seconds") %>
queues:
<% if_p("cc.jobs.queues.cc_generic.timeout_in_seconds") do |timeout| %>
cc_generic:
timeout_in_seconds: <%= timeout %>
<% end %>
<% if_p("cc.jobs.blobstore_delete.timeout_in_seconds") do |timeout| %>
blobstore_delete:
timeout_in_seconds: <%= timeout %>
Expand Down
18 changes: 18 additions & 0 deletions spec/cloud_controller_ng/cloud_controller_ng_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,24 @@ module Test
end
end
end

describe 'cc_jobs_queues' do
context 'when cc.jobs.queues is not set' do
it 'does not render ccng config' do
template_hash = YAML.safe_load(template.render(merged_manifest_properties, consumes: links))
expect(template_hash['jobs']['queues']).to be_nil
end
end

context "when 'cc.jobs.queues.cc_generic.timeout_in_seconds' is set" do
before { merged_manifest_properties['cc']['jobs'] = { 'queues' => { 'cc_generic' => { 'timeout_in_seconds' => 10 } } } }

it 'renders the correct value into the ccng config' do
template_hash = YAML.safe_load(template.render(merged_manifest_properties, consumes: links))
expect(template_hash['jobs']['queues']['cc_generic']['timeout_in_seconds']).to eq(10)
end
end
end
end
end
end
Expand Down