Class: KatteHiveAutodep::HDP
- Inherits:
-
Object
- Object
- KatteHiveAutodep::HDP
- Defined in:
- lib/katte_hive_autodep/hdp.rb
Constant Summary collapse
- EXT_LIB_ROOT =
wrapper class for hive-dependency-parser
File.("../../ext/", __FILE__)
- ENV_SCRIPT =
File.join(EXT_LIB_ROOT, (ENV["KATTE_MODE"] == 'test' ? "env-debug.sh" : "env.sh"))
- HDP_JAR =
File.join(EXT_LIB_ROOT, "hive-dependency-parser.jar")
- HDP_MAIN_CLASS =
"org.mixi.analysis.hive.dependency.parser.Driver"
Instance Method Summary collapse
-
#initialize ⇒ HDP
constructor
A new instance of HDP.
- #run(file) ⇒ Object
Constructor Details
#initialize ⇒ HDP
Returns a new instance of HDP.
12 13 |
# File 'lib/katte_hive_autodep/hdp.rb', line 12 def initialize end |
Instance Method Details
#run(file) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/katte_hive_autodep/hdp.rb', line 15 def run(file) return unless File.file? file dependency = IO.pipe do |o_r,o_w| ret = system(<<EOF, :out => o_w, :err => "/dev/null") source #{ENV_SCRIPT} CLASSPATH=$CLASSPATH:#{HDP_JAR} java -Xmx256m #{HDP_MAIN_CLASS} #{file} EOF return unless ret o_w.close o_r.to_a.join end JSON.parse(dependency) end |