mobilize-ssh 1.25 → 1.26

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: b1f2dbd00b4dfaff4e8d7f0739eab57f1a42ccac
4
- data.tar.gz: a5c9fc8990b99ac4f8b594f26d135d126f9055eb
3
+ metadata.gz: 3f432114cc102b1402819a0d6641ca707d59c53c
4
+ data.tar.gz: 460bed02d0df8df2d0a45924dd3cd923c0faf80a
5
5
  SHA512:
6
- metadata.gz: e7f781258b0a3725eab4833236190b9c8684879026bba762daedfe0160966dfc42a1595c2db507876ecebd5997bc0b6929915fa3e7d2edeb96df1e10a72083e6
7
- data.tar.gz: d454d374a23fe9023d72fcd85803f54a231e731411b9052e19ed542bf0e0f5838d67fde742f15f8c35604a69203c042905b6a249aba4f50288ff25cde1f6133a
6
+ metadata.gz: 3666be3da31f2ce839cc8edefd9f2d76cd463211163530ba68fcab289219e09df63e18487c0f5a813e877cec7e38c016ad15f7484ad9d1aaa158c5fef6382ab0
7
+ data.tar.gz: 97374d509caf04c70bfe9ae003b3741856dd43dd1c6d356612ce9177279dd0f584d0a9f46027e2a05cd009225552ede5bc8fb0dcf6ceeffcab66b9b03f3b5000
@@ -58,7 +58,7 @@ module Mobilize
58
58
  end
59
59
 
60
60
  # converts a source path or target path to a dst in the context of handler and stage
61
- def Ssh.path_to_dst(path,stage_path)
61
+ def Ssh.path_to_dst(path,stage_path,gdrive_slot)
62
62
  has_handler = true if path.index("://")
63
63
  red_path = path.split("://").last
64
64
  #is user has a handler, their first path node is a node name,
@@ -69,7 +69,7 @@ module Mobilize
69
69
  return Dataset.find_or_create_by_url(ssh_url)
70
70
  end
71
71
  #otherwise, use Gsheet
72
- return Gsheet.path_to_dst(red_path,stage_path)
72
+ return Gsheet.path_to_dst(red_path,stage_path,gdrive_slot)
73
73
  end
74
74
 
75
75
  def Ssh.url_by_path(path,user_name)
@@ -218,12 +218,12 @@ module Mobilize
218
218
  return user_name
219
219
  end
220
220
 
221
- def Ssh.file_hash_by_stage_path(stage_path)
221
+ def Ssh.file_hash_by_stage_path(stage_path,gdrive_slot)
222
222
  file_hash = {}
223
223
  s = Stage.where(:path=>stage_path).first
224
224
  u = s.job.runner.user
225
225
  user_name = Ssh.user_name_by_stage_path(stage_path)
226
- s.sources.each do |sdst|
226
+ s.sources(gdrive_slot).each do |sdst|
227
227
  split_path = sdst.path.split("/")
228
228
  #if path is to stage output, name with stage name
229
229
  file_name = if split_path.last == "out" and
@@ -234,7 +234,8 @@ module Mobilize
234
234
  end
235
235
  if ["gsheet","gfile"].include?(sdst.handler)
236
236
  #google drive sources are always read as the user
237
- file_hash[file_name] = sdst.read(u.name)
237
+ #with the apportioned slot
238
+ file_hash[file_name] = sdst.read(u.name,gdrive_slot)
238
239
  else
239
240
  #other sources should be read by su-user
240
241
  file_hash[file_name] = sdst.read(user_name)
@@ -244,12 +245,16 @@ module Mobilize
244
245
  end
245
246
 
246
247
  def Ssh.run_by_stage_path(stage_path)
248
+ gdrive_slot = Gdrive.slot_worker_by_path(stage_path)
249
+ #return blank response if there are no slots available
250
+ return nil unless gdrive_slot
247
251
  s = Stage.where(:path=>stage_path).first
248
252
  params = s.params
249
253
  node, command = [params['node'],params['cmd']]
250
254
  node ||= Ssh.default_node
251
255
  user_name = Ssh.user_name_by_stage_path(stage_path)
252
- file_hash = Ssh.file_hash_by_stage_path(stage_path)
256
+ file_hash = Ssh.file_hash_by_stage_path(stage_path,gdrive_slot)
257
+ Gdrive.unslot_worker_by_path(stage_path)
253
258
  result = Ssh.run(node,command,user_name,file_hash)
254
259
  #use Gridfs to cache result
255
260
  response = {}
@@ -1,5 +1,5 @@
1
1
  module Mobilize
2
2
  module Ssh
3
- VERSION = "1.25"
3
+ VERSION = "1.26"
4
4
  end
5
5
  end
data/mobilize-ssh.gemspec CHANGED
@@ -16,7 +16,7 @@ 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-base","1.25"
19
+ gem.add_runtime_dependency "mobilize-base","1.26"
20
20
  gem.add_runtime_dependency "net-ssh"
21
21
  gem.add_runtime_dependency "net-scp"
22
22
  gem.add_runtime_dependency "net-ssh-gateway"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobilize-ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.25'
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-24 00:00:00.000000000 Z
11
+ date: 2013-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mobilize-base
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '1.25'
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.25'
26
+ version: '1.26'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: net-ssh
29
29
  requirement: !ruby/object:Gem::Requirement