zillabyte-cli 0.1.26 → 0.1.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OGVkYTA3NmNjNDA1NjhiY2FmMWNjZjY3MzFmZDFkZDRmMDkyMTgzYw==
5
- data.tar.gz: !binary |-
6
- NWFiYTZiZjQ3OWI1OGU1M2VjZWU2Zjg3YzlhY2UyNDhkNjhjN2JlOA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZGNmZDIzZDIxY2Y0OWE3NjBhNjIzNDJhOTIwNDVjNGU5MjJjYWUzNmJiNTU4
10
- ZjU5ZGMzYTY2M2NjMmVjMGM3MTRmNWE0YjE2Yjc0OGQ2MDU3YTI4N2FhZDJi
11
- Y2FlZWE0YWZiYWRhMTI4M2NlOTIwNjA2YzlkZTJlNTcxM2QwMTM=
12
- data.tar.gz: !binary |-
13
- MWZiY2YyMDBmYTc3YjE3ZTgyODYxMGFiNjBmZWQ4NmQwYWJkNjhiNGQzODcw
14
- NmY1NGQ3MzdjYTJkMmFmNjkxNmUwNmUwY2RmZTk5NWFhZWIwYTNhZDI0ZjIz
15
- OWJjY2QxYzMyYTRjNTg1ODdlYjZiMWNkMjliNWRmN2U0ODU3ZDU=
2
+ SHA1:
3
+ metadata.gz: da9de9c58408cc165925f43df2c33c4fc20b556c
4
+ data.tar.gz: 79381d046b793938908d3150e5f7781d6cc49329
5
+ SHA512:
6
+ metadata.gz: 8520abfb5342867d7b91d4c84de4d2a1c70ce1a7b81355718f2ea859aa198d940522dff944ba5340f7e444f9e009ad72b932472d264168093f07f92dcaf14cd2
7
+ data.tar.gz: 0c1ac0f1b5bd0158491a5340e0a277779a5380d566de53a6ff4034ef836fa4dd3cef457bc80ca691a3301d7434733a8da9a45704a4e301a4ae793d4f3a51ab82
@@ -0,0 +1,5 @@
1
+ require "zillabyte-cli/version"
2
+ require "zillabyte/api"
3
+ require "zillabyte/cli"
4
+ require "zillabyte/common"
5
+ require "zillabyte/queries"
@@ -1,5 +1,5 @@
1
1
  module Zillabyte
2
2
  module CLI
3
- VERSION = "0.1.26"
3
+ VERSION = "0.1.27"
4
4
  end
5
5
  end
@@ -0,0 +1,12 @@
1
+ require "zillabyte/cli/base"
2
+
3
+ # manage custom logs
4
+ #
5
+ class Zillabyte::Command::Logs < Zillabyte::Command::Base
6
+
7
+
8
+
9
+
10
+
11
+
12
+ end
@@ -0,0 +1,43 @@
1
+ require "zillabyte/cli/base"
2
+ require 'readline'
3
+ # REPL console for zillabyte commands
4
+ #
5
+ class Zillabyte::Command::Repl < Zillabyte::Command::Base
6
+
7
+ # repl
8
+ #
9
+ # start a console session for zillabyte
10
+ # --quiet # HIDDEN
11
+ # --history HISTORY# HIDDEN hack to allow history for readline
12
+ def index
13
+ if !options[:quiet]
14
+ v = `zillabyte version`
15
+ display "\n#{v}Type q,exit or Ctrl+D to quit\n\n"
16
+ end
17
+ server = `echo $ZILLABYTE_API_HOST` || ""
18
+ prompt = ""
19
+ if server && server.chomp.length > 0
20
+ prompt = "#{server.chomp} "
21
+ end
22
+ prompt += "zillabyte $ "
23
+ if options[:history]
24
+ #p options[:history]
25
+ history = JSON.parse(options[:history])
26
+ history.last(50).each do |his|
27
+ # TODO: Handle single quotes ??
28
+ Readline::HISTORY << his
29
+ end
30
+ end
31
+ # TODO: Add tab completion for basic commands, app/relation names etc.
32
+ while cmd = Readline.readline(prompt, true)
33
+ if cmd && cmd.length > 0
34
+ if cmd.downcase == "exit" || cmd.downcase == "q"
35
+ display "" # TODO Make Ctrl+D print a newline too
36
+ return
37
+ else
38
+ exec "zillabyte #{cmd}; zillabyte repl --quiet --history '#{Readline::HISTORY.to_a.to_json}'"
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -50,124 +50,10 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Flows
50
50
  # List details for an app, including percentage complete, if the
51
51
  # source is an existing dataset.
52
52
  #
53
+ # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
54
+ #
53
55
  def details
54
-
55
- app_id = options[:id] || shift_argument
56
- type = options[:output_type]
57
-
58
- if app_id.nil?
59
- app_id = read_name_from_conf(options)
60
- end
61
-
62
- res = api.request(
63
- :expects => 200,
64
- :method => :get,
65
- :path => "/apps/#{app_id}/details",
66
- :body => options.to_json
67
- )
68
- res = res.body.select do |instance|
69
- !instance.nil?
70
- end
71
-
72
- # a nested hash so can't map directly
73
- # instead i'll map separately and then merge the arrays
74
- heading1 = ["type", "name"]
75
-
76
- # a level deeper
77
- heading2 = ["consumed", "emitted", "errors"]
78
-
79
- # for the table output
80
- headings = heading1 + heading2
81
-
82
- # get the values for the headings
83
- type_name = res.map do |instance|
84
-
85
- heading1.map do |heading|
86
- instance[heading]
87
- end
88
-
89
- end
90
-
91
- # get the values for the headings
92
- stats = res.map do |instance|
93
-
94
- heading2.map do |heading|
95
- instance["stats"][heading]
96
- end
97
-
98
- end
99
-
100
- # combine the arrays
101
- rows = type_name.zip(stats).map{|x,y| x.concat y}
102
-
103
- # check if it's from a dataset.
104
- # if the source is a dataset, there's a sharder.
105
- # remove source types, and hardcode sharder-named instances as source
106
-
107
- from_dataset = false
108
-
109
- rows.each do | row |
110
- if row[1].scan("sharder").length != 0
111
- from_dataset = true
112
- break
113
- end
114
- end
115
-
116
- if from_dataset == true
117
-
118
- rows = rows.each do |row|
119
- if row[0].scan("source").length != 0
120
- rows.delete(row)
121
- end
122
-
123
- end
124
-
125
-
126
- rows = rows.each do |row|
127
- if row[1].scan("sharder").length != 0
128
- row[0] = "source"
129
- end
130
- end
131
-
132
- end
133
-
134
- # rows to be output to the CLI
135
- rows = rows.group_by{ |type, name, consumed, emitted, errors| name }.map{ |hashkey, array| [array[0][0], hashkey, array.inject(0){ |sum, i | sum + i[2].to_i }, array.inject(0){ |sum, i | sum + i[3].to_i },array.inject(0){ |sum, i | sum + i[4].to_i }] }
136
- # example sums: [["sink", "has_facebook_likebox_and_vwo", 73, 0, 0], ["source", "sharder.1", 16, 10367872, 1], ["each", "each_3", 10367872, 73, 0]]
137
-
138
- # calculate percentage for the user to see
139
-
140
- attempts = 0
141
- total = 0
142
-
143
- if from_dataset == true
144
-
145
- rows.each do |instance|
146
- if instance[0] == "source"
147
- total = instance[3]
148
- end
149
- end
150
-
151
-
152
- rows.each do |instance|
153
- if instance[0] == "each"
154
- attempts = instance[2]
155
- end
156
- end
157
- end
158
-
159
- if attempts > 0 && total > 0
160
- completion = attempts/total*100
161
- else
162
- completion = 0
163
- end
164
-
165
- # output on the CLI
166
- display "details:"
167
- display TableOutputBuilder.build_table(headings, rows, type)
168
- if from_dataset == true
169
- display "percent complete: #{completion}%\n"
170
- end
56
+ super
171
57
  end
172
58
 
173
59
 
@@ -176,7 +62,7 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Flows
176
62
  # Uploads an app.
177
63
  #
178
64
  # --config CONFIG_FILE # Use the given config file
179
- # --directory DIR # App directory
65
+ # --dir DIR # App directory
180
66
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
181
67
  #
182
68
  # Examples:
@@ -193,12 +79,12 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Flows
193
79
  # Pulls an app source to a directory.
194
80
  #
195
81
  # --force # Pulls even if the directory exists
196
- # --directory DIR # App directory
82
+ # --dir DIR # App directory
197
83
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
198
84
  #
199
85
  # Examples:
200
86
  #
201
- # $ zillabyte apps:pull .
87
+ # $ zillabyte apps:pull 27 .
202
88
  #
203
89
  def pull
204
90
  super
@@ -221,7 +107,7 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Flows
221
107
  #
222
108
  # Performs any necessary initialization for the app.
223
109
  #
224
- # --directory DIR # App directory
110
+ # --dir DIR # App directory
225
111
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
226
112
  # --mode MODE # Specify development or production mode for dependencies #HIDDEN
227
113
  #
@@ -395,7 +281,7 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Flows
395
281
  # --config CONFIG_FILE # Use the given config file
396
282
  # --output OUTPUT_FILE # Writes sink output to a file
397
283
  # --cycles CYCLES # Number of cycles to emit [default: 1]
398
- # --directory DIR # App directory
284
+ # --dir DIR # App directory
399
285
  # -i, --interactive # Interactively control input and read output
400
286
  #
401
287
  def test
@@ -420,7 +306,7 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Flows
420
306
  # Runs a local app with live data.
421
307
  #
422
308
  # --config CONFIG_FILE # Use the given config file
423
- # --directory DIR # App directory
309
+ # --dir DIR # App directory
424
310
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
425
311
  #
426
312
  # HIDDEN:
@@ -429,25 +315,12 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Flows
429
315
  end
430
316
 
431
317
 
432
- # apps:status [DIR]
433
- #
434
- # Fetches detailed status of the app.
435
- #
436
- # --directory DIR # App directory
437
- # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
438
- #
439
- def status
440
- super
441
- end
442
-
443
-
444
-
445
318
  # apps:info [DIR]
446
319
  #
447
320
  # Outputs the info for the app in the dir.
448
321
  #
449
322
  # --pretty # Pretty prints the info output
450
- # --directory DIR # App directory
323
+ # --dir DIR # App directory
451
324
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
452
325
  #
453
326
  def info
@@ -20,7 +20,7 @@ class Zillabyte::Command::Components < Zillabyte::Command::Flows
20
20
  # Initializes a new component.
21
21
  #
22
22
  # --lang LANG # Specify which language to use (ruby, python) [default: 'ruby']
23
- # --dir DIR # Target directory of the app
23
+ # --dir DIR # Target directory of the component
24
24
  # --remote REMOTE # The git remote name [default: 'zillabyte']
25
25
  #
26
26
  # Examples:
@@ -98,29 +98,17 @@ class Zillabyte::Command::Components < Zillabyte::Command::Flows
98
98
  # Pulls a component source to a directory.
99
99
  #
100
100
  # --force # Pulls even if the directory exists
101
- # --directory DIR # Component directory
101
+ # --dir DIR # Component directory
102
102
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
103
103
  #
104
104
  # Examples:
105
105
  #
106
- # $ zillabyte components:pull .
106
+ # $ zillabyte components:pull 27 .
107
107
  #
108
108
  def pull
109
109
  super
110
110
  end
111
111
 
112
- # components:status [DIR]
113
- #
114
- # Fetches detailed status of the component.
115
- #
116
- # --directory DIR # Component directory
117
- # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
118
- #
119
- def status
120
- super
121
- end
122
-
123
-
124
112
 
125
113
  # components:delete ID
126
114
  #
@@ -139,7 +127,7 @@ class Zillabyte::Command::Components < Zillabyte::Command::Flows
139
127
  # Outputs the info for the component in the dir.
140
128
  #
141
129
  # --pretty # Pretty prints the info output
142
- # --directory DIR # Component directory
130
+ # --dir DIR # Component directory
143
131
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
144
132
  #
145
133
  def info
@@ -154,7 +142,7 @@ class Zillabyte::Command::Components < Zillabyte::Command::Flows
154
142
  # --config CONFIG_FILE # Use the given config file
155
143
  # --input INPUT_FILE # Uses a CSV for component input
156
144
  # --output OUTPUT_FILE # Write output to a CSV
157
- # --directory DIR # Component directory
145
+ # --dir DIR # Component directory
158
146
  #
159
147
  def test
160
148
  super
@@ -164,23 +152,13 @@ class Zillabyte::Command::Components < Zillabyte::Command::Flows
164
152
  #
165
153
  # Performs any necessary initialization for the component.
166
154
  #
167
- # --directory DIR # Component directory
155
+ # --dir DIR # Component directory
168
156
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json HIDDEN
169
157
  #
170
158
  def prep
171
159
  super
172
160
  end
173
161
 
174
- # components:errors ID
175
- #
176
- # Show recent errors generated by the componeny rpc.
177
- #
178
- # --output_type OUTPUT_TYPE # Specify an output type i.e. json HIDDEN
179
- #
180
- def errors
181
- super
182
- end
183
-
184
162
  # components:logs ID [OPERATION_NAME]
185
163
  #
186
164
  # Streams logs for the component from our cluster.
@@ -198,7 +176,7 @@ class Zillabyte::Command::Components < Zillabyte::Command::Flows
198
176
  # Runs a local component with live data.
199
177
  #
200
178
  # --config CONFIG_FILE # Use the given config file
201
- # --directory DIR # Component directory
179
+ # --dir DIR # Component directory
202
180
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json HIDDEN
203
181
  #
204
182
  # HIDDEN:
@@ -212,7 +190,7 @@ class Zillabyte::Command::Components < Zillabyte::Command::Flows
212
190
  # Uploads a component.
213
191
  #
214
192
  # --config CONFIG_FILE # Use the given config file
215
- # --directory DIR # Component directory
193
+ # --dir DIR # Component directory
216
194
  #
217
195
  # Examples:
218
196
  #
@@ -7,51 +7,17 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
7
7
  MAX_POLL_SECONDS = 60 * 15
8
8
  POLL_SLEEP = 2.0
9
9
 
10
- # flows:status [DIR]
11
- #
12
- # Fetches detailed status of the flow.
13
- #
14
- # --directory DIR # Flow directory
15
- # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
16
- #
17
- def status
18
-
19
- id = options[:id] || shift_argument
20
- type = options[:output_type]
21
-
22
- if id.nil?
23
- id = read_name_from_conf(options)
24
- end
25
-
26
- res = api.request(
27
- :expects => 200,
28
- :method => :get,
29
- :path => "/flows/#{id}"
30
- )
31
-
32
- res.body
33
- if type == "json"
34
- display res.body.to_json
35
- else
36
- # TODO
37
- display res.body.to_json
38
- end
39
-
40
- end
41
-
42
-
43
-
44
10
  # flows:pull ID DIR
45
11
  #
46
12
  # Pulls a flow source to a directory.
47
13
  #
48
14
  # --force # Pulls even if the directory exists
49
- # --directory DIR # Flow directory
15
+ # --dir DIR # Flow directory
50
16
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
51
17
  #
52
18
  # Examples:
53
19
  #
54
- # $ zillabyte flows:pull .
20
+ # $ zillabyte flows:pull 27 .
55
21
  #
56
22
  def pull
57
23
 
@@ -94,7 +60,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
94
60
  # Uploads a flow.
95
61
  #
96
62
  # --config CONFIG_FILE # Use the given config file
97
- # --directory DIR # Flow directory
63
+ # --dir DIR # Flow directory
98
64
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
99
65
  #
100
66
  def push
@@ -150,7 +116,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
150
116
  #
151
117
  # Performs any necessary initialization for the flow.
152
118
  #
153
- # --directory DIR # Flow directory
119
+ # --dir DIR # Flow directory
154
120
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
155
121
  # --mode MODE # Specify development or production mode for dependencies #HIDDEN
156
122
  #
@@ -299,14 +265,150 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
299
265
  alias_command "errors", "flows:errors"
300
266
 
301
267
 
268
+ # flows:details ID
269
+ #
270
+ # List details for a flow.
271
+ #
272
+ # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
273
+ #
274
+ def details
275
+
276
+ flow_id = options[:id] || shift_argument
277
+ type = options[:output_type]
278
+
279
+ if flow_id.nil?
280
+ flow_id = read_name_from_conf(options)
281
+ end
282
+
283
+ res = api.request(
284
+ :expects => 200,
285
+ :method => :get,
286
+ :path => "/flows/#{flow_id}/details",
287
+ :body => options.to_json
288
+ )
289
+
290
+ flow_state = res.body["state"]
291
+ instances = res.body["instances"].select do |instance|
292
+ !instance.nil?
293
+ end
294
+
295
+ # a nested hash so can't map directly
296
+ # instead i'll map separately and then merge the arrays
297
+ heading1 = ["type", "name"]
298
+
299
+ # a level deeper
300
+ heading2 = ["consumed", "emitted", "errors"]
301
+
302
+ # for the table output
303
+ headings = heading1 + heading2
304
+
305
+ # get the values for the headings
306
+ type_name = instances.map do |instance|
307
+
308
+ heading1.map do |heading|
309
+ instance[heading]
310
+ end
311
+
312
+ end
313
+
314
+ # get the values for the headings
315
+ stats = instances.map do |instance|
316
+
317
+ heading2.map do |heading|
318
+ instance["stats"][heading]
319
+ end
320
+
321
+ end
322
+
323
+ # combine the arrays
324
+ rows = type_name.zip(stats).map{|x,y| x.concat y}
325
+
326
+ # check if it's from a dataset.
327
+ # if the source is a dataset, there's a sharder.
328
+ # remove source types, and hardcode sharder-named instances as source
329
+
330
+ from_dataset = false
331
+
332
+ rows.each do | row |
333
+ if row[1].scan("sharder").length != 0
334
+ from_dataset = true
335
+ break
336
+ end
337
+ end
338
+
339
+ if from_dataset == true
340
+
341
+ rows = rows.each do |row|
342
+ if row[0].scan("source").length != 0
343
+ rows.delete(row)
344
+ end
345
+
346
+ end
347
+
348
+
349
+ rows = rows.each do |row|
350
+ if row[1].scan("sharder").length != 0
351
+ row[0] = "source"
352
+ end
353
+ end
354
+
355
+ end
356
+
357
+ # rows to be output to the CLI
358
+ rows = rows.group_by{ |type, name, consumed, emitted, errors| name }.map{ |hashkey, array| [array[0][0], hashkey, array.inject(0){ |sum, i | sum + i[2].to_i }, array.inject(0){ |sum, i | sum + i[3].to_i },array.inject(0){ |sum, i | sum + i[4].to_i }] }
359
+ # example sums: [["sink", "has_facebook_likebox_and_vwo", 73, 0, 0], ["source", "sharder.1", 16, 10367872, 1], ["each", "each_3", 10367872, 73, 0]]
360
+
361
+ # calculate percentage for the user to see
362
+
363
+ attempts = 0
364
+ total = 0
365
+
366
+ if from_dataset == true
367
+
368
+ rows.each do |instance|
369
+ if instance[0] == "source"
370
+ total = instance[3]
371
+ end
372
+ end
373
+
374
+
375
+ rows.each do |instance|
376
+ if instance[0] == "each"
377
+ attempts = instance[2]
378
+ end
379
+ end
380
+ end
381
+
382
+ if attempts > 0 && total > 0
383
+ completion = attempts/total*100
384
+ else
385
+ completion = 0
386
+ end
387
+
388
+ # output on the CLI
389
+ if type.nil?
390
+ require("zillabyte/cli/helpers/table_output_builder")
391
+ display "State: #{flow_state}"
392
+ display TableOutputBuilder.build_terminal_table(headings, rows)
393
+ if from_dataset == true
394
+ display "percent complete: #{completion}%\n"
395
+ end
396
+ else
397
+ display res.body.to_json
398
+ end
399
+ end
400
+ alias_command "details", "flows:details"
401
+
402
+
302
403
  # flows:live_run [OPERATION_NAME] [PIPE_NAME] [DIR]
303
404
  #
304
405
  # Runs a local flow with live data.
305
406
  #
306
407
  # --config CONFIG_FILE # Use the given config file
307
- # --directory DIR # Flow directory
408
+ # --dir DIR # Flow directory
308
409
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
309
410
  #
411
+ # HIDDEN:
310
412
  def live_run
311
413
  require("zillabyte/cli/config")
312
414
  name = options[:name] || shift_argument
@@ -340,7 +442,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
340
442
  # Outputs the info for the flow in the dir.
341
443
  #
342
444
  # --pretty # Pretty prints the info output
343
- # --directory DIR # Flow directory
445
+ # --dir DIR # Flow directory
344
446
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
345
447
  #
346
448
  def info
@@ -503,7 +605,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
503
605
  # --input INPUT_FILE # Uses a CSV for component input (only applicable for components)
504
606
  # --output OUTPUT_FILE # Writes sink output to a file
505
607
  # --cycles CYCLES # Number of cycles to emit [default 1] (only applicable for apps)
506
- # --directory DIR # Flow directory
608
+ # --dir DIR # Flow directory
507
609
  # -i, --interactive # Interactively control input and read output (only applicable for apps)
508
610
  #
509
611
  def test
@@ -519,7 +621,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
519
621
  require("zillabyte/api/flows")
520
622
  meta = Zillabyte::API::Flows.get_rich_meta_info_from_script(dir, session, {:test => true})
521
623
  if meta.nil? || meta["nodes"].nil?
522
- error "this is not a valid zillabyte app directory"
624
+ error "this is not a valid zillabyte flow directory"
523
625
  exit
524
626
  end
525
627
 
@@ -527,7 +629,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
527
629
  version = meta["multilang_version"] || "0.0.0"
528
630
  version_arr = version.split('.').map {|v| v.to_i}
529
631
  if version_arr.empty? || (version_arr[0] == 0 && version_arr[1] < 1)
530
- display "The version of zillabyte used in your application is outdated."
632
+ display "The version of zillabyte used in your flow is outdated."
531
633
  display "Please use upgrade your zillabyte gem via 'bundle update zillabyte; gem cleanup zillabyte'"
532
634
  return
533
635
  end
@@ -4,7 +4,9 @@ require("zillabyte/cli/base")
4
4
  #
5
5
  class Zillabyte::Command::Help < Zillabyte::Command::Base
6
6
 
7
- PRIMARY_NAMESPACES = %w( data query apps components rpc logs )
7
+ PRIMARY_NAMESPACES = %w( data query apps components rpc )
8
+ ALIAS_TO_RPC = %w( errors details )
9
+ ALIAS_TO_RPC_AND_COMPONENTS = %w( logs )
8
10
 
9
11
  # help
10
12
  def index(*direct_args)
@@ -95,7 +97,14 @@ private
95
97
 
96
98
  if alias_to.include?("flows")
97
99
  puts "#{command_alias.ljust(a_size)} --> #{alias_to.gsub("flows", "apps").ljust(a_to_size)} # #{commands[alias_to][:summary].gsub("flow", "app")}"
98
- puts "#{" ".ljust(a_size)} --> #{alias_to.gsub("flows", "components").ljust(a_to_size)} # #{commands[alias_to][:summary].gsub("flow", "component")}"
100
+ if ALIAS_TO_RPC.member? command_alias
101
+ puts "#{" ".ljust(a_size)} --> #{alias_to.gsub("flows", "rpc").ljust(a_to_size)} # #{commands[alias_to][:summary].gsub("flow", "rpc")}"
102
+ elsif ALIAS_TO_RPC_AND_COMPONENTS.member? command_alias
103
+ puts "#{" ".ljust(a_size)} --> #{alias_to.gsub("flows", "rpc").ljust(a_to_size)} # #{commands[alias_to][:summary].gsub("flow", "rpc")}"
104
+ puts "#{" ".ljust(a_size)} --> #{alias_to.gsub("flows", "components").ljust(a_to_size)} # #{commands[alias_to][:summary].gsub("flow", "component")}"
105
+ else
106
+ puts "#{" ".ljust(a_size)} --> #{alias_to.gsub("flows", "components").ljust(a_to_size)} # #{commands[alias_to][:summary].gsub("flow", "component")}"
107
+ end
99
108
  else
100
109
  puts "#{command_alias.ljust(a_size)} --> #{alias_to.ljust(a_to_size)} # #{commands[alias_to][:summary]}"
101
110
  end
@@ -95,7 +95,6 @@ class Zillabyte::Command::RPC < Zillabyte::Command::Flows
95
95
  end
96
96
  end
97
97
  end
98
- alias_command "rpc", "rpc:start"
99
98
  alias_command "execute", "rpc:start"
100
99
  alias_command "executes", "rpc:start"
101
100
 
@@ -160,8 +159,42 @@ class Zillabyte::Command::RPC < Zillabyte::Command::Flows
160
159
  end
161
160
  end
162
161
  end
163
-
164
-
162
+
163
+
164
+ # rpc:details ID
165
+ #
166
+ # List details for an rpc.
167
+ #
168
+ # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
169
+ #
170
+ def details
171
+ super
172
+ end
173
+
174
+
175
+ # rpc:errors ID
176
+ #
177
+ # Show recent errors generated by the rpc.
178
+ #
179
+ # --output_type OUTPUT_TYPE # Specify an output type i.e. json HIDDEN
180
+ #
181
+ def errors
182
+ super
183
+ end
184
+
185
+
186
+ # rpc:logs ID [OPERATION_NAME]
187
+ #
188
+ # Streams logs for the rpc from our cluster.
189
+ #
190
+ # --operation OPERATION_NAME # Specify the operation to show logs for
191
+ # -v, --verbose LEVEL # Sets the verbosity (error, info, debug) [default: info]
192
+ # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
193
+ #
194
+ def logs
195
+ super
196
+ end
197
+
165
198
 
166
199
  # rpc:kill ID
167
200
  #
@@ -0,0 +1,27 @@
1
+ import zillabyte
2
+
3
+ def prep(controller):
4
+ return
5
+
6
+ # This is the heart of your algorithm. It's processed on every
7
+ # web page. This algorithm is run in parallel on possibly hundreds
8
+ # of machines.
9
+ def execute(controller, tup):
10
+ if("hello world" in tup.values["html"]):
11
+ controller.emit("has_hello_world",{"url":tup.values["url"]})
12
+ return
13
+
14
+ zillabyte.simple_function(\
15
+ # This directive instructs zillabyte to give your function every
16
+ # web page in our known universe. Your function will have access
17
+ # to two fields: URL and HTML
18
+ matches = "select * from web_pa", \
19
+
20
+ # This directive tells Zillabyte what kind of data your function
21
+ # produces. In this case, we're saying we will emit a tuple that
22
+ # is one-column wide and contains the field 'URL'
23
+ emits = [["has_hello_world", [{"url":"string"}]]], \
24
+
25
+ prepare = prep, \
26
+ execute = execute\
27
+ )
metadata CHANGED
@@ -1,167 +1,167 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zillabyte-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.26
4
+ version: 0.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - zillabyte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-06 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: netrc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.7.7
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.7.7
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rest-client
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.6.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.6.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: excon
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.31'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.31'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: terminal-table
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.4'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: activesupport
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 3.2.11
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 3.2.11
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: multi_json
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '1.0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: bundler
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '1.3'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '1.3'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: colorize
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0.6'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.6'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: indentation
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0.1'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.1'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: mkfifo
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ! '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ! '>='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  description: The Official Zillabyte CLI Gem
@@ -173,9 +173,16 @@ executables:
173
173
  extensions: []
174
174
  extra_rdoc_files: []
175
175
  files:
176
+ - Gemfile
177
+ - LICENSE
178
+ - README.md
176
179
  - bin/zb
177
180
  - bin/zbd
178
181
  - bin/zillabyte
182
+ - lib/#zillabyte-cli.rb#
183
+ - lib/zillabyte-cli.rb
184
+ - lib/zillabyte-cli/version.rb
185
+ - lib/zillabyte/api.rb
179
186
  - lib/zillabyte/api/apps.rb
180
187
  - lib/zillabyte/api/base.rb
181
188
  - lib/zillabyte/api/components.rb
@@ -189,8 +196,10 @@ files:
189
196
  - lib/zillabyte/api/settings.rb
190
197
  - lib/zillabyte/api/sources.rb
191
198
  - lib/zillabyte/api/zillalogs.rb
192
- - lib/zillabyte/api.rb
193
199
  - lib/zillabyte/auth.rb
200
+ - lib/zillabyte/cli.rb
201
+ - lib/zillabyte/cli/#logs.rb#
202
+ - lib/zillabyte/cli/#repl.rb#
194
203
  - lib/zillabyte/cli/apps.rb
195
204
  - lib/zillabyte/cli/auth.rb
196
205
  - lib/zillabyte/cli/base.rb
@@ -215,68 +224,69 @@ files:
215
224
  - lib/zillabyte/cli/templates/apps/python/app.py
216
225
  - lib/zillabyte/cli/templates/apps/python/requirements.txt
217
226
  - lib/zillabyte/cli/templates/apps/python/zillabyte.conf.yaml
218
- - lib/zillabyte/cli/templates/apps/ruby/app.rb.erb
219
227
  - lib/zillabyte/cli/templates/apps/ruby/Gemfile
220
228
  - lib/zillabyte/cli/templates/apps/ruby/README.md
229
+ - lib/zillabyte/cli/templates/apps/ruby/app.rb.erb
221
230
  - lib/zillabyte/cli/templates/apps/ruby/zillabyte.conf.yaml
222
231
  - lib/zillabyte/cli/templates/components/js/simple_function.js
223
232
  - lib/zillabyte/cli/templates/components/js/zillabyte.conf.yaml
224
233
  - lib/zillabyte/cli/templates/components/python/component.py
225
234
  - lib/zillabyte/cli/templates/components/python/requirements.txt
226
235
  - lib/zillabyte/cli/templates/components/python/zillabyte.conf.yaml
227
- - lib/zillabyte/cli/templates/components/ruby/component.rb.erb
228
236
  - lib/zillabyte/cli/templates/components/ruby/Gemfile
237
+ - lib/zillabyte/cli/templates/components/ruby/component.rb.erb
229
238
  - lib/zillabyte/cli/templates/components/ruby/zillabyte.conf.yaml
239
+ - lib/zillabyte/cli/templates/python/#simple_function.py#
230
240
  - lib/zillabyte/cli/untitled.md
231
241
  - lib/zillabyte/cli/version.rb
232
242
  - lib/zillabyte/cli/zillalogs.rb
233
- - lib/zillabyte/cli.rb
234
243
  - lib/zillabyte/command.rb
244
+ - lib/zillabyte/common.rb
235
245
  - lib/zillabyte/common/log_fetcher.rb
236
246
  - lib/zillabyte/common/session.rb
237
247
  - lib/zillabyte/common/tar.rb
238
- - lib/zillabyte/common.rb
239
248
  - lib/zillabyte/helpers.rb
240
249
  - lib/zillabyte/queries.rb
250
+ - lib/zillabyte/runner.rb
241
251
  - lib/zillabyte/runner/app_runner.rb
242
252
  - lib/zillabyte/runner/component_operation.rb
243
253
  - lib/zillabyte/runner/component_runner.rb
244
254
  - lib/zillabyte/runner/multilang_operation.rb
245
255
  - lib/zillabyte/runner/operation.rb
246
- - lib/zillabyte/runner.rb
247
- - lib/zillabyte-cli/version.rb
248
- - lib/zillabyte-cli.rb
249
- - LICENSE
250
- - README.md
256
+ - zillabyte-cli.gemspec
251
257
  - zillabyte_emails.csv
252
258
  - zillaconf.json
253
- - Gemfile
254
- - zillabyte-cli.gemspec
255
259
  homepage: http://www.zillabyte.com
256
260
  licenses:
257
261
  - MIT
258
262
  metadata: {}
259
- post_install_message: ! "\nGetting Started with Zillabyte\n==============================\n\n(1)
260
- Register for an auth token at http://zillabyte.com\n(2) Log in by running 'zillabyte
261
- login' in the command line\n(3) Build an empty app by running 'zillabyte apps:init'\n
262
- \ Or... check out our Quick Starts by visiting http://docs.zillabyte.com/\n\nQuestions,
263
- comments? Please visit us at http://docs.zillabyte.com\n"
263
+ post_install_message: |2
264
+
265
+ Getting Started with Zillabyte
266
+ ==============================
267
+
268
+ (1) Register for an auth token at http://zillabyte.com
269
+ (2) Log in by running 'zillabyte login' in the command line
270
+ (3) Build an empty app by running 'zillabyte apps:init'
271
+ Or... check out our Quick Starts by visiting http://docs.zillabyte.com/
272
+
273
+ Questions, comments? Please visit us at http://docs.zillabyte.com
264
274
  rdoc_options: []
265
275
  require_paths:
266
276
  - lib
267
277
  required_ruby_version: !ruby/object:Gem::Requirement
268
278
  requirements:
269
- - - ! '>='
279
+ - - ">="
270
280
  - !ruby/object:Gem::Version
271
281
  version: '0'
272
282
  required_rubygems_version: !ruby/object:Gem::Requirement
273
283
  requirements:
274
- - - ! '>='
284
+ - - ">="
275
285
  - !ruby/object:Gem::Version
276
286
  version: '0'
277
287
  requirements: []
278
288
  rubyforge_project:
279
- rubygems_version: 2.0.7
289
+ rubygems_version: 2.2.2
280
290
  signing_key:
281
291
  specification_version: 4
282
292
  summary: The Official Zillabyte CLI Gem