Class: DakeScheme::HDFS
Constant Summary collapse
- PATTERN =
['hdfs:', 'afs:']
Instance Attribute Summary
Attributes inherited from Scheme
Instance Method Summary collapse
- #exist? ⇒ Boolean
-
#initialize(scheme_part, path_part, step) ⇒ HDFS
constructor
A new instance of HDFS.
- #mtime ⇒ Object
Methods inherited from Scheme
Constructor Details
#initialize(scheme_part, path_part, step) ⇒ HDFS
Returns a new instance of HDFS.
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/dake/scheme.rb', line 58 def initialize(scheme_part, path_part, step) @src = scheme_part + path_part @path = scheme_part + path_part @step = step if @step.context['HADOOP_HOME'] @hadoop_bin = "#{@step.context['HADOOP_HOME']}/hadoop/bin/hadoop" elsif ENV['HADOOP_HOME'] @hadoop_bin = "#{ENV['HADOOP_HOME']}/hadoop/bin/hadoop" else raise "HADOOP_HOME not set." if not hadoop_home or hadoop_home.empty? end raise "#{@hadoop_bin} not found." unless File.exist? @hadoop_bin end |
Instance Method Details
#exist? ⇒ Boolean
76 77 78 |
# File 'lib/dake/scheme.rb', line 76 def exist? system("#{@hadoop_bin} fs -test -e #{@path}") end |
#mtime ⇒ Object
72 73 74 |
# File 'lib/dake/scheme.rb', line 72 def mtime Time.at(`#{@hadoop_bin} fs -stat %Y #{@path}`.chomp.to_i / 1000) end |