Class: SparkToolkit::YARN::LogAccessor

Inherits:
Object
  • Object
show all
Defined in:
lib/spark_toolkit/hadoop/yarn/log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hconf) ⇒ LogAccessor

Returns a new instance of LogAccessor.



10
11
12
13
14
15
16
# File 'lib/spark_toolkit/hadoop/yarn/log.rb', line 10

def initialize(hconf)
  @hconf = hconf
  log_root = hconf.get('yarn.nodemanager.remote-app-log-dir')
  username = UserGroupInformation.get_current_user.get_short_user_name
  @log_dir = File.join(log_root, username, 'logs')
  @max_log_len = 1024 * 1024 # 1M log
end

Instance Attribute Details

#hconfObject (readonly)

Returns the value of attribute hconf.



9
10
11
# File 'lib/spark_toolkit/hadoop/yarn/log.rb', line 9

def hconf
  @hconf
end

Instance Method Details

#get_logs(appid, dev) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/spark_toolkit/hadoop/yarn/log.rb', line 18

def get_logs(appid, dev)
  case dev
  when :stdout
    get_logs_core(appid, ["stdout"])
  when :stderr
    get_logs_core(appid, ["stderr"])
  when :all
    get_logs_core(appid, ["stdout", "stderr"])
  end
end