mobilize-hive 1.25 → 1.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mobilize-hive/handlers/hive.rb +20 -16
- data/lib/mobilize-hive/version.rb +1 -1
- data/mobilize-hive.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a107187c623de567063792546016ea6fd59f92d3
|
4
|
+
data.tar.gz: 8a1aeaca87cdaa2161666a743d66af278a94eabb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab2b0d4b7ad35f3c5d213f534dff88f4e5fac0c7e43dd152b3325695e46ba970ac0a9616031520091b854aaac5a4fb66df9baf6da503be618b5483682d0091c7
|
7
|
+
data.tar.gz: 8a8ad939b734d328062f7dcf2f0b3702486804c20c1d127c1fbedc5d012694dcff996712321cfb8b0e49fcc48cc924938074b19d74d242ecf6d5792ba4a5dc7b
|
@@ -52,7 +52,7 @@ module Mobilize
|
|
52
52
|
end
|
53
53
|
|
54
54
|
# converts a source path or target path to a dst in the context of handler and stage
|
55
|
-
def Hive.path_to_dst(path,stage_path)
|
55
|
+
def Hive.path_to_dst(path,stage_path,gdrive_slot)
|
56
56
|
has_handler = true if path.index("://")
|
57
57
|
s = Stage.where(:path=>stage_path).first
|
58
58
|
params = s.params
|
@@ -78,7 +78,7 @@ module Mobilize
|
|
78
78
|
return Dataset.find_or_create_by_url(hive_url)
|
79
79
|
end
|
80
80
|
#otherwise, use hdfs convention
|
81
|
-
return Ssh.path_to_dst(path,stage_path)
|
81
|
+
return Ssh.path_to_dst(path,stage_path,gdrive_slot)
|
82
82
|
end
|
83
83
|
|
84
84
|
def Hive.url_by_path(path,user_name,is_target=false)
|
@@ -163,6 +163,9 @@ module Mobilize
|
|
163
163
|
end
|
164
164
|
|
165
165
|
def Hive.run_by_stage_path(stage_path)
|
166
|
+
gdrive_slot = Gdrive.slot_worker_by_path(stage_path)
|
167
|
+
#return blank response if there are no slots available
|
168
|
+
return nil unless gdrive_slot
|
166
169
|
s = Stage.where(:path=>stage_path).first
|
167
170
|
params = s.params
|
168
171
|
cluster = params['cluster'] || Hive.clusters.keys.first
|
@@ -181,10 +184,12 @@ module Mobilize
|
|
181
184
|
if params['hql']
|
182
185
|
hql = params['hql']
|
183
186
|
else
|
184
|
-
source = s.sources.first
|
185
|
-
hql = source.read(user_name)
|
187
|
+
source = s.sources(gdrive_slot).first
|
188
|
+
hql = source.read(user_name,gdrive_slot)
|
186
189
|
end
|
187
190
|
|
191
|
+
Gdrive.unslot_worker_by_path(stage_path)
|
192
|
+
|
188
193
|
#check for select at end
|
189
194
|
hql_array = hql.split(";").map{|hc| hc.strip}.reject{|hc| hc.length==0}
|
190
195
|
if hql_array.last.downcase.starts_with?("select")
|
@@ -231,7 +236,7 @@ module Mobilize
|
|
231
236
|
file_name = schema_path.split("/").last
|
232
237
|
out_url = "gridfs://#{schema_path}/#{file_name}"
|
233
238
|
Dataset.write_by_url(out_url,out_tsv,user_name)
|
234
|
-
schema_tsv = Dataset.find_by_url(out_url).read(user_name)
|
239
|
+
schema_tsv = Dataset.find_by_url(out_url).read(user_name,gdrive_slot)
|
235
240
|
schema_hash = {}
|
236
241
|
schema_tsv.tsv_to_hash_array.each do |ha|
|
237
242
|
schema_hash[ha['name']] = ha['datatype']
|
@@ -488,28 +493,26 @@ module Mobilize
|
|
488
493
|
end
|
489
494
|
|
490
495
|
def Hive.write_by_stage_path(stage_path)
|
496
|
+
gdrive_slot = Gdrive.slot_worker_by_path(stage_path)
|
497
|
+
#return blank response if there are no slots available
|
498
|
+
return nil unless gdrive_slot
|
491
499
|
s = Stage.where(:path=>stage_path).first
|
492
500
|
params = s.params
|
493
|
-
source = s.sources.first
|
501
|
+
source = s.sources(gdrive_slot).first
|
494
502
|
target = s.target
|
495
503
|
cluster, db, table = target.url.split("://").last.split("/")
|
496
|
-
#update stage with the node so we can use it
|
497
|
-
user_name = Hdfs.user_name_by_stage_path(stage_path,cluster)
|
498
|
-
job_name = s.path.sub("Runner_","")
|
499
|
-
|
500
504
|
#slot Hive worker if available
|
501
505
|
slot_id = Hive.slot_worker_by_cluster_and_path(cluster,stage_path)
|
502
506
|
return false unless slot_id
|
507
|
+
#update stage with the node so we can use it
|
508
|
+
user_name = Hdfs.user_name_by_stage_path(stage_path,cluster)
|
509
|
+
job_name = s.path.sub("Runner_","")
|
503
510
|
|
504
511
|
schema_hash = if params['schema']
|
505
|
-
gdrive_slot = Gdrive.slot_worker_by_path(stage_path)
|
506
|
-
#return blank response if there are no slots available
|
507
|
-
return nil unless gdrive_slot
|
508
512
|
Hive.schema_hash(params['schema'],user_name,gdrive_slot)
|
509
513
|
else
|
510
514
|
{}
|
511
515
|
end
|
512
|
-
Gdrive.unslot_worker_by_path(stage_path)
|
513
516
|
#drop target before create/insert?
|
514
517
|
drop = params['drop']
|
515
518
|
|
@@ -524,14 +527,15 @@ module Mobilize
|
|
524
527
|
source_hql = "select * from #{source_path};"
|
525
528
|
elsif ['gsheet','gridfs','hdfs'].include?(source.handler)
|
526
529
|
if source.path.ie{|sdp| sdp.index(/\.[A-Za-z]ql$/) or sdp.ends_with?(".ql")}
|
527
|
-
source_hql = source.read(user_name)
|
530
|
+
source_hql = source.read(user_name,gdrive_slot)
|
528
531
|
else
|
529
532
|
#tsv from sheet
|
530
|
-
source_tsv = source.read(user_name)
|
533
|
+
source_tsv = source.read(user_name,gdrive_slot)
|
531
534
|
end
|
532
535
|
end
|
533
536
|
end
|
534
537
|
|
538
|
+
Gdrive.unslot_worker_by_path(stage_path)
|
535
539
|
part_array = if params['partitions']
|
536
540
|
params['partitions'].to_a.map{|p| p.gsub(".","/").split("/")}.flatten
|
537
541
|
elsif params['target']
|
data/mobilize-hive.gemspec
CHANGED
@@ -16,5 +16,5 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
|
-
gem.add_runtime_dependency "mobilize-hdfs","1.
|
19
|
+
gem.add_runtime_dependency "mobilize-hdfs","1.26"
|
20
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobilize-hive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.26'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cassio Paes-Leme
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mobilize-hdfs
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.26'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.26'
|
27
27
|
description: Adds hive read, write, and run support to mobilize-hdfs
|
28
28
|
email:
|
29
29
|
- cpaesleme@dena.com
|