bookie_accounting 0.0.3 → 1.0.0

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/bin/bookie-data CHANGED
@@ -17,8 +17,7 @@ include_details = false
17
17
  output_type = :stdout
18
18
  filename = nil
19
19
 
20
- t_min = nil
21
- t_max = nil
20
+ time_range = nil
22
21
 
23
22
  #Process arguments
24
23
 
@@ -78,8 +77,7 @@ opts = OptionParser.new do |opts|
78
77
  end
79
78
 
80
79
  opts.on('-r', '--time BEGIN,END', Array, "filter by a time range") do |t|
81
- t_min = Time.parse(t[0])
82
- t_max = Time.parse(t[1])
80
+ time_range = Time.parse(t[0]) ... Time.parse(t[1])
83
81
  end
84
82
 
85
83
  opts.on('-o', '--output-file FILENAME', "send formatted output to FILENAME",
@@ -106,7 +104,7 @@ end
106
104
 
107
105
  formatter = Bookie::Formatter.new(output_type, filename)
108
106
 
109
- jobs_summary, systems_summary = formatter.print_summary(jobs, summaries, systems, t_min, t_max)
110
- jobs = jobs.by_time_range_inclusive(t_min, t_max) if t_min
107
+ jobs_summary, systems_summary = formatter.print_summary(jobs, summaries, systems, time_range)
108
+ jobs = jobs.by_time_range_inclusive(time_range) if time_range
111
109
  formatter.print_jobs(jobs.all) if include_details
112
110
  formatter.flush
@@ -40,7 +40,7 @@ module Bookie
40
40
  #An array containing the labels for each field in a details table
41
41
  DETAILS_FIELD_LABELS = [
42
42
  'User', 'Group', 'System', 'System type', 'Start time', 'End time', 'Wall time',
43
- 'CPU time', 'Memory usage', 'Exit code'
43
+ 'CPU time', 'Memory usage', 'Command', 'Exit code'
44
44
  ]
45
45
 
46
46
  ##
@@ -123,6 +123,7 @@ module Bookie
123
123
  Formatter.format_duration(job.end_time - job.start_time),
124
124
  Formatter.format_duration(job.cpu_time),
125
125
  "#{job.memory}kb#{memory_stat_type}",
126
+ job.command_name,
126
127
  job.exit_code
127
128
  ]
128
129
  end
@@ -10,7 +10,7 @@ module Bookie
10
10
  @workbook = ::Spreadsheet::Workbook.new
11
11
  end
12
12
 
13
- #Actual printing is delayed until object finalization due to the workings of the Spreadsheet gem.
13
+ #Actual file write is delayed until do_flush() due to the workings of the Spreadsheet gem.
14
14
  def do_print_summary(field_values)
15
15
  s = @workbook.worksheet("Summary") || @workbook.create_worksheet(:name => "Summary")
16
16
 
@@ -26,7 +26,7 @@ module Bookie
26
26
  s = @workbook.worksheet("Details") || @workbook.create_worksheet(:name => "Details")
27
27
 
28
28
  s.row(0).concat(Formatter::DETAILS_FIELD_LABELS)
29
- (0 .. (Formatter::DETAILS_FIELD_LABELS.length - 1)).step do |i|
29
+ (0 ... Formatter::DETAILS_FIELD_LABELS.length).step do |i|
30
30
  s.column(i).width = 20
31
31
  end
32
32
 
@@ -42,4 +42,4 @@ module Bookie
42
42
  end
43
43
  end
44
44
  end
45
- end
45
+ end
@@ -19,7 +19,7 @@ module Bookie
19
19
 
20
20
  def do_print_jobs(jobs)
21
21
  #To consider: optimize by moving out of the function?
22
- format_string = "%-15.15s %-15.15s %-20.20s %-20.20s %-26.25s %-26.25s %-12.10s %-12.10s %-20.20s %-11.11s\n"
22
+ format_string = "%-15.15s %-15.15s %-20.20s %-20.20s %-26.25s %-26.25s %-12.10s %-12.10s %-20.20s %-20.20s %-11.11s\n"
23
23
  heading = sprintf(format_string, *Formatter::DETAILS_FIELD_LABELS)
24
24
  @io.write heading
25
25
  @io.puts '-' * (heading.length - 1)
@@ -1,4 +1,4 @@
1
1
  module Bookie
2
2
  #The library version
3
- VERSION = "0.0.3"
3
+ VERSION = "1.0.0"
4
4
  end
@@ -34,9 +34,9 @@ describe Bookie::Formatters::CommaDump do
34
34
  it "correctly formats jobs" do
35
35
  @formatter.print_jobs(@jobs.order(:start_time).limit(2).all)
36
36
  @m.buf.should eql <<-eos
37
- User, Group, System, System type, Start time, End time, Wall time, CPU time, Memory usage, Exit code
38
- root, root, test1, Standalone, 2012-01-01 00:00:00, 2012-01-01 01:00:00, 01:00:00, 00:01:40, 200kb (avg), 0
39
- test, default, test1, Standalone, 2012-01-01 01:00:00, 2012-01-01 02:00:00, 01:00:00, 00:01:40, 200kb (avg), 1
37
+ User, Group, System, System type, Start time, End time, Wall time, CPU time, Memory usage, Command, Exit code
38
+ root, root, test1, Standalone, 2012-01-01 00:00:00, 2012-01-01 01:00:00, 01:00:00, 00:01:40, 200kb (avg), vi, 0
39
+ test, default, test1, Standalone, 2012-01-01 01:00:00, 2012-01-01 02:00:00, 01:00:00, 00:01:40, 200kb (avg), emacs, 1
40
40
  eos
41
41
  end
42
42
 
@@ -40,11 +40,12 @@ describe Bookie::Formatter do
40
40
  'root',
41
41
  'test1',
42
42
  'Standalone',
43
- "2012-01-01 00:00:00",
44
- "2012-01-01 01:00:00",
43
+ '2012-01-01 00:00:00',
44
+ '2012-01-01 01:00:00',
45
45
  '01:00:00',
46
46
  '00:01:40',
47
47
  '200kb (avg)',
48
+ 'vi',
48
49
  0,
49
50
  ]
50
51
  end
@@ -83,9 +83,9 @@ describe Bookie::Formatters::Spreadsheet do
83
83
  end
84
84
  w.row(0).should eql Bookie::Formatter::DETAILS_FIELD_LABELS
85
85
  w.row(1).should eql ["root", "root", "test1", "Standalone", "2012-01-01 00:00:00",
86
- "2012-01-01 01:00:00", "01:00:00", "00:01:40", "200kb (avg)", 0]
86
+ "2012-01-01 01:00:00", "01:00:00", "00:01:40", "200kb (avg)", 'vi', 0]
87
87
  w.row(2).should eql ["test", "default", "test1", "Standalone", "2012-01-01 01:00:00",
88
- "2012-01-01 02:00:00", "01:00:00", "00:01:40", "200kb (avg)", 1]
88
+ "2012-01-01 02:00:00", "01:00:00", "00:01:40", "200kb (avg)", 'emacs', 1]
89
89
  end
90
90
 
91
91
  it "correctly formats summaries" do
@@ -36,17 +36,12 @@ describe Bookie::Formatters::Stdout do
36
36
  it "correctly formats jobs" do
37
37
  @formatter.print_jobs(@jobs.order(:start_time).limit(2))
38
38
  @formatter.flush
39
- @m.buf.should eql \
40
- "User Group System System type Start " +
41
- "time End time Wall time CPU time Memory" +
42
- " usage Exit code \n----------------------------------------------------" +
43
- "--------------------------------------------------------------------------------" +
44
- "------------------------------------------------------\nroot root " +
45
- " test1 Standalone 2012-01-01 00:00:00 201" +
46
- "2-01-01 01:00:00 01:00:00 00:01:40 200kb (avg) 0 " +
47
- " \ntest default test1 Standalone 20" +
48
- "12-01-01 01:00:00 2012-01-01 02:00:00 01:00:00 00:01:40 20" +
49
- "0kb (avg) 1 \n"
39
+ @m.buf.should eql <<-eos
40
+ User Group System System type Start time End time Wall time CPU time Memory usage Command Exit code
41
+ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
42
+ root root test1 Standalone 2012-01-01 00:00:00 2012-01-01 01:00:00 01:00:00 00:01:40 200kb (avg) vi 0
43
+ test default test1 Standalone 2012-01-01 01:00:00 2012-01-01 02:00:00 01:00:00 00:01:40 200kb (avg) emacs 1
44
+ eos
50
45
  end
51
46
 
52
47
  it "correctly formats summaries" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookie_accounting
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
+ - 1
7
8
  - 0
8
9
  - 0
9
- - 3
10
- version: 0.0.3
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ben Merritt
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-04-12 00:00:00 +02:00
18
+ date: 2013-04-13 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency