sge 0.0.1
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/.gitignore +6 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/Rakefile +5 -0
- data/lib/sge.rb +6 -0
- data/lib/sge/command_runner.rb +43 -0
- data/lib/sge/job.rb +18 -0
- data/lib/sge/job_helpers.rb +40 -0
- data/lib/sge/qstat/job.rb +16 -0
- data/lib/sge/qstat/parser.rb +39 -0
- data/lib/sge/summary.rb +3 -0
- data/lib/sge/version.rb +3 -0
- data/sge.gemspec +32 -0
- data/spec/command_runner_spec.rb +69 -0
- data/spec/data/detailed_jobs.sge +5615 -0
- data/spec/data/jobs.sge +68 -0
- data/spec/job_spec.rb +53 -0
- data/spec/qstat_job_spec.rb +39 -0
- data/spec/qstat_parser_spec.rb +38 -0
- data/spec/spec_helper.rb +15 -0
- metadata +111 -0
data/spec/data/jobs.sge
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
<?xml version='1.0'?>
|
2
|
+
<job_info xmlns:xsd="http://gridengine.sunsource.net/source/browse/*checkout*/gridengine/source/dist/util/resources/schemas/qstat/qstat.xsd?revision=1.11">
|
3
|
+
<queue_info>
|
4
|
+
<job_list state="running">
|
5
|
+
<JB_job_number>2337</JB_job_number>
|
6
|
+
<JAT_prio>0.55451</JAT_prio>
|
7
|
+
<JB_name>s20100220_11;init_jour</JB_name>
|
8
|
+
<JB_owner>prodsoft</JB_owner>
|
9
|
+
<state>r</state>
|
10
|
+
<JAT_start_time>2010-02-24T21:55:13</JAT_start_time>
|
11
|
+
<queue_name>calcul-x@wousdat-dev.in.weborama.fr</queue_name>
|
12
|
+
<slots>1</slots>
|
13
|
+
</job_list>
|
14
|
+
</queue_info>
|
15
|
+
<job_info>
|
16
|
+
<job_list state="pending">
|
17
|
+
<JB_job_number>1984</JB_job_number>
|
18
|
+
<JAT_prio>0.55451</JAT_prio>
|
19
|
+
<JB_name>s20100216_23;recuperation_data_wreport;261612</JB_name>
|
20
|
+
<JB_owner>prodsoft</JB_owner>
|
21
|
+
<state>Eqw</state>
|
22
|
+
<JB_submission_time>2010-02-17T17:31:14</JB_submission_time>
|
23
|
+
<queue_name></queue_name>
|
24
|
+
<slots>1</slots>
|
25
|
+
</job_list>
|
26
|
+
<job_list state="pending">
|
27
|
+
<JB_job_number>1985</JB_job_number>
|
28
|
+
<JAT_prio>0.00000</JAT_prio>
|
29
|
+
<JB_name>s20100216_23;histo</JB_name>
|
30
|
+
<JB_owner>prodsoft</JB_owner>
|
31
|
+
<state>hqw</state>
|
32
|
+
<JB_submission_time>2010-02-17T17:31:14</JB_submission_time>
|
33
|
+
<queue_name></queue_name>
|
34
|
+
<slots>1</slots>
|
35
|
+
</job_list>
|
36
|
+
<job_list state="pending">
|
37
|
+
<JB_job_number>1986</JB_job_number>
|
38
|
+
<JAT_prio>0.00000</JAT_prio>
|
39
|
+
<JB_name>s20100216_23;agregation_nuages_urls</JB_name>
|
40
|
+
<JB_owner>prodsoft</JB_owner>
|
41
|
+
<state>hqw</state>
|
42
|
+
<JB_submission_time>2010-02-17T17:31:14</JB_submission_time>
|
43
|
+
<queue_name></queue_name>
|
44
|
+
<slots>1</slots>
|
45
|
+
</job_list>
|
46
|
+
<job_list state="pending">
|
47
|
+
<JB_job_number>1987</JB_job_number>
|
48
|
+
<JAT_prio>0.00000</JAT_prio>
|
49
|
+
<JB_name>s20100216_23;mots_corpus_ponderations</JB_name>
|
50
|
+
<JB_owner>prodsoft</JB_owner>
|
51
|
+
<state>hqw</state>
|
52
|
+
<JB_submission_time>2010-02-17T17:31:14</JB_submission_time>
|
53
|
+
<queue_name></queue_name>
|
54
|
+
<slots>1</slots>
|
55
|
+
</job_list>
|
56
|
+
<job_list state="pending">
|
57
|
+
<JB_job_number>1989</JB_job_number>
|
58
|
+
<JAT_prio>0.00000</JAT_prio>
|
59
|
+
<JB_name>s20100216_23;site_domaine_clusters</JB_name>
|
60
|
+
<JB_owner>prodsoft</JB_owner>
|
61
|
+
<state>hqw</state>
|
62
|
+
<JB_submission_time>2010-02-17T17:31:14</JB_submission_time>
|
63
|
+
<queue_name></queue_name>
|
64
|
+
<slots>1</slots>
|
65
|
+
</job_list>
|
66
|
+
</job_info>
|
67
|
+
</job_info>
|
68
|
+
|
data/spec/job_spec.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SGE::Job do
|
4
|
+
it "should respond_to define_attributes" do
|
5
|
+
SGE::Job.should respond_to(:define_attributes)
|
6
|
+
end
|
7
|
+
|
8
|
+
it { should respond_to(:job_number) }
|
9
|
+
it { should respond_to(:priority) }
|
10
|
+
it { should respond_to(:name) }
|
11
|
+
it { should respond_to(:queue_name) }
|
12
|
+
it { should respond_to(:start_time) }
|
13
|
+
it { should respond_to(:slots) }
|
14
|
+
it { should respond_to(:state) }
|
15
|
+
it { should respond_to(:owner) }
|
16
|
+
|
17
|
+
it { should respond_to(:job_number=) }
|
18
|
+
it { should respond_to(:priority=) }
|
19
|
+
it { should respond_to(:name=) }
|
20
|
+
it { should respond_to(:queue_name=) }
|
21
|
+
it { should respond_to(:start_time=) }
|
22
|
+
it { should respond_to(:slots=) }
|
23
|
+
it { should respond_to(:state=) }
|
24
|
+
it { should respond_to(:owner=) }
|
25
|
+
|
26
|
+
it "should retrieve data from XML document" do
|
27
|
+
string = %Q{
|
28
|
+
<job_list state="running">
|
29
|
+
<JB_job_number>2337</JB_job_number>
|
30
|
+
<JAT_prio>0.55451</JAT_prio>
|
31
|
+
<JB_name>s20100220_11;init_jour</JB_name>
|
32
|
+
<JB_owner>prodsoft</JB_owner>
|
33
|
+
<state>r</state>
|
34
|
+
<JAT_start_time>2010-02-24T21:55:13</JAT_start_time>
|
35
|
+
<queue_name>calcul-x@wousdat-dev.in.weborama.fr</queue_name>
|
36
|
+
<slots>1</slots>
|
37
|
+
</job_list>
|
38
|
+
}
|
39
|
+
doc = Nokogiri::XML::Document.new.parse(string)
|
40
|
+
lambda{ @job = SGE::Job.from_document(doc) }.should_not raise_error
|
41
|
+
@job.job_number.should == '2337'
|
42
|
+
@job.priority.should == '0.55451'
|
43
|
+
@job.name.should == 's20100220_11;init_jour'
|
44
|
+
@job.owner.should == 'prodsoft'
|
45
|
+
@job.state.should == 'r'
|
46
|
+
@job.start_time.should == '2010-02-24T21:55:13'
|
47
|
+
@job.queue_name.should == 'calcul-x@wousdat-dev.in.weborama.fr'
|
48
|
+
@job.slots.should == '1'
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SGE::QStat::Job do
|
4
|
+
|
5
|
+
it "should respond_to define_attributes" do
|
6
|
+
SGE::Job.should respond_to(:define_attributes)
|
7
|
+
end
|
8
|
+
|
9
|
+
it { should respond_to(:job_number)}
|
10
|
+
it { should respond_to(:owner)}
|
11
|
+
it { should respond_to(:start_time)}
|
12
|
+
it { should respond_to(:queue_name)}
|
13
|
+
it { should respond_to(:submission_time)}
|
14
|
+
it { should respond_to(:name) }
|
15
|
+
|
16
|
+
|
17
|
+
it "should retrie vadata from XML document" do
|
18
|
+
string = %Q{
|
19
|
+
<job_list state="running">
|
20
|
+
<JB_job_number>2337</JB_job_number>
|
21
|
+
<JAT_prio>0.55451</JAT_prio>
|
22
|
+
<JB_name>s20100220_11;init_jour</JB_name>
|
23
|
+
<JB_owner>prodsoft</JB_owner>
|
24
|
+
<state>r</state>
|
25
|
+
<JAT_start_time>2010-02-24T21:55:13</JAT_start_time>
|
26
|
+
<queue_name>calcul-x@wousdat-dev.in.weborama.fr</queue_name>
|
27
|
+
<slots>1</slots>
|
28
|
+
</job_list>
|
29
|
+
}
|
30
|
+
doc = Nokogiri::XML::Document.new.parse(string)
|
31
|
+
lambda{ @job = SGE::QStat::Job.from_document(doc) }.should_not raise_error
|
32
|
+
@job.job_number.should == '2337'
|
33
|
+
@job.name.should == 's20100220_11;init_jour'
|
34
|
+
@job.state.should == 'r'
|
35
|
+
@job.owner.should == 'prodsoft'
|
36
|
+
@job.start_time.should == '2010-02-24T21:55:13'
|
37
|
+
@job.queue_name.should == 'calcul-x@wousdat-dev.in.weborama.fr'
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SGE::QStat::Parser do
|
4
|
+
JOBS_FILE = 'spec/data/jobs.sge'
|
5
|
+
|
6
|
+
it "should inherit from Nokogiri::XML::Document" do
|
7
|
+
SGE::QStat::Parser.should < Nokogiri::XML::Document
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "parsing from qstat -xml" do
|
11
|
+
subject { SGE::QStat::Parser.new }
|
12
|
+
|
13
|
+
let(:jobs_stream){ File.read(JOBS_FILE) }
|
14
|
+
|
15
|
+
it "should parse jobs.sge" do
|
16
|
+
lambda{ subject.parse(jobs_stream)}.should_not raise_error
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "retrieving jobs" do
|
20
|
+
|
21
|
+
subject{ SGE::QStat::Parser.parse(jobs_stream) }
|
22
|
+
|
23
|
+
it "should parse all jobs" do
|
24
|
+
subject.jobs.size.should == 6
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should parse pending jobs" do
|
28
|
+
subject.pending_jobs.size.should == 5
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should parse running jobs" do
|
32
|
+
subject.running_jobs.size.should == 1
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper.rb"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
$LOAD_PATH.unshift('lib')
|
8
|
+
|
9
|
+
require 'sge'
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.mock_with :rspec
|
12
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
|
+
config.run_all_when_everything_filtered = true
|
14
|
+
config.filter_run :focus
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sge
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Hallelujah
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-23 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nokogiri
|
16
|
+
requirement: &11512840 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *11512840
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &11511820 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *11511820
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
requirement: &11510620 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *11510620
|
47
|
+
description: Sun Grid Engine ruby library
|
48
|
+
email:
|
49
|
+
- hery@rails-royce.org
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- .rspec
|
56
|
+
- Gemfile
|
57
|
+
- Rakefile
|
58
|
+
- lib/sge.rb
|
59
|
+
- lib/sge/command_runner.rb
|
60
|
+
- lib/sge/job.rb
|
61
|
+
- lib/sge/job_helpers.rb
|
62
|
+
- lib/sge/qstat/job.rb
|
63
|
+
- lib/sge/qstat/parser.rb
|
64
|
+
- lib/sge/summary.rb
|
65
|
+
- lib/sge/version.rb
|
66
|
+
- sge.gemspec
|
67
|
+
- spec/command_runner_spec.rb
|
68
|
+
- spec/data/detailed_jobs.sge
|
69
|
+
- spec/data/jobs.sge
|
70
|
+
- spec/job_spec.rb
|
71
|
+
- spec/qstat_job_spec.rb
|
72
|
+
- spec/qstat_parser_spec.rb
|
73
|
+
- spec/spec_helper.rb
|
74
|
+
homepage: ''
|
75
|
+
licenses: []
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
hash: -2725906077928441340
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
segments:
|
96
|
+
- 0
|
97
|
+
hash: -2725906077928441340
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project: sge
|
100
|
+
rubygems_version: 1.8.15
|
101
|
+
signing_key:
|
102
|
+
specification_version: 3
|
103
|
+
summary: Sun Grid Engine ruby library
|
104
|
+
test_files:
|
105
|
+
- spec/command_runner_spec.rb
|
106
|
+
- spec/data/detailed_jobs.sge
|
107
|
+
- spec/data/jobs.sge
|
108
|
+
- spec/job_spec.rb
|
109
|
+
- spec/qstat_job_spec.rb
|
110
|
+
- spec/qstat_parser_spec.rb
|
111
|
+
- spec/spec_helper.rb
|