iron_titan 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +100 -29
- data/lib/iron_titan/api/core_api.rb +71 -12
- data/lib/iron_titan/api/images_api.rb +32 -32
- data/lib/iron_titan/api/jobs_api.rb +335 -75
- data/lib/iron_titan/api_client.rb +2 -2
- data/lib/iron_titan/api_error.rb +1 -1
- data/lib/iron_titan/models/error.rb +1 -1
- data/lib/iron_titan/models/error_body.rb +1 -1
- data/lib/iron_titan/models/id_status.rb +182 -0
- data/lib/iron_titan/models/image.rb +8 -8
- data/lib/iron_titan/models/image_wrapper.rb +1 -1
- data/lib/iron_titan/models/images_wrapper.rb +1 -1
- data/lib/iron_titan/models/job.rb +110 -103
- data/lib/iron_titan/models/job_wrapper.rb +1 -1
- data/lib/iron_titan/models/jobs_wrapper.rb +15 -5
- data/lib/iron_titan/models/new_job.rb +27 -50
- data/lib/iron_titan/models/new_job_with_image.rb +249 -0
- data/lib/iron_titan/models/new_jobs_wrapper.rb +2 -2
- data/lib/iron_titan/models/reason.rb +152 -0
- data/lib/iron_titan/version.rb +2 -2
- data/lib/iron_titan.rb +11 -9
- data/spec/api/core_api_spec.rb +21 -5
- data/spec/api/images_api_spec.rb +12 -12
- data/spec/api/jobs_api_spec.rb +92 -24
- data/spec/models/Error_spec.rb +2 -2
- data/spec/models/Job_spec.rb +15 -25
- data/spec/models/error_body_spec.rb +2 -2
- data/spec/models/id_status_spec.rb +56 -0
- data/spec/models/image_spec.rb +3 -3
- data/spec/models/image_wrapper_spec.rb +2 -2
- data/spec/models/images_wrapper_spec.rb +2 -2
- data/spec/models/job_wrapper_spec.rb +2 -2
- data/spec/models/jobs_wrapper_spec.rb +12 -2
- data/spec/models/log_spec.rb +1 -1
- data/spec/models/new_job_spec.rb +3 -33
- data/spec/models/new_job_with_image_spec.rb +116 -0
- data/spec/models/new_jobs_wrapper_spec.rb +2 -2
- data/spec/models/reason_spec.rb +36 -0
- metadata +11 -2
@@ -3,7 +3,7 @@ Titan API
|
|
3
3
|
|
4
4
|
The ultimate, language agnostic, container based job processing framework.
|
5
5
|
|
6
|
-
OpenAPI spec version: 0.
|
6
|
+
OpenAPI spec version: 0.2.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
|
@@ -16,11 +16,15 @@ module IronTitan
|
|
16
16
|
class JobsWrapper
|
17
17
|
attr_accessor :jobs
|
18
18
|
|
19
|
+
attr_accessor :error
|
20
|
+
|
19
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
20
22
|
def self.attribute_map
|
21
23
|
{
|
22
24
|
|
23
|
-
:'jobs' => :'jobs'
|
25
|
+
:'jobs' => :'jobs',
|
26
|
+
|
27
|
+
:'error' => :'error'
|
24
28
|
|
25
29
|
}
|
26
30
|
end
|
@@ -28,7 +32,8 @@ module IronTitan
|
|
28
32
|
# Attribute type mapping.
|
29
33
|
def self.swagger_types
|
30
34
|
{
|
31
|
-
:'jobs' => :'Array<Job>'
|
35
|
+
:'jobs' => :'Array<Job>',
|
36
|
+
:'error' => :'ErrorBody'
|
32
37
|
|
33
38
|
}
|
34
39
|
end
|
@@ -46,13 +51,18 @@ module IronTitan
|
|
46
51
|
end
|
47
52
|
end
|
48
53
|
|
54
|
+
if attributes[:'error']
|
55
|
+
self.error = attributes[:'error']
|
56
|
+
end
|
57
|
+
|
49
58
|
end
|
50
59
|
|
51
60
|
# Check equality by comparing each attribute.
|
52
61
|
def ==(o)
|
53
62
|
return true if self.equal?(o)
|
54
63
|
self.class == o.class &&
|
55
|
-
jobs == o.jobs
|
64
|
+
jobs == o.jobs &&
|
65
|
+
error == o.error
|
56
66
|
end
|
57
67
|
|
58
68
|
# @see the `==` method
|
@@ -62,7 +72,7 @@ module IronTitan
|
|
62
72
|
|
63
73
|
# Calculate hash code according to all attributes.
|
64
74
|
def hash
|
65
|
-
[jobs].hash
|
75
|
+
[jobs, error].hash
|
66
76
|
end
|
67
77
|
|
68
78
|
# build the object from hash
|
@@ -3,7 +3,7 @@ Titan API
|
|
3
3
|
|
4
4
|
The ultimate, language agnostic, container based job processing framework.
|
5
5
|
|
6
|
-
OpenAPI spec version: 0.
|
6
|
+
OpenAPI spec version: 0.2.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
|
@@ -14,41 +14,28 @@ require 'date'
|
|
14
14
|
|
15
15
|
module IronTitan
|
16
16
|
class NewJob
|
17
|
-
#
|
18
|
-
attr_accessor :name
|
19
|
-
|
20
|
-
# Docker image to use for job.
|
21
|
-
attr_accessor :image
|
22
|
-
|
23
|
-
# Payload for the job. This is what you pass into each job to make it do something.
|
17
|
+
# Payload for the job. This is what you pass into each job to make it do something.
|
24
18
|
attr_accessor :payload
|
25
19
|
|
26
|
-
# Number of seconds to wait before
|
20
|
+
# Number of seconds to wait before queueing the job for consumption for the first time. Must be a positive integer. Jobs with a delay start in state \"delayed\" and transition to \"running\" after delay seconds.
|
27
21
|
attr_accessor :delay
|
28
22
|
|
29
|
-
# Maximum runtime in seconds. If
|
23
|
+
# Maximum runtime in seconds. If a consumer retrieves the job, but does not change it's status within timeout seconds, the job is considered failed, with reason timeout (Titan may allow a small grace period). The consumer should also kill the job after timeout seconds. If a consumer tries to change status after Titan has already timed out the job, the consumer will be ignored.
|
30
24
|
attr_accessor :timeout
|
31
25
|
|
32
|
-
# Priority of the job. 3 levels from 0-2.
|
26
|
+
# Priority of the job. Higher has more priority. 3 levels from 0-2. Jobs at same priority are processed in FIFO order.
|
33
27
|
attr_accessor :priority
|
34
28
|
|
35
|
-
#
|
36
|
-
attr_accessor :
|
29
|
+
# Number of automatic retries this job is allowed. A retry will be attempted if a task fails. Max 25.\nAutomatic retries are performed by titan when a task reaches a failed state and has `max_retries` > 0. A retry is performed by queueing a new job with the same image id and payload. The new job's max_retries is one less than the original. The new job's `retry_of` field is set to the original Job ID. Titan will delay the new job for retries_delay seconds before queueing it. Cancelled or successful tasks are never automatically retried.
|
30
|
+
attr_accessor :max_retries
|
37
31
|
|
38
|
-
# Time in seconds to wait before
|
32
|
+
# Time in seconds to wait before retrying the job. Must be a non-negative integer.
|
39
33
|
attr_accessor :retries_delay
|
40
34
|
|
41
|
-
# If this field is set, then this job is a retry of a previous job. retry_from_id points to the previous job.
|
42
|
-
attr_accessor :retry_from_id
|
43
|
-
|
44
35
|
# Attribute mapping from ruby-style variable name to JSON key.
|
45
36
|
def self.attribute_map
|
46
37
|
{
|
47
38
|
|
48
|
-
:'name' => :'name',
|
49
|
-
|
50
|
-
:'image' => :'image',
|
51
|
-
|
52
39
|
:'payload' => :'payload',
|
53
40
|
|
54
41
|
:'delay' => :'delay',
|
@@ -57,11 +44,9 @@ module IronTitan
|
|
57
44
|
|
58
45
|
:'priority' => :'priority',
|
59
46
|
|
60
|
-
:'
|
47
|
+
:'max_retries' => :'max_retries',
|
61
48
|
|
62
|
-
:'retries_delay' => :'retries_delay'
|
63
|
-
|
64
|
-
:'retry_from_id' => :'retry_from_id'
|
49
|
+
:'retries_delay' => :'retries_delay'
|
65
50
|
|
66
51
|
}
|
67
52
|
end
|
@@ -69,15 +54,12 @@ module IronTitan
|
|
69
54
|
# Attribute type mapping.
|
70
55
|
def self.swagger_types
|
71
56
|
{
|
72
|
-
:'name' => :'String',
|
73
|
-
:'image' => :'String',
|
74
57
|
:'payload' => :'String',
|
75
58
|
:'delay' => :'Integer',
|
76
59
|
:'timeout' => :'Integer',
|
77
60
|
:'priority' => :'Integer',
|
78
|
-
:'
|
79
|
-
:'retries_delay' => :'Integer'
|
80
|
-
:'retry_from_id' => :'String'
|
61
|
+
:'max_retries' => :'Integer',
|
62
|
+
:'retries_delay' => :'Integer'
|
81
63
|
|
82
64
|
}
|
83
65
|
end
|
@@ -89,40 +71,38 @@ module IronTitan
|
|
89
71
|
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
90
72
|
|
91
73
|
|
92
|
-
if attributes[:'name']
|
93
|
-
self.name = attributes[:'name']
|
94
|
-
end
|
95
|
-
|
96
|
-
if attributes[:'image']
|
97
|
-
self.image = attributes[:'image']
|
98
|
-
end
|
99
|
-
|
100
74
|
if attributes[:'payload']
|
101
75
|
self.payload = attributes[:'payload']
|
102
76
|
end
|
103
77
|
|
104
78
|
if attributes[:'delay']
|
105
79
|
self.delay = attributes[:'delay']
|
80
|
+
else
|
81
|
+
self.delay = 0
|
106
82
|
end
|
107
83
|
|
108
84
|
if attributes[:'timeout']
|
109
85
|
self.timeout = attributes[:'timeout']
|
86
|
+
else
|
87
|
+
self.timeout = 60
|
110
88
|
end
|
111
89
|
|
112
90
|
if attributes[:'priority']
|
113
91
|
self.priority = attributes[:'priority']
|
92
|
+
else
|
93
|
+
self.priority = 0
|
114
94
|
end
|
115
95
|
|
116
|
-
if attributes[:'
|
117
|
-
self.
|
96
|
+
if attributes[:'max_retries']
|
97
|
+
self.max_retries = attributes[:'max_retries']
|
98
|
+
else
|
99
|
+
self.max_retries = 3
|
118
100
|
end
|
119
101
|
|
120
102
|
if attributes[:'retries_delay']
|
121
103
|
self.retries_delay = attributes[:'retries_delay']
|
122
|
-
|
123
|
-
|
124
|
-
if attributes[:'retry_from_id']
|
125
|
-
self.retry_from_id = attributes[:'retry_from_id']
|
104
|
+
else
|
105
|
+
self.retries_delay = 60
|
126
106
|
end
|
127
107
|
|
128
108
|
end
|
@@ -131,15 +111,12 @@ module IronTitan
|
|
131
111
|
def ==(o)
|
132
112
|
return true if self.equal?(o)
|
133
113
|
self.class == o.class &&
|
134
|
-
name == o.name &&
|
135
|
-
image == o.image &&
|
136
114
|
payload == o.payload &&
|
137
115
|
delay == o.delay &&
|
138
116
|
timeout == o.timeout &&
|
139
117
|
priority == o.priority &&
|
140
|
-
|
141
|
-
retries_delay == o.retries_delay
|
142
|
-
retry_from_id == o.retry_from_id
|
118
|
+
max_retries == o.max_retries &&
|
119
|
+
retries_delay == o.retries_delay
|
143
120
|
end
|
144
121
|
|
145
122
|
# @see the `==` method
|
@@ -149,7 +126,7 @@ module IronTitan
|
|
149
126
|
|
150
127
|
# Calculate hash code according to all attributes.
|
151
128
|
def hash
|
152
|
-
[
|
129
|
+
[payload, delay, timeout, priority, max_retries, retries_delay].hash
|
153
130
|
end
|
154
131
|
|
155
132
|
# build the object from hash
|
@@ -0,0 +1,249 @@
|
|
1
|
+
=begin
|
2
|
+
Titan API
|
3
|
+
|
4
|
+
The ultimate, language agnostic, container based job processing framework.
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module IronTitan
|
16
|
+
class NewJobWithImage
|
17
|
+
# Payload for the job. This is what you pass into each job to make it do something.
|
18
|
+
attr_accessor :payload
|
19
|
+
|
20
|
+
# Number of seconds to wait before queueing the job for consumption for the first time. Must be a positive integer. Jobs with a delay start in state \"delayed\" and transition to \"running\" after delay seconds.
|
21
|
+
attr_accessor :delay
|
22
|
+
|
23
|
+
# Maximum runtime in seconds. If a consumer retrieves the job, but does not change it's status within timeout seconds, the job is considered failed, with reason timeout (Titan may allow a small grace period). The consumer should also kill the job after timeout seconds. If a consumer tries to change status after Titan has already timed out the job, the consumer will be ignored.
|
24
|
+
attr_accessor :timeout
|
25
|
+
|
26
|
+
# Priority of the job. Higher has more priority. 3 levels from 0-2. Jobs at same priority are processed in FIFO order.
|
27
|
+
attr_accessor :priority
|
28
|
+
|
29
|
+
# Number of automatic retries this job is allowed. A retry will be attempted if a task fails. Max 25.\nAutomatic retries are performed by titan when a task reaches a failed state and has `max_retries` > 0. A retry is performed by queueing a new job with the same image id and payload. The new job's max_retries is one less than the original. The new job's `retry_of` field is set to the original Job ID. Titan will delay the new job for retries_delay seconds before queueing it. Cancelled or successful tasks are never automatically retried.
|
30
|
+
attr_accessor :max_retries
|
31
|
+
|
32
|
+
# Time in seconds to wait before retrying the job. Must be a non-negative integer.
|
33
|
+
attr_accessor :retries_delay
|
34
|
+
|
35
|
+
# Docker image to use for job.
|
36
|
+
attr_accessor :image
|
37
|
+
|
38
|
+
# Time when image first used/created.
|
39
|
+
attr_accessor :created_at
|
40
|
+
|
41
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
42
|
+
def self.attribute_map
|
43
|
+
{
|
44
|
+
|
45
|
+
:'payload' => :'payload',
|
46
|
+
|
47
|
+
:'delay' => :'delay',
|
48
|
+
|
49
|
+
:'timeout' => :'timeout',
|
50
|
+
|
51
|
+
:'priority' => :'priority',
|
52
|
+
|
53
|
+
:'max_retries' => :'max_retries',
|
54
|
+
|
55
|
+
:'retries_delay' => :'retries_delay',
|
56
|
+
|
57
|
+
:'image' => :'image',
|
58
|
+
|
59
|
+
:'created_at' => :'created_at'
|
60
|
+
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Attribute type mapping.
|
65
|
+
def self.swagger_types
|
66
|
+
{
|
67
|
+
:'payload' => :'String',
|
68
|
+
:'delay' => :'Integer',
|
69
|
+
:'timeout' => :'Integer',
|
70
|
+
:'priority' => :'Integer',
|
71
|
+
:'max_retries' => :'Integer',
|
72
|
+
:'retries_delay' => :'Integer',
|
73
|
+
:'image' => :'String',
|
74
|
+
:'created_at' => :'DateTime'
|
75
|
+
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
def initialize(attributes = {})
|
80
|
+
return unless attributes.is_a?(Hash)
|
81
|
+
|
82
|
+
# convert string to symbol for hash key
|
83
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
84
|
+
|
85
|
+
|
86
|
+
if attributes[:'payload']
|
87
|
+
self.payload = attributes[:'payload']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes[:'delay']
|
91
|
+
self.delay = attributes[:'delay']
|
92
|
+
else
|
93
|
+
self.delay = 0
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes[:'timeout']
|
97
|
+
self.timeout = attributes[:'timeout']
|
98
|
+
else
|
99
|
+
self.timeout = 60
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes[:'priority']
|
103
|
+
self.priority = attributes[:'priority']
|
104
|
+
else
|
105
|
+
self.priority = 0
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes[:'max_retries']
|
109
|
+
self.max_retries = attributes[:'max_retries']
|
110
|
+
else
|
111
|
+
self.max_retries = 3
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes[:'retries_delay']
|
115
|
+
self.retries_delay = attributes[:'retries_delay']
|
116
|
+
else
|
117
|
+
self.retries_delay = 60
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes[:'image']
|
121
|
+
self.image = attributes[:'image']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes[:'created_at']
|
125
|
+
self.created_at = attributes[:'created_at']
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
# Check equality by comparing each attribute.
|
131
|
+
def ==(o)
|
132
|
+
return true if self.equal?(o)
|
133
|
+
self.class == o.class &&
|
134
|
+
payload == o.payload &&
|
135
|
+
delay == o.delay &&
|
136
|
+
timeout == o.timeout &&
|
137
|
+
priority == o.priority &&
|
138
|
+
max_retries == o.max_retries &&
|
139
|
+
retries_delay == o.retries_delay &&
|
140
|
+
image == o.image &&
|
141
|
+
created_at == o.created_at
|
142
|
+
end
|
143
|
+
|
144
|
+
# @see the `==` method
|
145
|
+
def eql?(o)
|
146
|
+
self == o
|
147
|
+
end
|
148
|
+
|
149
|
+
# Calculate hash code according to all attributes.
|
150
|
+
def hash
|
151
|
+
[payload, delay, timeout, priority, max_retries, retries_delay, image, created_at].hash
|
152
|
+
end
|
153
|
+
|
154
|
+
# build the object from hash
|
155
|
+
def build_from_hash(attributes)
|
156
|
+
return nil unless attributes.is_a?(Hash)
|
157
|
+
self.class.swagger_types.each_pair do |key, type|
|
158
|
+
if type =~ /^Array<(.*)>/i
|
159
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
160
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
161
|
+
else
|
162
|
+
#TODO show warning in debug mode
|
163
|
+
end
|
164
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
165
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
166
|
+
else
|
167
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
self
|
172
|
+
end
|
173
|
+
|
174
|
+
def _deserialize(type, value)
|
175
|
+
case type.to_sym
|
176
|
+
when :DateTime
|
177
|
+
DateTime.parse(value)
|
178
|
+
when :Date
|
179
|
+
Date.parse(value)
|
180
|
+
when :String
|
181
|
+
value.to_s
|
182
|
+
when :Integer
|
183
|
+
value.to_i
|
184
|
+
when :Float
|
185
|
+
value.to_f
|
186
|
+
when :BOOLEAN
|
187
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
188
|
+
true
|
189
|
+
else
|
190
|
+
false
|
191
|
+
end
|
192
|
+
when :Object
|
193
|
+
# generic object (usually a Hash), return directly
|
194
|
+
value
|
195
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
196
|
+
inner_type = Regexp.last_match[:inner_type]
|
197
|
+
value.map { |v| _deserialize(inner_type, v) }
|
198
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
199
|
+
k_type = Regexp.last_match[:k_type]
|
200
|
+
v_type = Regexp.last_match[:v_type]
|
201
|
+
{}.tap do |hash|
|
202
|
+
value.each do |k, v|
|
203
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
else # model
|
207
|
+
_model = IronTitan.const_get(type).new
|
208
|
+
_model.build_from_hash(value)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def to_s
|
213
|
+
to_hash.to_s
|
214
|
+
end
|
215
|
+
|
216
|
+
# to_body is an alias to to_body (backward compatibility))
|
217
|
+
def to_body
|
218
|
+
to_hash
|
219
|
+
end
|
220
|
+
|
221
|
+
# return the object in the form of hash
|
222
|
+
def to_hash
|
223
|
+
hash = {}
|
224
|
+
self.class.attribute_map.each_pair do |attr, param|
|
225
|
+
value = self.send(attr)
|
226
|
+
next if value.nil?
|
227
|
+
hash[param] = _to_hash(value)
|
228
|
+
end
|
229
|
+
hash
|
230
|
+
end
|
231
|
+
|
232
|
+
# Method to output non-array value in the form of hash
|
233
|
+
# For object, use to_hash. Otherwise, just return the value
|
234
|
+
def _to_hash(value)
|
235
|
+
if value.is_a?(Array)
|
236
|
+
value.compact.map{ |v| _to_hash(v) }
|
237
|
+
elsif value.is_a?(Hash)
|
238
|
+
{}.tap do |hash|
|
239
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
240
|
+
end
|
241
|
+
elsif value.respond_to? :to_hash
|
242
|
+
value.to_hash
|
243
|
+
else
|
244
|
+
value
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
249
|
+
end
|
@@ -3,7 +3,7 @@ Titan API
|
|
3
3
|
|
4
4
|
The ultimate, language agnostic, container based job processing framework.
|
5
5
|
|
6
|
-
OpenAPI spec version: 0.
|
6
|
+
OpenAPI spec version: 0.2.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
|
@@ -28,7 +28,7 @@ module IronTitan
|
|
28
28
|
# Attribute type mapping.
|
29
29
|
def self.swagger_types
|
30
30
|
{
|
31
|
-
:'jobs' => :'Array<
|
31
|
+
:'jobs' => :'Array<NewJobWithImage>'
|
32
32
|
|
33
33
|
}
|
34
34
|
end
|
@@ -0,0 +1,152 @@
|
|
1
|
+
=begin
|
2
|
+
Titan API
|
3
|
+
|
4
|
+
The ultimate, language agnostic, container based job processing framework.
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module IronTitan
|
16
|
+
# Machine usable reason for job being in this state. See `details` for more information (if any).\n\nValid values for error status are `timeout | killed | bad_exit`.\nValid values for cancelled status are `client_request`.\nFor everything else, this is undefined.
|
17
|
+
class Reason
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
+
def self.attribute_map
|
20
|
+
{
|
21
|
+
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
# Attribute type mapping.
|
26
|
+
def self.swagger_types
|
27
|
+
{
|
28
|
+
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(attributes = {})
|
33
|
+
return unless attributes.is_a?(Hash)
|
34
|
+
|
35
|
+
# convert string to symbol for hash key
|
36
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
37
|
+
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
# Check equality by comparing each attribute.
|
42
|
+
def ==(o)
|
43
|
+
return true if self.equal?(o)
|
44
|
+
self.class == o.class
|
45
|
+
end
|
46
|
+
|
47
|
+
# @see the `==` method
|
48
|
+
def eql?(o)
|
49
|
+
self == o
|
50
|
+
end
|
51
|
+
|
52
|
+
# Calculate hash code according to all attributes.
|
53
|
+
def hash
|
54
|
+
[].hash
|
55
|
+
end
|
56
|
+
|
57
|
+
# build the object from hash
|
58
|
+
def build_from_hash(attributes)
|
59
|
+
return nil unless attributes.is_a?(Hash)
|
60
|
+
self.class.swagger_types.each_pair do |key, type|
|
61
|
+
if type =~ /^Array<(.*)>/i
|
62
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
63
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
64
|
+
else
|
65
|
+
#TODO show warning in debug mode
|
66
|
+
end
|
67
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
68
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
69
|
+
else
|
70
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
self
|
75
|
+
end
|
76
|
+
|
77
|
+
def _deserialize(type, value)
|
78
|
+
case type.to_sym
|
79
|
+
when :DateTime
|
80
|
+
DateTime.parse(value)
|
81
|
+
when :Date
|
82
|
+
Date.parse(value)
|
83
|
+
when :String
|
84
|
+
value.to_s
|
85
|
+
when :Integer
|
86
|
+
value.to_i
|
87
|
+
when :Float
|
88
|
+
value.to_f
|
89
|
+
when :BOOLEAN
|
90
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
91
|
+
true
|
92
|
+
else
|
93
|
+
false
|
94
|
+
end
|
95
|
+
when :Object
|
96
|
+
# generic object (usually a Hash), return directly
|
97
|
+
value
|
98
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
99
|
+
inner_type = Regexp.last_match[:inner_type]
|
100
|
+
value.map { |v| _deserialize(inner_type, v) }
|
101
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
102
|
+
k_type = Regexp.last_match[:k_type]
|
103
|
+
v_type = Regexp.last_match[:v_type]
|
104
|
+
{}.tap do |hash|
|
105
|
+
value.each do |k, v|
|
106
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
else # model
|
110
|
+
_model = IronTitan.const_get(type).new
|
111
|
+
_model.build_from_hash(value)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def to_s
|
116
|
+
to_hash.to_s
|
117
|
+
end
|
118
|
+
|
119
|
+
# to_body is an alias to to_body (backward compatibility))
|
120
|
+
def to_body
|
121
|
+
to_hash
|
122
|
+
end
|
123
|
+
|
124
|
+
# return the object in the form of hash
|
125
|
+
def to_hash
|
126
|
+
hash = {}
|
127
|
+
self.class.attribute_map.each_pair do |attr, param|
|
128
|
+
value = self.send(attr)
|
129
|
+
next if value.nil?
|
130
|
+
hash[param] = _to_hash(value)
|
131
|
+
end
|
132
|
+
hash
|
133
|
+
end
|
134
|
+
|
135
|
+
# Method to output non-array value in the form of hash
|
136
|
+
# For object, use to_hash. Otherwise, just return the value
|
137
|
+
def _to_hash(value)
|
138
|
+
if value.is_a?(Array)
|
139
|
+
value.compact.map{ |v| _to_hash(v) }
|
140
|
+
elsif value.is_a?(Hash)
|
141
|
+
{}.tap do |hash|
|
142
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
143
|
+
end
|
144
|
+
elsif value.respond_to? :to_hash
|
145
|
+
value.to_hash
|
146
|
+
else
|
147
|
+
value
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
end
|
data/lib/iron_titan/version.rb
CHANGED
@@ -3,7 +3,7 @@ Titan API
|
|
3
3
|
|
4
4
|
The ultimate, language agnostic, container based job processing framework.
|
5
5
|
|
6
|
-
OpenAPI spec version: 0.
|
6
|
+
OpenAPI spec version: 0.2.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
|
@@ -11,5 +11,5 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
module IronTitan
|
14
|
-
VERSION = "0.
|
14
|
+
VERSION = "0.2.0"
|
15
15
|
end
|