hadoop-jruby-connector 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/hjc/job_monitor.rb +5 -2
- data/spec/hjc/job_monitor_spec.rb +18 -3
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/lib/hjc/job_monitor.rb
CHANGED
@@ -17,8 +17,11 @@ module Hjc
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def job_status(job_id_str)
|
20
|
-
|
21
|
-
|
20
|
+
@jt.get_job_status(JobID.for_name(job_id_str))
|
21
|
+
end
|
22
|
+
|
23
|
+
def kill_job(job_id_str)
|
24
|
+
@jt.kill_job(JobID.for_name(job_id_str))
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
@@ -3,13 +3,14 @@ require 'hjc'
|
|
3
3
|
module Hjc
|
4
4
|
describe JobMonitor do
|
5
5
|
|
6
|
-
before :
|
6
|
+
before :each do
|
7
7
|
@example_jar = Dir.glob(File.join(Util.hadoop_home, 'hadoop-*-examples.jar')).first
|
8
8
|
s = Hjc::FsShell.new
|
9
9
|
s.rmr('PiEstimator_TMP_3_141592654')
|
10
10
|
end
|
11
11
|
|
12
|
-
it '
|
12
|
+
it 'monitors hadoop job' do
|
13
|
+
pending
|
13
14
|
run_job_async
|
14
15
|
sleep 5
|
15
16
|
monitor = JobMonitor.new
|
@@ -22,6 +23,20 @@ module Hjc
|
|
22
23
|
|
23
24
|
monitor.job_status(job_id_str).class.should == JobStatus
|
24
25
|
end
|
26
|
+
|
27
|
+
it 'kills job' do
|
28
|
+
run_job_async
|
29
|
+
sleep 5
|
30
|
+
monitor = JobMonitor.new
|
31
|
+
job = monitor.running_jobs.first
|
32
|
+
job.should_not be_nil
|
33
|
+
|
34
|
+
job_id_str = job.job_id.to_s
|
35
|
+
monitor.kill_job(job_id_str)
|
36
|
+
|
37
|
+
sleep 60
|
38
|
+
monitor.running_jobs.size.should == 0
|
39
|
+
end
|
25
40
|
|
26
41
|
def run_job_async
|
27
42
|
begin
|
@@ -33,7 +48,7 @@ module Hjc
|
|
33
48
|
job.run
|
34
49
|
end
|
35
50
|
rescue => e
|
36
|
-
|
51
|
+
p e
|
37
52
|
end
|
38
53
|
end
|
39
54
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Koichi Fujikawa
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-05-02 00:00:00 +09:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|