Class: Hadupils::Extensions::FlatArchivePath

Inherits:
Flat
  • Object
show all
Defined in:
lib/hadupils/extensions.rb

Instance Attribute Summary

Attributes inherited from Base

#assets, #path

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Flat

#assemble_hiverc, #hivercs

Methods inherited from Base

gather_assets, #hadoop_confs, #hivercs, #initialize, #merge_assets

Constructor Details

This class inherits a constructor from Hadupils::Extensions::Base

Class Method Details

.assemble_path_env(archives) ⇒ Object



321
322
323
324
# File 'lib/hadupils/extensions.rb', line 321

def self.assemble_path_env(archives)
  paths = archives.collect {|a| "$(pwd)/#{ a.name }/bin" }
  "SET mapred.child.env = PATH=#{ paths.join(':') }:$PATH;"
end

Instance Method Details

#archives_for_path_envObject



298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/hadupils/extensions.rb', line 298

def archives_for_path_env
  @assets.find_all do |a|
    if a.kind_of? Hadupils::Assets::Archive
      begin
        Hadupils::Util.archive_has_directory?(a.path, 'bin')
      rescue
        false
      end
    else
      false
    end
  end
end

#default_hiverc_itemsObject



312
313
314
315
316
317
318
319
# File 'lib/hadupils/extensions.rb', line 312

def default_hiverc_items
  items = super
  archs = archives_for_path_env
  if archs.length > 0
    items << self.class.assemble_path_env(archs)
  end
  items
end