mobilize-hdfs 1.2 → 1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -96,7 +96,7 @@ module Mobilize
96
96
  end
97
97
 
98
98
  # converts a source path or target path to a dst in the context of handler and stage
99
- def Hdfs.path_to_dst(path,stage_path)
99
+ def Hdfs.path_to_dst(path,stage_path,gdrive_slot)
100
100
  has_handler = true if path.index("://")
101
101
  s = Stage.where(:path=>stage_path).first
102
102
  params = s.params
@@ -114,7 +114,7 @@ module Mobilize
114
114
  return Dataset.find_or_create_by_url(hdfs_url)
115
115
  end
116
116
  #otherwise, use ssh convention
117
- return Ssh.path_to_dst(path,stage_path)
117
+ return Ssh.path_to_dst(path,stage_path,gdrive_slot)
118
118
  end
119
119
 
120
120
  def Hdfs.url_by_path(path,user_name,is_target=false)
@@ -156,15 +156,19 @@ module Mobilize
156
156
  end
157
157
 
158
158
  def Hdfs.write_by_stage_path(stage_path)
159
+ gdrive_slot = Gdrive.slot_worker_by_path(stage_path)
160
+ #return blank response if there are no slots available
161
+ return nil unless gdrive_slot
159
162
  s = Stage.where(:path=>stage_path).first
160
- source = s.sources.first
163
+ source = s.sources(gdrive_slot).first
164
+ Gdrive.unslot_worker_by_path(stage_path)
161
165
  target = s.target
162
166
  cluster = target.url.split("://").last.split("/").first
163
167
  user_name = Hdfs.user_name_by_stage_path(stage_path,cluster)
164
168
  stdout = if source.handler == 'hdfs'
165
169
  Hdfs.copy(source.url,target.url,user_name)
166
170
  elsif ["gsheet","gfile","ssh"].include?(source.handler)
167
- in_string = source.read(user_name)
171
+ in_string = source.read(user_name,gdrive_slot)
168
172
  Dataset.write_by_url(target.url, in_string, user_name)
169
173
  end
170
174
  return {'out_str'=>stdout, 'signal' => 0}
@@ -1,5 +1,5 @@
1
1
  module Mobilize
2
2
  module Hdfs
3
- VERSION = "1.2"
3
+ VERSION = "1.3"
4
4
  end
5
5
  end
@@ -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-ssh","1.2"
19
+ gem.add_runtime_dependency "mobilize-ssh","1.3"
20
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobilize-hdfs
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: '1.3'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-21 00:00:00.000000000 Z
12
+ date: 2013-04-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mobilize-ssh
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: '1.2'
21
+ version: '1.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: '1.2'
29
+ version: '1.3'
30
30
  description: Adds hdfs read, write, and copy support to mobilize-ssh
31
31
  email:
32
32
  - cpaesleme@dena.com
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubyforge_project:
73
- rubygems_version: 1.8.24
73
+ rubygems_version: 1.8.25
74
74
  signing_key:
75
75
  specification_version: 3
76
76
  summary: Adds hdfs read, write, and copy support to mobilize-ssh
@@ -79,4 +79,3 @@ test_files:
79
79
  - test/mobilize-hdfs_test.rb
80
80
  - test/redis-test.conf
81
81
  - test/test_helper.rb
82
- has_rdoc: