iron_titan 0.3.1 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -7
- data/lib/iron_titan/api/groups_api.rb +61 -1
- data/lib/iron_titan/api/jobs_api.rb +54 -50
- data/lib/iron_titan/api/runner_api.rb +233 -0
- data/lib/iron_titan/api_client.rb +1 -1
- data/lib/iron_titan/api_error.rb +1 -1
- data/lib/iron_titan/models/complete.rb +184 -0
- data/lib/iron_titan/models/error.rb +1 -1
- data/lib/iron_titan/models/error_body.rb +1 -1
- data/lib/iron_titan/models/group.rb +1 -1
- data/lib/iron_titan/models/group_wrapper.rb +1 -1
- data/lib/iron_titan/models/groups_wrapper.rb +1 -1
- data/lib/iron_titan/models/id_status.rb +1 -1
- data/lib/iron_titan/models/job.rb +31 -12
- data/lib/iron_titan/models/job_wrapper.rb +1 -1
- data/lib/iron_titan/models/jobs_wrapper.rb +1 -1
- data/lib/iron_titan/models/new_job.rb +2 -4
- data/lib/iron_titan/models/new_jobs_wrapper.rb +1 -1
- data/lib/iron_titan/models/reason.rb +30 -18
- data/lib/iron_titan/models/start.rb +162 -0
- data/lib/iron_titan/version.rb +2 -2
- data/lib/iron_titan.rb +4 -2
- data/spec/api/groups_api_spec.rb +17 -1
- data/spec/api/jobs_api_spec.rb +14 -13
- data/spec/api/runner_api_spec.rb +89 -0
- data/spec/models/complete_spec.rb +66 -0
- data/spec/models/error_body_spec.rb +1 -1
- data/spec/models/{Error_spec.rb → error_spec.rb} +1 -1
- data/spec/models/group_spec.rb +1 -1
- data/spec/models/group_wrapper_spec.rb +1 -1
- data/spec/models/groups_wrapper_spec.rb +1 -1
- data/spec/models/id_status_spec.rb +1 -1
- data/spec/models/{Job_spec.rb → job_spec.rb} +12 -2
- data/spec/models/job_wrapper_spec.rb +1 -1
- data/spec/models/jobs_wrapper_spec.rb +1 -1
- data/spec/models/new_job_spec.rb +1 -1
- data/spec/models/new_jobs_wrapper_spec.rb +1 -1
- data/spec/models/reason_spec.rb +1 -1
- data/spec/models/start_spec.rb +46 -0
- metadata +15 -6
data/lib/iron_titan/api_error.rb
CHANGED
@@ -0,0 +1,184 @@
|
|
1
|
+
=begin
|
2
|
+
Titan API
|
3
|
+
|
4
|
+
The ultimate, language agnostic, container based job processing framework.
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.3.7
|
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 Complete
|
17
|
+
# Time when job was completed. Always in UTC.
|
18
|
+
attr_accessor :completed_at
|
19
|
+
|
20
|
+
# Machine readable reason failure, if status=error. Only used by the /error endpoint.
|
21
|
+
attr_accessor :reason
|
22
|
+
|
23
|
+
# Error message, if status=error. Only used by the /error endpoint.
|
24
|
+
attr_accessor :error
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
|
30
|
+
:'completed_at' => :'completed_at',
|
31
|
+
|
32
|
+
:'reason' => :'reason',
|
33
|
+
|
34
|
+
:'error' => :'error'
|
35
|
+
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.swagger_types
|
41
|
+
{
|
42
|
+
:'completed_at' => :'DateTime',
|
43
|
+
:'reason' => :'String',
|
44
|
+
:'error' => :'String'
|
45
|
+
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
def initialize(attributes = {})
|
50
|
+
return unless attributes.is_a?(Hash)
|
51
|
+
|
52
|
+
# convert string to symbol for hash key
|
53
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
54
|
+
|
55
|
+
|
56
|
+
if attributes[:'completed_at']
|
57
|
+
self.completed_at = attributes[:'completed_at']
|
58
|
+
end
|
59
|
+
|
60
|
+
if attributes[:'reason']
|
61
|
+
self.reason = attributes[:'reason']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes[:'error']
|
65
|
+
self.error = attributes[:'error']
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
# Check equality by comparing each attribute.
|
71
|
+
def ==(o)
|
72
|
+
return true if self.equal?(o)
|
73
|
+
self.class == o.class &&
|
74
|
+
completed_at == o.completed_at &&
|
75
|
+
reason == o.reason &&
|
76
|
+
error == o.error
|
77
|
+
end
|
78
|
+
|
79
|
+
# @see the `==` method
|
80
|
+
def eql?(o)
|
81
|
+
self == o
|
82
|
+
end
|
83
|
+
|
84
|
+
# Calculate hash code according to all attributes.
|
85
|
+
def hash
|
86
|
+
[completed_at, reason, error].hash
|
87
|
+
end
|
88
|
+
|
89
|
+
# build the object from hash
|
90
|
+
def build_from_hash(attributes)
|
91
|
+
return nil unless attributes.is_a?(Hash)
|
92
|
+
self.class.swagger_types.each_pair do |key, type|
|
93
|
+
if type =~ /^Array<(.*)>/i
|
94
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
95
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
96
|
+
else
|
97
|
+
#TODO show warning in debug mode
|
98
|
+
end
|
99
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
100
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
101
|
+
else
|
102
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
self
|
107
|
+
end
|
108
|
+
|
109
|
+
def _deserialize(type, value)
|
110
|
+
case type.to_sym
|
111
|
+
when :DateTime
|
112
|
+
DateTime.parse(value)
|
113
|
+
when :Date
|
114
|
+
Date.parse(value)
|
115
|
+
when :String
|
116
|
+
value.to_s
|
117
|
+
when :Integer
|
118
|
+
value.to_i
|
119
|
+
when :Float
|
120
|
+
value.to_f
|
121
|
+
when :BOOLEAN
|
122
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
123
|
+
true
|
124
|
+
else
|
125
|
+
false
|
126
|
+
end
|
127
|
+
when :Object
|
128
|
+
# generic object (usually a Hash), return directly
|
129
|
+
value
|
130
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
131
|
+
inner_type = Regexp.last_match[:inner_type]
|
132
|
+
value.map { |v| _deserialize(inner_type, v) }
|
133
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
134
|
+
k_type = Regexp.last_match[:k_type]
|
135
|
+
v_type = Regexp.last_match[:v_type]
|
136
|
+
{}.tap do |hash|
|
137
|
+
value.each do |k, v|
|
138
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
else # model
|
142
|
+
_model = IronTitan.const_get(type).new
|
143
|
+
_model.build_from_hash(value)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def to_s
|
148
|
+
to_hash.to_s
|
149
|
+
end
|
150
|
+
|
151
|
+
# to_body is an alias to to_body (backward compatibility))
|
152
|
+
def to_body
|
153
|
+
to_hash
|
154
|
+
end
|
155
|
+
|
156
|
+
# return the object in the form of hash
|
157
|
+
def to_hash
|
158
|
+
hash = {}
|
159
|
+
self.class.attribute_map.each_pair do |attr, param|
|
160
|
+
value = self.send(attr)
|
161
|
+
next if value.nil?
|
162
|
+
hash[param] = _to_hash(value)
|
163
|
+
end
|
164
|
+
hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Method to output non-array value in the form of hash
|
168
|
+
# For object, use to_hash. Otherwise, just return the value
|
169
|
+
def _to_hash(value)
|
170
|
+
if value.is_a?(Array)
|
171
|
+
value.compact.map{ |v| _to_hash(v) }
|
172
|
+
elsif value.is_a?(Hash)
|
173
|
+
{}.tap do |hash|
|
174
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
175
|
+
end
|
176
|
+
elsif value.respond_to? :to_hash
|
177
|
+
value.to_hash
|
178
|
+
else
|
179
|
+
value
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
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.3.
|
6
|
+
OpenAPI spec version: 0.3.7
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
|
@@ -44,6 +44,10 @@ module IronTitan
|
|
44
44
|
# Group this job belongs to.
|
45
45
|
attr_accessor :group_name
|
46
46
|
|
47
|
+
# The error message, if status is 'error'. This is errors due to things outside the job itself. Errors from user code will be found in the log.
|
48
|
+
attr_accessor :error
|
49
|
+
|
50
|
+
# Machine usable reason for job being in this state.\nValid values for error status are `timeout | killed | bad_exit`.\nValid values for cancelled status are `client_request`.\nFor everything else, this is undefined.\n
|
47
51
|
attr_accessor :reason
|
48
52
|
|
49
53
|
# Time when job was submitted. Always in UTC.
|
@@ -59,7 +63,7 @@ module IronTitan
|
|
59
63
|
attr_accessor :retry_of
|
60
64
|
|
61
65
|
# If this field is set, then this job was retried by the job referenced in this field.
|
62
|
-
attr_accessor :
|
66
|
+
attr_accessor :retry_at
|
63
67
|
|
64
68
|
# Attribute mapping from ruby-style variable name to JSON key.
|
65
69
|
def self.attribute_map
|
@@ -85,6 +89,8 @@ module IronTitan
|
|
85
89
|
|
86
90
|
:'group_name' => :'group_name',
|
87
91
|
|
92
|
+
:'error' => :'error',
|
93
|
+
|
88
94
|
:'reason' => :'reason',
|
89
95
|
|
90
96
|
:'created_at' => :'created_at',
|
@@ -95,7 +101,7 @@ module IronTitan
|
|
95
101
|
|
96
102
|
:'retry_of' => :'retry_of',
|
97
103
|
|
98
|
-
:'
|
104
|
+
:'retry_at' => :'retry_at'
|
99
105
|
|
100
106
|
}
|
101
107
|
end
|
@@ -113,12 +119,13 @@ module IronTitan
|
|
113
119
|
:'id' => :'String',
|
114
120
|
:'status' => :'String',
|
115
121
|
:'group_name' => :'String',
|
116
|
-
:'
|
122
|
+
:'error' => :'String',
|
123
|
+
:'reason' => :'String',
|
117
124
|
:'created_at' => :'DateTime',
|
118
125
|
:'started_at' => :'DateTime',
|
119
126
|
:'completed_at' => :'DateTime',
|
120
127
|
:'retry_of' => :'String',
|
121
|
-
:'
|
128
|
+
:'retry_at' => :'String'
|
122
129
|
|
123
130
|
}
|
124
131
|
end
|
@@ -152,14 +159,12 @@ module IronTitan
|
|
152
159
|
|
153
160
|
if attributes[:'priority']
|
154
161
|
self.priority = attributes[:'priority']
|
155
|
-
else
|
156
|
-
self.priority = 0
|
157
162
|
end
|
158
163
|
|
159
164
|
if attributes[:'max_retries']
|
160
165
|
self.max_retries = attributes[:'max_retries']
|
161
166
|
else
|
162
|
-
self.max_retries =
|
167
|
+
self.max_retries = 0
|
163
168
|
end
|
164
169
|
|
165
170
|
if attributes[:'retries_delay']
|
@@ -180,6 +185,10 @@ module IronTitan
|
|
180
185
|
self.group_name = attributes[:'group_name']
|
181
186
|
end
|
182
187
|
|
188
|
+
if attributes[:'error']
|
189
|
+
self.error = attributes[:'error']
|
190
|
+
end
|
191
|
+
|
183
192
|
if attributes[:'reason']
|
184
193
|
self.reason = attributes[:'reason']
|
185
194
|
end
|
@@ -200,8 +209,8 @@ module IronTitan
|
|
200
209
|
self.retry_of = attributes[:'retry_of']
|
201
210
|
end
|
202
211
|
|
203
|
-
if attributes[:'
|
204
|
-
self.
|
212
|
+
if attributes[:'retry_at']
|
213
|
+
self.retry_at = attributes[:'retry_at']
|
205
214
|
end
|
206
215
|
|
207
216
|
end
|
@@ -215,6 +224,15 @@ module IronTitan
|
|
215
224
|
@status = status
|
216
225
|
end
|
217
226
|
|
227
|
+
# Custom attribute writer method checking allowed values (enum).
|
228
|
+
def reason=(reason)
|
229
|
+
allowed_values = ["timeout", "killed", "bad_exit", "client_request"]
|
230
|
+
if reason && !allowed_values.include?(reason)
|
231
|
+
fail "invalid value for 'reason', must be one of #{allowed_values}"
|
232
|
+
end
|
233
|
+
@reason = reason
|
234
|
+
end
|
235
|
+
|
218
236
|
# Check equality by comparing each attribute.
|
219
237
|
def ==(o)
|
220
238
|
return true if self.equal?(o)
|
@@ -229,12 +247,13 @@ module IronTitan
|
|
229
247
|
id == o.id &&
|
230
248
|
status == o.status &&
|
231
249
|
group_name == o.group_name &&
|
250
|
+
error == o.error &&
|
232
251
|
reason == o.reason &&
|
233
252
|
created_at == o.created_at &&
|
234
253
|
started_at == o.started_at &&
|
235
254
|
completed_at == o.completed_at &&
|
236
255
|
retry_of == o.retry_of &&
|
237
|
-
|
256
|
+
retry_at == o.retry_at
|
238
257
|
end
|
239
258
|
|
240
259
|
# @see the `==` method
|
@@ -244,7 +263,7 @@ module IronTitan
|
|
244
263
|
|
245
264
|
# Calculate hash code according to all attributes.
|
246
265
|
def hash
|
247
|
-
[image, payload, delay, timeout, priority, max_retries, retries_delay, id, status, group_name, reason, created_at, started_at, completed_at, retry_of,
|
266
|
+
[image, payload, delay, timeout, priority, max_retries, retries_delay, id, status, group_name, error, reason, created_at, started_at, completed_at, retry_of, retry_at].hash
|
248
267
|
end
|
249
268
|
|
250
269
|
# 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.3.
|
6
|
+
OpenAPI spec version: 0.3.7
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
|
@@ -99,14 +99,12 @@ module IronTitan
|
|
99
99
|
|
100
100
|
if attributes[:'priority']
|
101
101
|
self.priority = attributes[:'priority']
|
102
|
-
else
|
103
|
-
self.priority = 0
|
104
102
|
end
|
105
103
|
|
106
104
|
if attributes[:'max_retries']
|
107
105
|
self.max_retries = attributes[:'max_retries']
|
108
106
|
else
|
109
|
-
self.max_retries =
|
107
|
+
self.max_retries = 0
|
110
108
|
end
|
111
109
|
|
112
110
|
if attributes[:'retries_delay']
|
@@ -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.3.
|
6
|
+
OpenAPI spec version: 0.3.3
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
|
@@ -18,62 +18,68 @@ module IronTitan
|
|
18
18
|
# Attribute mapping from ruby-style variable name to JSON key.
|
19
19
|
def self.attribute_map
|
20
20
|
{
|
21
|
-
|
22
21
|
}
|
23
22
|
end
|
24
23
|
|
25
24
|
# Attribute type mapping.
|
26
25
|
def self.swagger_types
|
27
26
|
{
|
28
|
-
|
29
27
|
}
|
30
28
|
end
|
31
29
|
|
30
|
+
# Initializes the object
|
31
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
32
32
|
def initialize(attributes = {})
|
33
33
|
return unless attributes.is_a?(Hash)
|
34
34
|
|
35
35
|
# convert string to symbol for hash key
|
36
|
-
attributes = attributes.
|
36
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
37
37
|
|
38
|
-
|
39
38
|
end
|
40
39
|
|
41
|
-
#
|
40
|
+
# Checks equality by comparing each attribute.
|
41
|
+
# @param [Object] Object to be compared
|
42
42
|
def ==(o)
|
43
43
|
return true if self.equal?(o)
|
44
44
|
self.class == o.class
|
45
45
|
end
|
46
46
|
|
47
47
|
# @see the `==` method
|
48
|
+
# @param [Object] Object to be compared
|
48
49
|
def eql?(o)
|
49
50
|
self == o
|
50
51
|
end
|
51
52
|
|
52
|
-
#
|
53
|
+
# Calculates hash code according to all attributes.
|
54
|
+
# @return [Fixnum] Hash code
|
53
55
|
def hash
|
54
56
|
[].hash
|
55
57
|
end
|
56
58
|
|
57
|
-
#
|
59
|
+
# Builds the object from hash
|
60
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
61
|
+
# @return [Object] Returns the model itself
|
58
62
|
def build_from_hash(attributes)
|
59
63
|
return nil unless attributes.is_a?(Hash)
|
60
64
|
self.class.swagger_types.each_pair do |key, type|
|
61
65
|
if type =~ /^Array<(.*)>/i
|
66
|
+
# check to ensure the input is an array given that the the attribute
|
67
|
+
# is documented as an array but the input is not
|
62
68
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
63
69
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
64
|
-
else
|
65
|
-
#TODO show warning in debug mode
|
66
70
|
end
|
67
71
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
68
72
|
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
|
73
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
72
74
|
end
|
73
75
|
|
74
76
|
self
|
75
77
|
end
|
76
78
|
|
79
|
+
# Deserializes the data based on type
|
80
|
+
# @param string type Data type
|
81
|
+
# @param string value Value to be deserialized
|
82
|
+
# @return [Object] Deserialized data
|
77
83
|
def _deserialize(type, value)
|
78
84
|
case type.to_sym
|
79
85
|
when :DateTime
|
@@ -107,21 +113,25 @@ module IronTitan
|
|
107
113
|
end
|
108
114
|
end
|
109
115
|
else # model
|
110
|
-
|
111
|
-
|
116
|
+
temp_model = IronTitan.const_get(type).new
|
117
|
+
temp_model.build_from_hash(value)
|
112
118
|
end
|
113
119
|
end
|
114
120
|
|
121
|
+
# Returns the string representation of the object
|
122
|
+
# @return [String] String presentation of the object
|
115
123
|
def to_s
|
116
124
|
to_hash.to_s
|
117
125
|
end
|
118
126
|
|
119
|
-
# to_body is an alias to
|
127
|
+
# to_body is an alias to to_hash (backward compatibility)
|
128
|
+
# @return [Hash] Returns the object in the form of hash
|
120
129
|
def to_body
|
121
130
|
to_hash
|
122
131
|
end
|
123
132
|
|
124
|
-
#
|
133
|
+
# Returns the object in the form of hash
|
134
|
+
# @return [Hash] Returns the object in the form of hash
|
125
135
|
def to_hash
|
126
136
|
hash = {}
|
127
137
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -132,8 +142,10 @@ module IronTitan
|
|
132
142
|
hash
|
133
143
|
end
|
134
144
|
|
135
|
-
#
|
145
|
+
# Outputs non-array value in the form of hash
|
136
146
|
# For object, use to_hash. Otherwise, just return the value
|
147
|
+
# @param [Object] value Any valid value
|
148
|
+
# @return [Hash] Returns the value in the form of hash
|
137
149
|
def _to_hash(value)
|
138
150
|
if value.is_a?(Array)
|
139
151
|
value.compact.map{ |v| _to_hash(v) }
|