sge 0.0.3 → 0.0.4
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/Guardfile +1 -1
- data/lib/sge/job_helpers.rb +14 -4
- data/lib/sge/qstat/job.rb +2 -2
- data/lib/sge/version.rb +1 -1
- data/spec/qstat/job_spec.rb +1 -1
- metadata +11 -11
data/Guardfile
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
guard 'rspec', :version => 2 do
|
5
5
|
watch(%r{^spec/.+_spec\.rb$})
|
6
|
-
watch(%r{^lib/sge/(.+)\.rb$}) { |m|
|
6
|
+
watch(%r{^lib/sge/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
7
7
|
watch('spec/spec_helper.rb') { "spec" }
|
8
8
|
|
9
9
|
watch(%r{^spec/support/(.+)\.rb$}){ "spec" }
|
data/lib/sge/job_helpers.rb
CHANGED
@@ -5,36 +5,46 @@ module SGE
|
|
5
5
|
base.extend ClassMethods
|
6
6
|
base.class_eval do
|
7
7
|
@attributes = []
|
8
|
+
@special_attributes = {}
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
11
12
|
module ClassMethods
|
12
13
|
|
13
14
|
def define_attributes(opts)
|
14
|
-
@attributes ||= []
|
15
15
|
opts.each do |k,v|
|
16
16
|
@attributes.push(k)
|
17
17
|
attr_accessor(v)
|
18
|
-
alias_method k, v
|
18
|
+
alias_method k, v
|
19
19
|
alias_method "#{k}=", "#{v}="
|
20
20
|
end
|
21
21
|
# If attributes changed reload attributes_path
|
22
22
|
@attributes_path = nil
|
23
23
|
@attributes
|
24
24
|
end
|
25
|
+
|
26
|
+
def special_attribute(a, path)
|
27
|
+
attr_accessor a
|
28
|
+
@special_attributes[a] = path
|
29
|
+
end
|
25
30
|
|
26
31
|
def attributes_path
|
27
32
|
@attributes_path ||= @attributes.join('|')
|
28
33
|
end
|
34
|
+
|
29
35
|
|
30
36
|
def from_document(doc)
|
31
37
|
instance = new
|
32
|
-
doc.xpath('.//' + self
|
38
|
+
doc.xpath('.//' + self.attributes_path ).each do |node|
|
33
39
|
instance.send("#{node.name}=", node.text)
|
34
40
|
end
|
41
|
+
@special_attributes.each do |k,v|
|
42
|
+
doc.xpath('.//' + v.to_s)
|
43
|
+
instance.send("#{k}=", doc.xpath('.//' + v.to_s).map{ |n| n.text})
|
44
|
+
end
|
35
45
|
instance
|
36
46
|
end
|
37
47
|
end
|
38
48
|
|
39
49
|
end
|
40
|
-
end
|
50
|
+
end
|
data/lib/sge/qstat/job.rb
CHANGED
@@ -8,9 +8,9 @@ module SGE
|
|
8
8
|
:JB_owner => :owner,
|
9
9
|
:JAT_start_time => :start_time,
|
10
10
|
:queue_name => :queue_name,
|
11
|
-
:JB_submission_time => :submission_time
|
12
|
-
:state => :state
|
11
|
+
:JB_submission_time => :submission_time
|
13
12
|
)
|
13
|
+
special_attribute :state, "@state|state"
|
14
14
|
|
15
15
|
def self.load_documents(opts,&block)
|
16
16
|
documents = []
|
data/lib/sge/version.rb
CHANGED
data/spec/qstat/job_spec.rb
CHANGED
@@ -31,7 +31,7 @@ describe SGE::QStat::Job do
|
|
31
31
|
lambda{ @job = SGE::QStat::Job.from_document(doc) }.should_not raise_error
|
32
32
|
@job.job_number.should == '2337'
|
33
33
|
@job.name.should == 's20100220_11;init_jour'
|
34
|
-
@job.state.should == 'r'
|
34
|
+
@job.state.should == ['r','running']
|
35
35
|
@job.owner.should == 'prodsoft'
|
36
36
|
@job.start_time.should == '2010-02-24T21:55:13'
|
37
37
|
@job.queue_name.should == 'calcul-x@wousdat-dev.in.weborama.fr'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
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: 2012-01-
|
12
|
+
date: 2012-01-31 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &70233676098620 !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: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70233676098620
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70233676097260 !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: *70233676097260
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70233676095100 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70233676095100
|
47
47
|
description: Sun Grid Engine ruby library
|
48
48
|
email:
|
49
49
|
- hery@rails-royce.org
|
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash:
|
102
|
+
hash: -1457147814193271419
|
103
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
104
|
none: false
|
105
105
|
requirements:
|
@@ -108,10 +108,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
segments:
|
110
110
|
- 0
|
111
|
-
hash:
|
111
|
+
hash: -1457147814193271419
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project: sge
|
114
|
-
rubygems_version: 1.8.
|
114
|
+
rubygems_version: 1.8.10
|
115
115
|
signing_key:
|
116
116
|
specification_version: 3
|
117
117
|
summary: Sun Grid Engine ruby library
|