cloud_powers 0.2.7.4 → 0.2.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cloud_powers/delegator.rb +1 -1
- data/lib/cloud_powers/helper.rb +160 -69
- data/lib/cloud_powers/node.rb +8 -4
- data/lib/cloud_powers/self_awareness.rb +53 -13
- data/lib/cloud_powers/synapse/pipe/pipe.rb +8 -8
- data/lib/cloud_powers/synapse/queue/queue.rb +1 -1
- data/lib/cloud_powers/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd1ef85d301fd73bf38db0132fcbe17db2bff9cf
|
4
|
+
data.tar.gz: 5c6dc0a78d34e694a66e3a77549d128eecc4b050
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf6eb4c1cc74ed62eba6312d179914865a8e9ef2369d545c2e445a1152111a2e7f05650c6054c50dd4622b7072147d6e6c1ec9ce41917dc346e3879f1ce5201d
|
7
|
+
data.tar.gz: c1e07579e5e8b22719870a23d8782d7c2653476ced2e3fc3b2a358646ebf2fec8840f81bc5d91a7bad35f144908073664df43141e227b0bf22ea70202a7e0a3a
|
data/Gemfile.lock
CHANGED
@@ -12,7 +12,7 @@ module Smash
|
|
12
12
|
# be the name of the class you're trying to instantiate and use
|
13
13
|
module Delegator
|
14
14
|
extend Smash::CloudPowers::Auth
|
15
|
-
include Smash::
|
15
|
+
include Smash::CloudPowers::AwsResources
|
16
16
|
include Smash::CloudPowers::Helper
|
17
17
|
include Smash::CloudPowers::Storage
|
18
18
|
|
data/lib/cloud_powers/helper.rb
CHANGED
@@ -40,10 +40,12 @@ module Smash
|
|
40
40
|
|
41
41
|
# This is a way to find out if you are trying to work with a resource
|
42
42
|
# available to CloudPowers
|
43
|
+
#
|
43
44
|
# Returns <Array>
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
45
|
+
# Use +.constants+ to find all the modules and classes available.
|
46
|
+
#
|
47
|
+
# Notes
|
48
|
+
# * TODO: make this smartly pick up all the objects, within reason and
|
47
49
|
# considering need, that we have access to
|
48
50
|
def available_resources
|
49
51
|
[:Task].concat(Smash::CloudPowers.constants)
|
@@ -52,32 +54,49 @@ module Smash
|
|
52
54
|
# Does its best job at guessing where this method was called from, in terms
|
53
55
|
# of where it is located on the file system. It helps track down where a
|
54
56
|
# project root is etc.
|
57
|
+
#
|
58
|
+
# Returns
|
59
|
+
# +String+
|
60
|
+
#
|
61
|
+
# Notes
|
62
|
+
# * Uses +$0+ to figure out what the current file is
|
55
63
|
def called_from
|
56
64
|
File.expand_path(File.dirname($0))
|
57
65
|
end
|
58
66
|
|
59
67
|
# creates a default logger
|
60
|
-
#
|
61
|
-
#
|
62
|
-
|
63
|
-
|
68
|
+
#
|
69
|
+
# Parameters
|
70
|
+
# * log_to +String+ (optional) - location to send logging information to; default is STDOUT
|
71
|
+
#
|
72
|
+
# Returns
|
73
|
+
# +Logger+
|
74
|
+
#
|
75
|
+
# Notes
|
76
|
+
# * TODO: at least make this have overridable defaults
|
77
|
+
def create_logger(log_to = STDOUT)
|
78
|
+
logger = Logger.new(log_to)
|
64
79
|
logger.datetime_format = '%Y-%m-%d %H:%M:%S'
|
65
80
|
logger
|
66
81
|
end
|
67
82
|
|
68
83
|
# Allows you to modify all keys, including nested, with a block that you pass.
|
69
84
|
# If no block is passed, a copy is returned.
|
85
|
+
#
|
70
86
|
# Parameters
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
87
|
+
# * params +Hash+|+Array+ - hash to be modified
|
88
|
+
# * +block+ (optional) - a block to be used to modify each key should
|
89
|
+
# modify the key and return that value so it can be used in the copy
|
90
|
+
#
|
74
91
|
# Returns
|
75
|
-
#
|
76
|
-
#
|
92
|
+
# +Hash+|+Array+ - a copy of the given Array or Hash, with all Hash keys modified
|
93
|
+
#
|
94
|
+
# Example
|
77
95
|
# hash = { 'foo' => 'v1', 'bar' => { fleep: { 'florp' => 'yo' } } }
|
78
96
|
# modify_keys_with(hash) { |key| key.to_sym }
|
79
97
|
# # => { foo: 'v1', bar: { fleep: { florp: 'yo' } } }
|
80
|
-
#
|
98
|
+
#
|
99
|
+
# Notes
|
81
100
|
# * see `#modify_keys_with()` for handling first-level keys
|
82
101
|
# * see `#pass_the_buck()` for the way nested structures are handled
|
83
102
|
# * case for different types taken from _MultiXML_ (multi_xml.rb)
|
@@ -110,6 +129,12 @@ module Smash
|
|
110
129
|
end
|
111
130
|
|
112
131
|
# Join the message and backtrace into a String with line breaks
|
132
|
+
#
|
133
|
+
# Parameters
|
134
|
+
# * error +Exception+
|
135
|
+
#
|
136
|
+
# Returns
|
137
|
+
# +String+
|
113
138
|
def format_error_message(error)
|
114
139
|
begin
|
115
140
|
[error.message, error.backtrace.join("\n")].join("\n")
|
@@ -120,31 +145,45 @@ module Smash
|
|
120
145
|
end
|
121
146
|
|
122
147
|
# Gets the path from the environment and sets @log_file using the path
|
123
|
-
#
|
148
|
+
#
|
149
|
+
# Returns
|
150
|
+
# @log_file +String+
|
151
|
+
#
|
152
|
+
# Notes
|
153
|
+
# * See +#zfind()+
|
124
154
|
def log_file
|
125
155
|
@log_file ||= zfind('LOG_FILE')
|
126
156
|
end
|
127
157
|
|
128
|
-
# Returns An instance of Logger, cached as @logger
|
158
|
+
# Returns An instance of Logger, cached as @logger@log_file path <String>
|
159
|
+
#
|
160
|
+
# Returns
|
161
|
+
# +Logger+
|
162
|
+
#
|
163
|
+
# Notes
|
164
|
+
# * See +#create_logger+
|
129
165
|
def logger
|
130
166
|
@logger ||= create_logger
|
131
167
|
end
|
132
168
|
|
133
169
|
# Allows you to modify all first-level keys with a block that you pass.
|
134
170
|
# If no block is passed, a copy is returned.
|
171
|
+
#
|
135
172
|
# Parameters
|
136
|
-
#
|
137
|
-
#
|
138
|
-
#
|
173
|
+
# * params +Hash+|+Array+
|
174
|
+
# * block (optional) - should modify the key and return that value so it can be used in the copy
|
175
|
+
#
|
139
176
|
# Returns
|
140
|
-
#
|
141
|
-
#
|
177
|
+
# +Hash+|+Array+ - a copy of the given Array or Hash, with all Hash keys modified
|
178
|
+
#
|
179
|
+
# Example
|
142
180
|
# hash = { 'foo' => 'v1', 'bar' => { fleep: { 'florp' => 'yo' } } }
|
143
181
|
# modify_keys_with(hash) { |k| k.to_sym }
|
144
182
|
# # => { :foo => 'v1', :bar => { fleep: { 'florp' => 'yo' } } }
|
145
|
-
#
|
146
|
-
#
|
147
|
-
#
|
183
|
+
#
|
184
|
+
# Notes
|
185
|
+
# * see +#deep_modify_keys_with()+ for handling nested keys
|
186
|
+
# * case for different types taken from _MultiXML_ (multi_xml.rb)
|
148
187
|
def modify_keys_with(params)
|
149
188
|
params.inject({}) do |carry, (k, v)|
|
150
189
|
carry.tap do |h|
|
@@ -158,15 +197,17 @@ module Smash
|
|
158
197
|
# until another bit of logic does what it's supposed to, kind of like
|
159
198
|
# continuing to poll something and doing something when a package is ready
|
160
199
|
# to be taken and processed.
|
200
|
+
#
|
161
201
|
# Parameters
|
162
|
-
#
|
163
|
-
#
|
164
|
-
#
|
165
|
-
#
|
166
|
-
#
|
167
|
-
#
|
168
|
-
#
|
169
|
-
#
|
202
|
+
# * allowed_attempts +Number+|+Infinity(default)+ - The number of times
|
203
|
+
# the loop should be allowed to...well, loop, before a failed retry occurs.
|
204
|
+
# * &test +Block+ - A predicate method or block of code that is callable
|
205
|
+
# is used to test if the block being retried is successful yet.
|
206
|
+
# * []
|
207
|
+
#
|
208
|
+
# Example
|
209
|
+
# check_stuff = lambda { |params| return true }
|
210
|
+
# smart_retry(3, check_stuff(params)) { do_stuff_that_needs_to_be_checked }
|
170
211
|
def smart_retry(test, allowed_attempts = Float::INFINITY)
|
171
212
|
result = yield if block_given?
|
172
213
|
tries = 1
|
@@ -178,32 +219,45 @@ module Smash
|
|
178
219
|
end
|
179
220
|
|
180
221
|
# Gives the path from the project root to lib/tasks[/#{file}.rb]
|
222
|
+
#
|
181
223
|
# Parameters
|
182
|
-
#
|
224
|
+
# * file +String+ (optional) (default is '') - name of a file
|
225
|
+
#
|
183
226
|
# Returns
|
184
|
-
#
|
185
|
-
#
|
186
|
-
#
|
227
|
+
# * path/file +String+ if +file+ parameter is given. return has
|
228
|
+
# '.rb' extension included
|
229
|
+
# * file +String+ if +file+ parameter is not given it will return the <tt>#task_require_path()</tt>
|
230
|
+
#
|
231
|
+
# Notes
|
232
|
+
# * See <tt>#task_require_path()</tt>
|
187
233
|
def task_path(file = '')
|
188
234
|
return task_require_path if file.empty?
|
189
235
|
Pathname(__FILE__).parent.dirname + 'tasks' + to_ruby_file_name(file)
|
190
236
|
end
|
191
237
|
|
192
238
|
# Gives the path from the project root to lib/tasks[/file]
|
239
|
+
#
|
193
240
|
# Parameters String (optional)
|
194
|
-
#
|
195
|
-
#
|
196
|
-
#
|
197
|
-
#
|
241
|
+
# * file_name name of a file
|
242
|
+
#
|
243
|
+
# Returns
|
244
|
+
# * path/file +String+ if +file_name+ was given
|
245
|
+
# * path to task_directory if +file_name+ was <i>not</i> given
|
246
|
+
#
|
247
|
+
# Notes
|
248
|
+
# * Neither path nor file will have a file extension
|
198
249
|
def task_require_path(file_name = '')
|
199
250
|
file = File.basename(file_name, File.extname(file_name))
|
200
251
|
Pathname(__FILE__).parent.dirname + 'tasks' + file
|
201
252
|
end
|
202
253
|
|
203
254
|
# Change strings into camelCase
|
204
|
-
#
|
205
|
-
#
|
206
|
-
#
|
255
|
+
#
|
256
|
+
# Parameters
|
257
|
+
# * var +String+
|
258
|
+
#
|
259
|
+
# Returns
|
260
|
+
# +String+
|
207
261
|
def to_camel(var)
|
208
262
|
var = var.to_s unless var.kind_of? String
|
209
263
|
step_one = to_snake(var)
|
@@ -211,10 +265,13 @@ module Smash
|
|
211
265
|
step_two[0, 1].downcase + step_two[1..-1]
|
212
266
|
end
|
213
267
|
|
214
|
-
# Change strings hyphen
|
215
|
-
#
|
216
|
-
#
|
217
|
-
#
|
268
|
+
# Change strings into a hyphen delimited phrase
|
269
|
+
#
|
270
|
+
# Parameters
|
271
|
+
# * var +String+
|
272
|
+
#
|
273
|
+
# Returns
|
274
|
+
# +String+
|
218
275
|
def to_hyph(var)
|
219
276
|
var = var.to_s unless var.kind_of? String
|
220
277
|
|
@@ -227,40 +284,58 @@ module Smash
|
|
227
284
|
downcase
|
228
285
|
end
|
229
286
|
|
230
|
-
# Change strings into
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
287
|
+
# Change strings into an i-var format
|
288
|
+
#
|
289
|
+
# Parameters
|
290
|
+
# * var +String+
|
291
|
+
#
|
292
|
+
# Returns
|
293
|
+
# +String+
|
234
294
|
def to_i_var(var)
|
235
295
|
var = var.to_s unless var.kind_of? String
|
236
296
|
/^\W*@\w+/ =~ var ? to_snake(var) : "@#{to_snake(var)}"
|
237
297
|
end
|
238
298
|
|
239
299
|
# Change strings into PascalCase
|
240
|
-
#
|
241
|
-
#
|
242
|
-
#
|
300
|
+
#
|
301
|
+
# Parameters
|
302
|
+
# * var +String+
|
303
|
+
#
|
304
|
+
# Returns
|
305
|
+
# +String+
|
243
306
|
def to_pascal(var)
|
244
307
|
var = var.to_s unless var.kind_of? String
|
245
308
|
var.gsub(/^(.{1})|\W.{1}|\_.{1}/) { |s| s.gsub(/[^a-z0-9]+/i, '').capitalize }
|
246
309
|
end
|
247
310
|
|
248
311
|
# Change strings into a ruby_file_name with extension
|
249
|
-
#
|
250
|
-
#
|
251
|
-
#
|
252
|
-
#
|
253
|
-
#
|
312
|
+
#
|
313
|
+
# Parameters
|
314
|
+
# * var +String+
|
315
|
+
#
|
316
|
+
# Returns
|
317
|
+
# +String+
|
318
|
+
#
|
319
|
+
# Notes
|
320
|
+
# * given_string.rb
|
321
|
+
# * includes ruby file extension
|
322
|
+
# * see #to_snake()
|
254
323
|
def to_ruby_file_name(name)
|
255
324
|
name[/\.rb$/].nil? ? "#{to_snake(name)}.rb" : "#{to_snake(name)}"
|
256
325
|
end
|
257
326
|
|
258
|
-
# Change strings into
|
259
|
-
#
|
260
|
-
#
|
261
|
-
#
|
262
|
-
#
|
263
|
-
#
|
327
|
+
# Change strings into PascalCase
|
328
|
+
#
|
329
|
+
# Parameters
|
330
|
+
# * var +String+
|
331
|
+
#
|
332
|
+
# Returns
|
333
|
+
# +String+
|
334
|
+
#
|
335
|
+
# Notes
|
336
|
+
# * given_string
|
337
|
+
# * will not have file extensions
|
338
|
+
# * see #to_ruby_file_name()
|
264
339
|
def to_snake(var)
|
265
340
|
var = var.to_s unless var.kind_of? String
|
266
341
|
|
@@ -274,13 +349,15 @@ module Smash
|
|
274
349
|
|
275
350
|
# This method provides a default overrideable message body for things like
|
276
351
|
# basic status updates.
|
277
|
-
#
|
278
|
-
#
|
279
|
-
#
|
280
|
-
#
|
352
|
+
#
|
353
|
+
# Parameters
|
354
|
+
# * instanceId +Hash+
|
355
|
+
#
|
356
|
+
# Notes
|
357
|
+
# * camel casing is used on the keys because most other languages prefer
|
281
358
|
# that and it's not a huge problem in ruby. Besides, there's some other
|
282
359
|
# handy methods in this module to get you through those issues, like
|
283
|
-
#
|
360
|
+
# +#to_snake()+ and or +#modify_keys_with()+
|
284
361
|
def update_message_body(opts = {})
|
285
362
|
# TODO: Better implementation of merging message bodies and config needed
|
286
363
|
unless opts.kind_of? Hash
|
@@ -298,6 +375,13 @@ module Smash
|
|
298
375
|
}.merge(opts)
|
299
376
|
end
|
300
377
|
|
378
|
+
# Predicate method to check if a String is parsable, as JSON
|
379
|
+
#
|
380
|
+
# Parameters
|
381
|
+
# * json +String+
|
382
|
+
#
|
383
|
+
# Returns
|
384
|
+
# +Boolean+
|
301
385
|
def valid_json?(json)
|
302
386
|
begin
|
303
387
|
JSON.parse(json)
|
@@ -307,6 +391,13 @@ module Smash
|
|
307
391
|
end
|
308
392
|
end
|
309
393
|
|
394
|
+
# Predicate method to check if a String is a valid URL
|
395
|
+
#
|
396
|
+
# Parameters
|
397
|
+
# * url +String+
|
398
|
+
#
|
399
|
+
# Returns
|
400
|
+
# +Boolean+
|
310
401
|
def valid_url?(url)
|
311
402
|
url =~ /\A#{URI::regexp}\z/
|
312
403
|
end
|
data/lib/cloud_powers/node.rb
CHANGED
@@ -10,9 +10,12 @@ module Smash
|
|
10
10
|
include Smash::CloudPowers::Helper
|
11
11
|
include Smash::CloudPowers::SelfAwareness
|
12
12
|
include Smash::CloudPowers::Zenv
|
13
|
+
|
13
14
|
# These are sensible defaults that can be overriden by providing a Hash as a param.
|
14
|
-
#
|
15
|
-
#
|
15
|
+
#
|
16
|
+
# Parameters
|
17
|
+
# * opts +Hash+ (optional)
|
18
|
+
# the opts Hash should have values that should be used instead of the default
|
16
19
|
# configuration.
|
17
20
|
def node_config(opts = {})
|
18
21
|
{
|
@@ -30,13 +33,14 @@ module Smash
|
|
30
33
|
}.merge(opts)
|
31
34
|
end
|
32
35
|
|
33
|
-
# Uses
|
36
|
+
# Uses +Aws::EC2#run_instances()+ to create nodes (Neurons or Cerebrums), at
|
34
37
|
# a rate of 0..(n <= 100) at a time, until the required number of instances
|
35
38
|
# has been started. The #instance_config() method is used to create instance
|
36
39
|
# configuration for the #run_instances method by using the opts hash that was
|
37
40
|
# provided as a parameter.
|
38
41
|
#
|
39
|
-
# Parameters
|
42
|
+
# Parameters
|
43
|
+
# * opts +Hash+ (optional)
|
40
44
|
# an optional instance configuration hash can be passed, which will override
|
41
45
|
# the values in the default configuration returned by #instance_config()
|
42
46
|
def spin_up_neurons(opts = {})
|
@@ -17,8 +17,11 @@ module Smash
|
|
17
17
|
|
18
18
|
# Gets the instance time or the time it was called and as seconds from
|
19
19
|
# epoch
|
20
|
+
#
|
20
21
|
# Returns Integer
|
21
|
-
#
|
22
|
+
#
|
23
|
+
# Notes
|
24
|
+
# * TODO: use time codes
|
22
25
|
def boot_time
|
23
26
|
begin
|
24
27
|
@boot_time ||=
|
@@ -59,6 +62,14 @@ module Smash
|
|
59
62
|
|
60
63
|
# Get resource metadata, public host, boot time and task name
|
61
64
|
# and set them as instance variables
|
65
|
+
#
|
66
|
+
# Returns
|
67
|
+
# +Array+ of values, each from a separate key, set in the order
|
68
|
+
# in the Array
|
69
|
+
#
|
70
|
+
# Notes
|
71
|
+
# * See +#metadata_request()+
|
72
|
+
# * See +#attr_map!()+
|
62
73
|
def get_awareness!
|
63
74
|
keys = metadata_request
|
64
75
|
attr_map!(keys) { |key| metadata_request(key) }
|
@@ -68,18 +79,21 @@ module Smash
|
|
68
79
|
end
|
69
80
|
|
70
81
|
# Assures there is always a valid instance id because many other Aws calls require it
|
71
|
-
#
|
82
|
+
#
|
83
|
+
# Returns
|
84
|
+
# +String+
|
72
85
|
def instance_id
|
73
86
|
@instance_id ||= metadata_request('instance_id')
|
74
87
|
end
|
75
88
|
|
76
89
|
# Gets and sets the public hostname of the instance
|
90
|
+
#
|
77
91
|
# Returns
|
78
|
-
#
|
92
|
+
# +String+ - the Public Hostname for this instance
|
93
|
+
#
|
79
94
|
# Notes
|
80
|
-
# When this is being called from somewhere other than an Aws instance,
|
81
|
-
#
|
82
|
-
# because of the way instance metadata is retrieved
|
95
|
+
# * When this is being called from somewhere other than an Aws instance,
|
96
|
+
# a hardcoded example URL is returned because of the way instance metadata is retrieved
|
83
97
|
def instance_url
|
84
98
|
@instance_url ||= unless zfind('TESTING')
|
85
99
|
hostname_uri = 'http://169.254.169.254/latest/meta-data/public-hostname'
|
@@ -94,11 +108,18 @@ module Smash
|
|
94
108
|
# particular key from the metadata
|
95
109
|
#
|
96
110
|
# Parameters
|
97
|
-
# *
|
111
|
+
# * key +String+ (optional) (default is '') - the key for the metadata information
|
112
|
+
# you want from this instance.
|
98
113
|
#
|
99
114
|
# Returns
|
100
115
|
# * +Array+ if key is blank
|
101
116
|
# * +String+ if key is given
|
117
|
+
#
|
118
|
+
# Example
|
119
|
+
# metadata_request
|
120
|
+
# # => a +Hash+ containing every key => value pair AWS provides
|
121
|
+
# metadata_request('instance-id')
|
122
|
+
# # => 'abc-1234'
|
102
123
|
def metadata_request(key = '')
|
103
124
|
key = to_hyph(key)
|
104
125
|
begin
|
@@ -117,8 +138,11 @@ module Smash
|
|
117
138
|
end
|
118
139
|
|
119
140
|
# Return the time since boot_time
|
120
|
-
#
|
121
|
-
#
|
141
|
+
#
|
142
|
+
# Returns
|
143
|
+
# +Integer+
|
144
|
+
#
|
145
|
+
# Notes
|
122
146
|
# * TODO: refactor to use valid time stamps for better tracking.
|
123
147
|
# * reason -> separate regions or OSs etc.
|
124
148
|
def run_time
|
@@ -126,6 +150,11 @@ module Smash
|
|
126
150
|
end
|
127
151
|
|
128
152
|
# Send a message on a Pipe at an interval
|
153
|
+
#
|
154
|
+
# Parameters
|
155
|
+
# * opts +Hash+ (optional)
|
156
|
+
# * * +:interval+ - how long to wait between sending updates
|
157
|
+
# * * +:stream_name+ - name of stream you want to use
|
129
158
|
def send_frequent_status_updates(opts = {})
|
130
159
|
sleep_time = opts.delete(:interval) || 10
|
131
160
|
stream = opts.delete(:stream_name)
|
@@ -138,8 +167,10 @@ module Smash
|
|
138
167
|
end
|
139
168
|
|
140
169
|
# Get the instance status.
|
141
|
-
#
|
142
|
-
#
|
170
|
+
#
|
171
|
+
# Parameters
|
172
|
+
# * id +String+ (optional) (default is @instance_id)
|
173
|
+
#
|
143
174
|
# Returns String
|
144
175
|
def status(id = @instance_id)
|
145
176
|
begin
|
@@ -153,8 +184,13 @@ module Smash
|
|
153
184
|
|
154
185
|
# Check self-tags for 'task' and act as an attr_accessor.
|
155
186
|
# A different node's tag's can be checked for a task by passing
|
156
|
-
#
|
157
|
-
#
|
187
|
+
# that instance's id as a parameter
|
188
|
+
#
|
189
|
+
# Parameters
|
190
|
+
# * id +String+ (optional) (default is @instance_id) - instance you want a tag from
|
191
|
+
#
|
192
|
+
# Returns
|
193
|
+
# +String+
|
158
194
|
def task_name(id = @instance_id)
|
159
195
|
# get @task_name
|
160
196
|
return @task_name unless @task_name.nil?
|
@@ -171,6 +207,10 @@ module Smash
|
|
171
207
|
# * The run time is more than 5 minutes
|
172
208
|
# and
|
173
209
|
# * The run time is 5 minutes from the hour mark from when the instance started
|
210
|
+
# and will return false otherwise
|
211
|
+
#
|
212
|
+
# Returns
|
213
|
+
# +Boolean+
|
174
214
|
def time_is_up?
|
175
215
|
an_hours_time = 60 * 60
|
176
216
|
five_minutes_time = 60 * 5
|
@@ -42,7 +42,7 @@ module Smash
|
|
42
42
|
# Parameters stream String
|
43
43
|
#
|
44
44
|
# Notes
|
45
|
-
# This method is not implemented yet (V 0.2.7)
|
45
|
+
# * This method is not implemented yet (V 0.2.7)
|
46
46
|
def flow_from_pipe(stream)
|
47
47
|
throw NotImplementedError
|
48
48
|
end
|
@@ -57,7 +57,7 @@ module Smash
|
|
57
57
|
# @last_sequence_number +String+
|
58
58
|
#
|
59
59
|
# Notes
|
60
|
-
# This method is not implemented yet (V 0.2.7)
|
60
|
+
# * This method is not implemented yet (V 0.2.7)
|
61
61
|
def flow_to_pipe(stream)
|
62
62
|
throw NotImplementedError
|
63
63
|
create_stream(stream) unless stream_exists? stream
|
@@ -75,7 +75,7 @@ module Smash
|
|
75
75
|
# Parameters stream String
|
76
76
|
#
|
77
77
|
# Notes
|
78
|
-
# This method is not implemented yet (V 0.2.7)
|
78
|
+
# * This method is not implemented yet (V 0.2.7)
|
79
79
|
def from_pipe(stream)
|
80
80
|
# implement get_records and/or other consuming app stuff
|
81
81
|
throw NotImplementedError
|
@@ -87,7 +87,7 @@ module Smash
|
|
87
87
|
# * records
|
88
88
|
#
|
89
89
|
# Notes
|
90
|
-
# This method is not implemented yet (V 0.2.7)
|
90
|
+
# * This method is not implemented yet (V 0.2.7)
|
91
91
|
def message_body_collection(records)
|
92
92
|
throw NotImplementedError
|
93
93
|
end
|
@@ -103,7 +103,7 @@ module Smash
|
|
103
103
|
# Returns
|
104
104
|
# +Hash+
|
105
105
|
#
|
106
|
-
# Notes
|
106
|
+
# Notes
|
107
107
|
# * See +#zfind()+
|
108
108
|
# * See +#instance_id()+
|
109
109
|
# * See +#update_message_body()+
|
@@ -125,7 +125,7 @@ module Smash
|
|
125
125
|
# Returns
|
126
126
|
# the sequence_number from the sent message.
|
127
127
|
#
|
128
|
-
# Example
|
128
|
+
# Example
|
129
129
|
# pipe_to(:status_stream) do
|
130
130
|
# # the return from the inner method is what is sent
|
131
131
|
# do_some_stuff_to_generate_a_message()
|
@@ -174,8 +174,8 @@ module Smash
|
|
174
174
|
# Parameters
|
175
175
|
# *name +String+
|
176
176
|
#
|
177
|
-
# Returns
|
178
|
-
# CREATING, DELETING, ACTIVE
|
177
|
+
# Returns
|
178
|
+
# +String+ - stream status, one of: CREATING, DELETING, ACTIVE or UPDATING
|
179
179
|
def stream_status(name)
|
180
180
|
kinesis.describe_stream(stream_name: name).stream_description.stream_status
|
181
181
|
end
|
data/lib/cloud_powers/version.rb
CHANGED