rjobs 0.2.0.alpha → 0.3.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rjharvest +10 -6
- data/bin/rjstatus +29 -6
- data/bin/rjsubmit +8 -7
- data/features/step_definitions/listJobs_steps.rb +1 -1
- data/lib/rjobs/cli_helper.rb +17 -0
- data/lib/rjobs/job.rb +0 -1
- data/lib/rjobs/job_handler.rb +20 -2
- data/lib/rjobs/version.rb +1 -1
- data/spec/lib/job_handler_spec.rb +2 -0
- metadata +20 -20
data/bin/rjharvest
CHANGED
@@ -9,23 +9,27 @@ require "rjobs/job_handler"
|
|
9
9
|
require 'rjobs/cli_helper'
|
10
10
|
include Rjobs::CliHelper
|
11
11
|
|
12
|
-
|
13
|
-
banner <<-EOS
|
12
|
+
banner = "================
|
14
13
|
Harvest all finished jobs described in the jobs file.
|
15
|
-
|
14
|
+
================
|
16
15
|
Usage:
|
17
16
|
rjharvest [options] <filename>
|
18
17
|
where [options] are:
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
"
|
19
|
+
|
20
|
+
p = parser(banner)
|
22
21
|
|
23
22
|
opts = Trollop::with_standard_exception_handling p do
|
24
23
|
o = p.parse ARGV
|
25
24
|
raise Trollop::HelpNeeded if ARGV.empty? # show help screen
|
25
|
+
o
|
26
26
|
end
|
27
27
|
|
28
|
+
Rjobs::JobHandler.host = opts[:host]
|
29
|
+
Rjobs::JobHandler.password = opts[:password]
|
30
|
+
|
28
31
|
jobs_file = ARGV[0]
|
32
|
+
raise "The file \"#{jobs_file}\" must exist." unless File.exist?(jobs_file)
|
29
33
|
|
30
34
|
jobs = get_jobs_info(jobs_file)
|
31
35
|
jobs.each do |job|
|
data/bin/rjstatus
CHANGED
@@ -9,16 +9,15 @@ require "rjobs/job_handler"
|
|
9
9
|
require 'rjobs/cli_helper'
|
10
10
|
include Rjobs::CliHelper
|
11
11
|
|
12
|
-
|
13
|
-
banner <<-EOS
|
12
|
+
banner = "================
|
14
13
|
Get the status of jobs described in the jobs file.
|
15
|
-
|
14
|
+
================
|
16
15
|
Usage:
|
17
16
|
rjstatus [options] <filename>
|
18
17
|
where [options] are:
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
"
|
19
|
+
|
20
|
+
p = parser(banner)
|
22
21
|
|
23
22
|
opts = Trollop::with_standard_exception_handling p do
|
24
23
|
o = p.parse ARGV
|
@@ -26,10 +25,34 @@ opts = Trollop::with_standard_exception_handling p do
|
|
26
25
|
end
|
27
26
|
|
28
27
|
jobs_file = ARGV[0]
|
28
|
+
raise "The file \"#{jobs_file}\" must exist." unless File.exist?(jobs_file)
|
29
29
|
|
30
30
|
jobs = get_jobs_info(jobs_file)
|
31
31
|
|
32
|
+
jFinished = 0
|
33
|
+
jPending = 0
|
34
|
+
jFailed = 0
|
35
|
+
jNE =0
|
36
|
+
|
32
37
|
jobs.each do |job|
|
33
38
|
puts "#{job.name} - #{job.status_with_color}"
|
39
|
+
case job.status
|
40
|
+
when /Finished/
|
41
|
+
jFinished +=1
|
42
|
+
when /Failed/
|
43
|
+
jFailed +=1
|
44
|
+
when /Not Exist/
|
45
|
+
jNE+=1
|
46
|
+
else
|
47
|
+
jPending +=1
|
48
|
+
end
|
49
|
+
|
34
50
|
end
|
35
51
|
|
52
|
+
#output number of success jobs - pending jobs - failed jobs
|
53
|
+
sFinish = "#{jFinished} finished".green if jFinished > 0
|
54
|
+
sPending = "- #{jPending} pending" if jPending > 0
|
55
|
+
sFailed = "- #{jFailed} failed".red if jFailed > 0
|
56
|
+
sNE = "- #{jNE} not exist".red if jNE > 0
|
57
|
+
|
58
|
+
puts "#{jobs.count} jobs: #{sFinish} #{sPending} #{sFailed} #{sNE}."
|
data/bin/rjsubmit
CHANGED
@@ -10,16 +10,15 @@ require "rjobs/job_handler"
|
|
10
10
|
require 'rjobs/cli_helper'
|
11
11
|
include Rjobs::CliHelper
|
12
12
|
|
13
|
-
|
14
|
-
banner <<-EOS
|
13
|
+
banner = "================
|
15
14
|
Submit jobs described in the YAML input file.
|
16
|
-
|
15
|
+
================
|
17
16
|
Usage:
|
18
|
-
|
17
|
+
rjsubmit [options] <filename>
|
19
18
|
where [options] are:
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
"
|
20
|
+
|
21
|
+
p = parser(banner)
|
23
22
|
|
24
23
|
opts = Trollop::with_standard_exception_handling p do
|
25
24
|
o = p.parse ARGV
|
@@ -28,6 +27,8 @@ end
|
|
28
27
|
|
29
28
|
|
30
29
|
jobs_input_file = ARGV[0]
|
30
|
+
raise "The file \"#{jobs_input_file}\" must exist." unless File.exist?(jobs_input_file)
|
31
|
+
|
31
32
|
|
32
33
|
jif = Rjobs::JobInputFile.new(jobs_input_file)
|
33
34
|
jobs = []
|
data/lib/rjobs/cli_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "trollop"
|
2
|
+
|
1
3
|
module Rjobs
|
2
4
|
module CliHelper
|
3
5
|
def get_jobs_info(jobs_file)
|
@@ -10,5 +12,20 @@ module Rjobs
|
|
10
12
|
end
|
11
13
|
jobs
|
12
14
|
end
|
15
|
+
|
16
|
+
def parser(banner_string)
|
17
|
+
default_hostname = ENV['XGRID_CONTROLLER_HOSTNAME'].nil? ? "127.0.0.1" : ENV['XGRID_CONTROLLER_HOSTNAME']
|
18
|
+
default_password = ENV['XGRID_CONTROLLER_PASSWORD'].nil? ? "xgrid" : ENV['XGRID_CONTROLLER_PASSWORD']
|
19
|
+
Trollop::Parser.new do
|
20
|
+
banner banner_string
|
21
|
+
opt :host, "Hostname or IP address of the xgrid controller",
|
22
|
+
:type=> String,
|
23
|
+
:default=> default_hostname
|
24
|
+
opt :password, "Password to access the xgrid controller",
|
25
|
+
:type=> String,
|
26
|
+
:default=> default_password
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
13
30
|
end
|
14
31
|
end
|
data/lib/rjobs/job.rb
CHANGED
data/lib/rjobs/job_handler.rb
CHANGED
@@ -9,8 +9,8 @@ module Rjobs
|
|
9
9
|
|
10
10
|
def self.get_job_attributes(id)
|
11
11
|
cb = Rjobs::CommandBuilder.new("xgrid", {
|
12
|
-
:h =>
|
13
|
-
:p =>
|
12
|
+
:h => host,
|
13
|
+
:p => password,
|
14
14
|
:f => "xml",
|
15
15
|
:job => :attributes,
|
16
16
|
:id => id
|
@@ -54,5 +54,23 @@ module Rjobs
|
|
54
54
|
Rjobs::Process.run(cb.build)
|
55
55
|
end
|
56
56
|
|
57
|
+
def self.host
|
58
|
+
@@host
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.host=(value)
|
62
|
+
@@host = value
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.password
|
66
|
+
@@password
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.password=(value)
|
70
|
+
@@password = value
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
|
57
75
|
end
|
58
76
|
end
|
data/lib/rjobs/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rjobs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0.alpha
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-30 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70100005401960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70100005401960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: cucumber
|
27
|
-
requirement: &
|
27
|
+
requirement: &70100005401340 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70100005401340
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: aruba
|
38
|
-
requirement: &
|
38
|
+
requirement: &70100005400720 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70100005400720
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: guard
|
49
|
-
requirement: &
|
49
|
+
requirement: &70100005400120 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70100005400120
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: growl_notify
|
60
|
-
requirement: &
|
60
|
+
requirement: &70100005399420 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70100005399420
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard-rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &70100005398920 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70100005398920
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: plist
|
82
|
-
requirement: &
|
82
|
+
requirement: &70100005398500 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70100005398500
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: colorize
|
93
|
-
requirement: &
|
93
|
+
requirement: &70100005398080 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70100005398080
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: trollop
|
104
|
-
requirement: &
|
104
|
+
requirement: &70100005397640 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70100005397640
|
113
113
|
description: Gem to handle Jobs for XGrid
|
114
114
|
email:
|
115
115
|
- merlinvn@gmail.com
|