Class: KubeQueue::JobSpecification
- Inherits:
-
Object
- Object
- KubeQueue::JobSpecification
show all
- Defined in:
- lib/kube_queue/job_specification.rb
Defined Under Namespace
Classes: MissingParameterError
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of JobSpecification.
17
18
19
|
# File 'lib/kube_queue/job_specification.rb', line 17
def initialize(job_class)
@job_class = job_class
end
|
Instance Attribute Details
#active_deadline_seconds ⇒ Object
Returns the value of attribute active_deadline_seconds.
10
11
12
|
# File 'lib/kube_queue/job_specification.rb', line 10
def active_deadline_seconds
@active_deadline_seconds
end
|
#backoff_limit ⇒ Object
Returns the value of attribute backoff_limit.
10
11
12
|
# File 'lib/kube_queue/job_specification.rb', line 10
def backoff_limit
@backoff_limit
end
|
#command ⇒ Object
41
42
43
|
# File 'lib/kube_queue/job_specification.rb', line 41
def command
@command || ['bundle', 'exec', 'kube_queue', 'runner', job_class.name]
end
|
#concurrent_policy ⇒ Object
73
74
75
|
# File 'lib/kube_queue/job_specification.rb', line 73
def concurrent_policy
@concurrent_policy || 'Allow'
end
|
#container_name ⇒ Object
37
38
39
|
# File 'lib/kube_queue/job_specification.rb', line 37
def container_name
@container_name || worker_name
end
|
#cpu_limit ⇒ Object
Returns the value of attribute cpu_limit.
10
11
12
|
# File 'lib/kube_queue/job_specification.rb', line 10
def cpu_limit
@cpu_limit
end
|
#cpu_request ⇒ Object
Returns the value of attribute cpu_request.
10
11
12
|
# File 'lib/kube_queue/job_specification.rb', line 10
def cpu_request
@cpu_request
end
|
#env ⇒ Object
57
58
59
|
# File 'lib/kube_queue/job_specification.rb', line 57
def env
KubeQueue.default_env.merge(@env || {})
end
|
#env_from_config_map ⇒ Object
61
62
63
|
# File 'lib/kube_queue/job_specification.rb', line 61
def env_from_config_map
@env_from_config_map || []
end
|
#env_from_secret ⇒ Object
65
66
67
|
# File 'lib/kube_queue/job_specification.rb', line 65
def env_from_secret
@env_from_config_map || []
end
|
#image ⇒ Object
25
26
27
|
# File 'lib/kube_queue/job_specification.rb', line 25
def image
@image || raise_not_found_required_parameter('image')
end
|
#job_class ⇒ Object
Returns the value of attribute job_class.
8
9
10
|
# File 'lib/kube_queue/job_specification.rb', line 8
def job_class
@job_class
end
|
#job_labels ⇒ Object
49
50
51
|
# File 'lib/kube_queue/job_specification.rb', line 49
def job_labels
@job_labels || {}
end
|
#memory_limit ⇒ Object
Returns the value of attribute memory_limit.
10
11
12
|
# File 'lib/kube_queue/job_specification.rb', line 10
def memory_limit
@memory_limit
end
|
#memory_request ⇒ Object
Returns the value of attribute memory_request.
10
11
12
|
# File 'lib/kube_queue/job_specification.rb', line 10
def memory_request
@memory_request
end
|
#name ⇒ Object
Returns the value of attribute name.
10
11
12
|
# File 'lib/kube_queue/job_specification.rb', line 10
def name
@name
end
|
#namespace ⇒ Object
29
30
31
|
# File 'lib/kube_queue/job_specification.rb', line 29
def namespace
@namespace || 'default'
end
|
#payload ⇒ Object
Returns the value of attribute payload.
10
11
12
|
# File 'lib/kube_queue/job_specification.rb', line 10
def payload
@payload
end
|
#pod_labels ⇒ Object
53
54
55
|
# File 'lib/kube_queue/job_specification.rb', line 53
def pod_labels
@pod_labels || {}
end
|
#restart_policy ⇒ Object
45
46
47
|
# File 'lib/kube_queue/job_specification.rb', line 45
def restart_policy
@restart_policy || 'Never'
end
|
#starting_deadline_seconds ⇒ Object
Returns the value of attribute starting_deadline_seconds.
10
11
12
|
# File 'lib/kube_queue/job_specification.rb', line 10
def starting_deadline_seconds
@starting_deadline_seconds
end
|
#worker_name ⇒ Object
33
34
35
|
# File 'lib/kube_queue/job_specification.rb', line 33
def worker_name
@worker_name || raise_not_found_required_parameter('worker_name')
end
|
Instance Method Details
#env_from_exists? ⇒ Boolean
69
70
71
|
# File 'lib/kube_queue/job_specification.rb', line 69
def env_from_exists?
!env_from_config_map.empty? && !env_from_secret.empty?
end
|
#job_name(job_id) ⇒ Object
21
22
23
|
# File 'lib/kube_queue/job_specification.rb', line 21
def job_name(job_id)
"#{worker_name}-#{job_id}"
end
|
#raise_not_found_required_parameter(field) ⇒ Object
81
82
83
|
# File 'lib/kube_queue/job_specification.rb', line 81
def raise_not_found_required_parameter(field)
raise MissingParameterError, "#{field} is required"
end
|
#resources_exists? ⇒ Boolean
77
78
79
|
# File 'lib/kube_queue/job_specification.rb', line 77
def resources_exists?
@cpu_limit || @memory_limit || @cpu_request || @memory_request
end
|