Class: JobWorkflow::AutoScaling::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/job_workflow/auto_scaling/configuration.rb,
sig/generated/job_workflow/auto_scaling/configuration.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(queue_name: "default", min_count: 1, max_count: 1, step_count: 1, max_latency: 3_600) ⇒ Configuration

: ( ?queue_name: String, ?min_count: Integer, ?max_count: Integer, ?step_count: Integer, ?max_latency: Integer ) -> void

Parameters:

  • queue_name: (String) (defaults to: "default")
  • min_count: (Integer) (defaults to: 1)
  • max_count: (Integer) (defaults to: 1)
  • step_count: (Integer) (defaults to: 1)
  • max_latency: (Integer) (defaults to: 3_600)


20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/job_workflow/auto_scaling/configuration.rb', line 20

def initialize(
  queue_name: "default",
  min_count: 1,
  max_count: 1,
  step_count: 1,
  max_latency: 3_600
)
  self.queue_name = queue_name
  self.min_count = min_count
  self.max_count = max_count
  self.step_count = step_count
  self.max_latency = max_latency
end

Instance Attribute Details

#max_countInteger

Signature:

  • Integer

Returns:

  • (Integer)


8
9
10
# File 'lib/job_workflow/auto_scaling/configuration.rb', line 8

def max_count
  @max_count
end

#max_latencyInteger

Signature:

  • Integer

Returns:

  • (Integer)


10
11
12
# File 'lib/job_workflow/auto_scaling/configuration.rb', line 10

def max_latency
  @max_latency
end

#min_countInteger

Signature:

  • Integer

Returns:

  • (Integer)


7
8
9
# File 'lib/job_workflow/auto_scaling/configuration.rb', line 7

def min_count
  @min_count
end

#queue_nameString

Signature:

  • String

Returns:

  • (String)


6
7
8
# File 'lib/job_workflow/auto_scaling/configuration.rb', line 6

def queue_name
  @queue_name
end

#step_countInteger

Signature:

  • Integer

Returns:

  • (Integer)


9
10
11
# File 'lib/job_workflow/auto_scaling/configuration.rb', line 9

def step_count
  @step_count
end

Instance Method Details

#assert_positive_number!(number) ⇒ void

This method returns an undefined value.

: (Integer) -> void

Parameters:

  • (Integer)


80
81
82
# File 'lib/job_workflow/auto_scaling/configuration.rb', line 80

def assert_positive_number!(number)
  raise ArgumentError unless number.positive?
end

#latency_per_step_countInteger

: () -> Integer

Returns:

  • (Integer)


35
36
37
38
39
# File 'lib/job_workflow/auto_scaling/configuration.rb', line 35

def latency_per_step_count
  (max_latency / ((1 + max_count - min_count).to_f / step_count).ceil).tap do |value|
    value.positive? || (raise Error, "latency per count isn't positive!")
  end
end