zillabyte-cli 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11fa3e9bf4153e02116008ae0f04067004f00f47
4
- data.tar.gz: 5b0a30dbddda2dfd3f03e5309f91802bad78cae1
3
+ metadata.gz: aa7c1271f40be305d46a9c440926de250e2bcbb5
4
+ data.tar.gz: a840c1321b322b4824d11fb03c46112cadfab23f
5
5
  SHA512:
6
- metadata.gz: 163b0f3e39bcdd1f4565f39c16e658d18beef3a75127b1ea158f720a22b63773db514ccd6aaf6f1a1cdc490278a07eaca4e72dabe648cb09e47e0f4955fcfbd0
7
- data.tar.gz: 9d3a5f6de29ec004f5f0accbd1806e836eac2e4218694dd72fd69d4c2e9e9bf506283da2b26c3773612eee838fd7cf6330e915f4bba59ae644d53fbe790bc3f1
6
+ metadata.gz: 382f3fc91b512bec0f75d621f1c9d21a1a0528a955c70e9289fe0d27b149a22b6f6fcecdf1137afada30e963e19915a73a3214908c881e4441ce3cc4d6dab200
7
+ data.tar.gz: cf13694d82ae79a5770a59d0e63c50f589f7e12981e58c4446828a6f6a12572bb076b47f1b36fcffb3ff0ccb66a506362f7e3720fcb7b6ba2833eaa85102d61e
@@ -1,4 +1,3 @@
1
- require "zillabyte/runner/multilang_operation"
2
1
 
3
2
 
4
3
 
@@ -12,6 +11,8 @@ class Zillabyte::Runner::ComponentOperation
12
11
 
13
12
  # Run the operation
14
13
  def self.run(node, dir, consumee_pipes, consumer_pipes, tester, meta, options = {})
14
+ require "zillabyte/runner/multilang_operation"
15
+ require("zillabyte/runner/operation")
15
16
 
16
17
  @__node = node
17
18
  @__name = node["name"]
@@ -165,7 +166,7 @@ class Zillabyte::Runner::ComponentOperation
165
166
  end
166
167
  end
167
168
  tuple_json = build_tuple_json(tuple)
168
- display_json = Hash[JSON.parse(tuple_json)["tuple"].map {|k,v| [truncate_message(k), truncate_message(v)]}].to_json
169
+ display_json = Hash[JSON.parse(tuple_json)["tuple"].map {|k,v| [Zillabyte::Runner::Operation.truncate_message(k), Zillabyte::Runner::Operation.truncate_message(v)]}].to_json
169
170
  send_to_consumers(tuple_json)
170
171
  end
171
172
 
@@ -231,7 +232,7 @@ class Zillabyte::Runner::ComponentOperation
231
232
  rpc_inputs << obj['tuple'][field.keys[0]]
232
233
  end
233
234
 
234
- display_json = Hash[obj['tuple'].map{|k, v| [truncate_message(k), truncate_message(v)]}].to_json
235
+ display_json = Hash[obj['tuple'].map{|k, v| [Zillabyte::Runner::Operation.truncate_message(k), Zillabyte::Runner::Operation.truncate_message(v)]}].to_json
235
236
 
236
237
 
237
238
  # Send RPC call
@@ -504,7 +505,6 @@ class Zillabyte::Runner::ComponentOperation
504
505
  end
505
506
  end
506
507
 
507
-
508
508
  # Get the write pipe of the stream consumer
509
509
  def self.get_write_stream(stream, consumer, number=1)
510
510
  wr_pipe = "wr_parent_" + number.to_s
@@ -537,7 +537,7 @@ class Zillabyte::Runner::ComponentOperation
537
537
  # Emit tuple_json to the consumer of a stream
538
538
  def self.emit_consumer_tuple(stream, consumer, tuple_json)
539
539
  begin
540
- display_json = Hash[JSON.parse(tuple_json)["tuple"].map {|k,v| [truncate_message(k), truncate_message(v)]}].to_json
540
+ display_json = Hash[JSON.parse(tuple_json)["tuple"].map {|k,v| [Zillabyte::Runner::Operation.truncate_message(k), Zillabyte::Runner::Operation.truncate_message(v)]}].to_json
541
541
  rescue JSON::ParserError
542
542
  cdisplay "Error: invalid JSON"
543
543
  end
@@ -14,6 +14,7 @@ module Zillabyte; module Runner; class MultilangOperation
14
14
  def self.run(node, dir, consumee_pipes, consumer_pipes, tester, meta, options = {})
15
15
  require("mkfifo")
16
16
  require("zillabyte/runner/component_operation")
17
+ require("zillabyte/runner/operation")
17
18
 
18
19
  require("pty")
19
20
  require("open3")
@@ -84,7 +85,7 @@ module Zillabyte; module Runner; class MultilangOperation
84
85
  end
85
86
 
86
87
  tuple_json = build_tuple_json(tuple)
87
- display_json = Hash[JSON.parse(tuple_json)["tuple"].map {|k,v| [truncate_message(k), truncate_message(v)]}].to_json
88
+ display_json = Hash[JSON.parse(tuple_json)["tuple"].map {|k,v| [Zillabyte::Runner::Operation.truncate_message(k), Zillabyte::Runner::Operation.truncate_message(v)]}].to_json
88
89
  send_to_consumers(tuple_json)
89
90
  end
90
91
 
@@ -1167,7 +1168,7 @@ module Zillabyte; module Runner; class MultilangOperation
1167
1168
  if obj['tuple']
1168
1169
 
1169
1170
  tuple = obj['tuple']
1170
- display_json = Hash[obj['tuple'].map{|k, v| [truncate_message(k), truncate_message(v)]}].to_json
1171
+ display_json = Hash[obj['tuple'].map{|k, v| [Zillabyte::Runner::Operation.truncate_message(k), Zillabyte::Runner::Operation.truncate_message(v)]}].to_json
1171
1172
 
1172
1173
  if col_map.keys.length != tuple.keys.length
1173
1174
  cdisplay "Error: invalid keys for sink tuple : Expected #{col_map.keys} , got: #{tuple.keys}"
@@ -1355,7 +1356,6 @@ module Zillabyte; module Runner; class MultilangOperation
1355
1356
  end
1356
1357
 
1357
1358
 
1358
-
1359
1359
  # Handshake connection to multilang
1360
1360
  def self.handshake(write_stream, read_stream)
1361
1361
  begin
@@ -1458,7 +1458,7 @@ module Zillabyte; module Runner; class MultilangOperation
1458
1458
  # Emit tuple_json to the consumer of a stream
1459
1459
  def self.emit_consumer_tuple(stream, consumer, tuple_json)
1460
1460
  begin
1461
- display_json = Hash[JSON.parse(tuple_json)["tuple"].map {|k,v| [truncate_message(k), truncate_message(v)]}].to_json
1461
+ display_json = Hash[JSON.parse(tuple_json)["tuple"].map {|k,v| [Zillabyte::Runner::Operation.truncate_message(k), Zillabyte::Runner::Operation.truncate_message(v)]}].to_json
1462
1462
  rescue JSON::ParserError
1463
1463
  cdisplay "Error: invalid JSON"
1464
1464
  end
@@ -1,11 +1,18 @@
1
1
  require 'json'
2
2
  require 'mkfifo'
3
- require "zillabyte/runner"
4
3
 
5
4
 
6
5
  # Shared state between operations
7
- class Zillabyte::Runner::Operation
6
+ module Zillabyte; module Runner; class Operation
8
7
 
8
+ # Format a message for display
9
+ def self.truncate_message(msg)
10
+ return msg if(!msg.instance_of?(String))
11
+ t_length = 50 # truncates entries to this length
12
+ m_length = msg.length
13
+ msg_out = m_length > t_length ? msg[0..t_length-3]+"..." : msg
14
+ msg_out
15
+ end
9
16
 
10
- end
17
+ end; end; end
11
18
 
@@ -1,5 +1,5 @@
1
1
  module Zillabyte
2
2
  module CLI
3
- VERSION = "0.1.21"
3
+ VERSION = "0.1.22"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zillabyte-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.21
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - zillabyte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-28 00:00:00.000000000 Z
11
+ date: 2014-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake