Class: Hjc::JobMonitor
- Inherits:
-
Object
- Object
- Hjc::JobMonitor
- Defined in:
- lib/hjc/job_monitor.rb
Instance Attribute Summary collapse
-
#jt ⇒ Object
readonly
mainly for debug..
Instance Method Summary collapse
-
#initialize ⇒ JobMonitor
constructor
A new instance of JobMonitor.
- #job_status(job_id_str) ⇒ Object
- #kill_job(job_id_str) ⇒ Object
- #running_jobs ⇒ Object
Constructor Details
#initialize ⇒ JobMonitor
Returns a new instance of JobMonitor.
5 6 7 8 9 10 11 |
# File 'lib/hjc/job_monitor.rb', line 5 def initialize conf = Configuration.new address, port = *conf.get("mapred.job.tracker").split(":") addr = InetSocketAddress.new(address, port.to_i) @jt = RPC.get_proxy(JobSubmissionProtocol.java_class, JobSubmissionProtocol.versionID, addr, conf) end |
Instance Attribute Details
#jt ⇒ Object (readonly)
mainly for debug..
3 4 5 |
# File 'lib/hjc/job_monitor.rb', line 3 def jt @jt end |
Instance Method Details
#job_status(job_id_str) ⇒ Object
19 20 21 |
# File 'lib/hjc/job_monitor.rb', line 19 def job_status(job_id_str) @jt.get_job_status(JobID.for_name(job_id_str)) end |
#kill_job(job_id_str) ⇒ Object
23 24 25 |
# File 'lib/hjc/job_monitor.rb', line 23 def kill_job(job_id_str) @jt.kill_job(JobID.for_name(job_id_str)) end |
#running_jobs ⇒ Object
13 14 15 16 17 |
# File 'lib/hjc/job_monitor.rb', line 13 def running_jobs @jt.all_jobs.select do |j| [JobStatus::RUNNING, JobStatus::PREP].include? j.run_state end end |