bookie_accounting 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Rakefile +0 -7
- data/TODO +13 -0
- data/bookie_accounting.gemspec +1 -9
- data/lib/bookie/database.rb +17 -19
- data/lib/bookie/database/group.rb +3 -3
- data/lib/bookie/database/job.rb +21 -18
- data/lib/bookie/database/job_summary.rb +26 -29
- data/lib/bookie/database/lock.rb +4 -4
- data/lib/bookie/database/system_type.rb +6 -6
- data/lib/bookie/database/user.rb +5 -5
- data/lib/bookie/formatters/stdout.rb +9 -7
- data/lib/bookie/version.rb +1 -1
- data/spec/config_spec.rb +21 -21
- data/spec/database/group_spec.rb +13 -14
- data/spec/database/job_spec.rb +62 -63
- data/spec/database/job_summary_spec.rb +60 -62
- data/spec/database/lock_spec.rb +11 -12
- data/spec/database/system_spec.rb +49 -50
- data/spec/database/system_type_spec.rb +14 -15
- data/spec/database/user_spec.rb +25 -26
- data/spec/extensions_spec.rb +11 -11
- data/spec/formatter_spec.rb +15 -15
- data/spec/formatters/comma_dump_spec.rb +8 -8
- data/spec/formatters/spreadsheet_spec.rb +9 -9
- data/spec/formatters/stdout_spec.rb +8 -8
- data/spec/sender_spec.rb +44 -46
- data/spec/senders/standalone_spec.rb +9 -11
- data/spec/senders/torque_cluster_spec.rb +31 -31
- metadata +14 -43
- data/todo.txt +0 -13
@@ -8,7 +8,7 @@ require 'pacct'
|
|
8
8
|
module Bookie
|
9
9
|
module Senders
|
10
10
|
module Standalone
|
11
|
-
|
11
|
+
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -16,26 +16,24 @@ end
|
|
16
16
|
describe Bookie::Senders::Standalone do
|
17
17
|
let(:config) { Bookie::Config.new('snapshot/pacct_test_config.json') }
|
18
18
|
let(:sender) { Bookie::Sender.new(config) }
|
19
|
-
|
19
|
+
|
20
20
|
it "correctly yields jobs" do
|
21
21
|
sender.each_job('snapshot/pacct') do |job|
|
22
|
-
job.class.
|
23
|
-
job.user_name.
|
22
|
+
expect(job.class).to eql Pacct::Entry
|
23
|
+
expect(job.user_name).to eql 'root'
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
it "has the correct system type name" do
|
28
|
-
sender.system_type_name.
|
28
|
+
expect(sender.system_type_name).to eql 'Standalone'
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
it "has the correct memory stat type" do
|
32
|
-
sender.memory_stat_type.
|
32
|
+
expect(sender.memory_stat_type).to eql :avg
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
describe Pacct::Entry do
|
37
|
-
it
|
38
|
-
Pacct::Entry.new.respond_to?(:to_record).should eql true
|
39
|
-
end
|
37
|
+
it { expect(Pacct::Entry.new).to respond_to(:to_record) }
|
40
38
|
end
|
41
39
|
|
@@ -6,38 +6,38 @@ require 'bookie/senders/torque_cluster.rb'
|
|
6
6
|
module Bookie
|
7
7
|
module Senders
|
8
8
|
module TorqueCluster
|
9
|
-
|
9
|
+
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
module Torque
|
15
15
|
class Job
|
16
|
-
|
16
|
+
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
class JobLog
|
20
|
-
|
20
|
+
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
describe Bookie::Senders::TorqueCluster do
|
25
25
|
let(:config) { Bookie::Config.new('snapshot/test_config.json') }
|
26
26
|
let(:sender) { Bookie::Sender.new(config) }
|
27
|
-
|
27
|
+
|
28
28
|
it "correctly yields jobs" do
|
29
29
|
sender.each_job('snapshot/torque') do |job|
|
30
|
-
job.class.
|
31
|
-
job.user_name.
|
30
|
+
expect(job.class).to eql Torque::Job
|
31
|
+
expect(job.user_name).to eql 'blm768'
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "has the correct system type name" do
|
36
|
-
sender.system_type_name.
|
36
|
+
expect(sender.system_type_name).to eql 'TORQUE cluster'
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
it "has the correct memory stat type" do
|
40
|
-
sender.memory_stat_type.
|
40
|
+
expect(sender.memory_stat_type).to eql :max
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -49,43 +49,43 @@ describe Torque::JobLog do
|
|
49
49
|
before(:each) do
|
50
50
|
@log = Torque::JobLog.new('snapshot/torque')
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
it "throws an error if the file does not exist" do
|
54
|
-
expect { Torque::JobLog.new('snapshot/abc') }.to raise_error
|
54
|
+
expect { Torque::JobLog.new('snapshot/abc') }.to raise_error(Errno::ENOENT)
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
it "correctly reads data" do
|
58
58
|
n = 0
|
59
59
|
@log.each_job do |job|
|
60
|
-
job.user_name.
|
61
|
-
job.group_name.
|
62
|
-
job.start_time.
|
63
|
-
job.wall_time.
|
64
|
-
job.cpu_time.
|
65
|
-
job.physical_memory.
|
66
|
-
job.virtual_memory.
|
67
|
-
job.memory.
|
68
|
-
job.exit_code.
|
60
|
+
expect(job.user_name).to eql "blm768"
|
61
|
+
expect(job.group_name).to eql "test"
|
62
|
+
expect(job.start_time).to eql Time.at(1349679573)
|
63
|
+
expect(job.wall_time).to eql 67
|
64
|
+
expect(job.cpu_time).to eql 63
|
65
|
+
expect(job.physical_memory).to eql 139776
|
66
|
+
expect(job.virtual_memory).to eql 173444
|
67
|
+
expect(job.memory).to eql job.physical_memory + job.virtual_memory
|
68
|
+
expect(job.exit_code).to eql 0
|
69
69
|
n += 1
|
70
70
|
end
|
71
71
|
#One of the entries in the file is not a job end entry and should be skipped.
|
72
|
-
n.
|
72
|
+
expect(n).to eql 1
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
it "can read data more than once" do
|
76
76
|
2.times do
|
77
77
|
n = 0
|
78
78
|
@log.each_job do |job|
|
79
79
|
n += 1
|
80
80
|
end
|
81
|
-
n.
|
81
|
+
expect(n).to eql 1
|
82
82
|
end
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
it "correctly parses durations" do
|
86
|
-
@log.send(:parse_duration, "01:02:03").
|
86
|
+
expect(@log.send(:parse_duration, "01:02:03")).to eql 3723
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
it "raises errors when lines are invalid" do
|
90
90
|
log = Torque::JobLog.new('snapshot/torque_invalid_lines')
|
91
91
|
expect { log.each_job }.to raise_error(
|
@@ -100,8 +100,8 @@ describe Torque::JobLog do
|
|
100
100
|
)
|
101
101
|
end
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
it "correctly calculates the filename for a date" do
|
105
|
-
Torque::JobLog.filename_for_date(Date.new(2012, 1, 3)).
|
105
|
+
expect(Torque::JobLog.filename_for_date(Date.new(2012, 1, 3))).to eql Torque::torque_root + '/server_priv/accounting/20120103'
|
106
106
|
end
|
107
107
|
end
|
metadata
CHANGED
@@ -1,97 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookie_accounting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Merritt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: mysql2
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '>='
|
38
|
+
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: pacct
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: protected_attributes
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '>='
|
45
|
+
- - ">="
|
74
46
|
- !ruby/object:Gem::Version
|
75
47
|
version: '0'
|
76
48
|
type: :runtime
|
77
49
|
prerelease: false
|
78
50
|
version_requirements: !ruby/object:Gem::Requirement
|
79
51
|
requirements:
|
80
|
-
- -
|
52
|
+
- - ">="
|
81
53
|
- !ruby/object:Gem::Version
|
82
54
|
version: '0'
|
83
55
|
- !ruby/object:Gem::Dependency
|
84
56
|
name: spreadsheet
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
86
58
|
requirements:
|
87
|
-
- -
|
59
|
+
- - ">="
|
88
60
|
- !ruby/object:Gem::Version
|
89
61
|
version: '0'
|
90
62
|
type: :runtime
|
91
63
|
prerelease: false
|
92
64
|
version_requirements: !ruby/object:Gem::Requirement
|
93
65
|
requirements:
|
94
|
-
- -
|
66
|
+
- - ">="
|
95
67
|
- !ruby/object:Gem::Version
|
96
68
|
version: '0'
|
97
69
|
description: A simple system to consolidate and analyze process accounting records
|
@@ -104,7 +76,7 @@ executables:
|
|
104
76
|
extensions: []
|
105
77
|
extra_rdoc_files: []
|
106
78
|
files:
|
107
|
-
- .gitignore
|
79
|
+
- ".gitignore"
|
108
80
|
- Gemfile
|
109
81
|
- LICENSE
|
110
82
|
- README.md
|
@@ -162,7 +134,6 @@ files:
|
|
162
134
|
- spec/senders/standalone_spec.rb
|
163
135
|
- spec/senders/torque_cluster_spec.rb
|
164
136
|
- spec/spec_helper.rb
|
165
|
-
- todo.txt
|
166
137
|
homepage: https://github.com/blm768/bookie/
|
167
138
|
licenses:
|
168
139
|
- MIT
|
@@ -173,17 +144,17 @@ require_paths:
|
|
173
144
|
- lib
|
174
145
|
required_ruby_version: !ruby/object:Gem::Requirement
|
175
146
|
requirements:
|
176
|
-
- -
|
147
|
+
- - ">="
|
177
148
|
- !ruby/object:Gem::Version
|
178
149
|
version: '0'
|
179
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
151
|
requirements:
|
181
|
-
- -
|
152
|
+
- - ">="
|
182
153
|
- !ruby/object:Gem::Version
|
183
154
|
version: '0'
|
184
155
|
requirements: []
|
185
156
|
rubyforge_project:
|
186
|
-
rubygems_version: 2.
|
157
|
+
rubygems_version: 2.5.1
|
187
158
|
signing_key:
|
188
159
|
specification_version: 4
|
189
160
|
summary: A simple system to consolidate and analyze process accounting records
|
data/todo.txt
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
Replace deprecated find_by_* methods with find_by!(:attribute => value).
|
2
|
-
Allow configuration of date boundary to midnight in local time zone?
|
3
|
-
Make sure all source files have the required "require"s
|
4
|
-
Use "let" in RSpect tests
|
5
|
-
Replace 3600 with 2.hours, etc.
|
6
|
-
Also clear out other "magic" numbers.
|
7
|
-
Split some tests up.
|
8
|
-
Validate uniqueness?
|
9
|
-
Unit test uniqueness constraints?
|
10
|
-
Use optimistic concurrency control?
|
11
|
-
Make units more independent.
|
12
|
-
Make unit test success more independent.
|
13
|
-
|