Skip to content

Commit

Permalink
Merge pull request #18539 from fdupont-redhat/v2v_use_settings_for_ma…
Browse files Browse the repository at this point in the history
…x_concurrent_tasks_per_ems

[V2V] Throttler - Replace class constant with global setting

(cherry picked from commit 5b6e5c5)

https://bugzilla.redhat.com/show_bug.cgi?id=1693746
  • Loading branch information
agrare authored and simaishi committed Apr 10, 2019
1 parent d0fa1a0 commit 59d5d16
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/infra_conversion_throttler.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
class InfraConversionThrottler
DEFAULT_EMS_MAX_RUNNERS = 10

def self.start_conversions
pending_conversion_jobs.each do |ems, jobs|
running = ems.conversion_hosts.inject(0) { |sum, ch| sum + ch.active_tasks.size }
slots = (ems.miq_custom_get('Max Transformation Runners') || DEFAULT_EMS_MAX_RUNNERS).to_i - running
slots = (ems.miq_custom_get('Max Transformation Runners') || Settings.transformation.limits.max_concurrent_tasks_per_ems).to_i - running
jobs.each do |job|
eligible_hosts = ems.conversion_hosts.select(&:eligible?).sort_by { |ch| ch.active_tasks.size }
break if slots <= 0 || eligible_hosts.empty?
Expand Down

0 comments on commit 59d5d16

Please sign in to comment.