rocketjob_mission_control 4.1.0 → 4.2.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80f6b3973c176cdfe7a2f0d0f20b51fa066fc0013ad86e1f01b400e45b75466f
|
4
|
+
data.tar.gz: 7d781ed535a84e4783ad6bc8efb6c4dbc53e76d8baf9092498665d20ce675788
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f3c5353ad000737226601f20e7fe2b287a3b942f97a1fce84cd40e6de70e0abbaca1f996557ee8933e2f450e4a5368d1b4ba4f6b3d9379b9565ef3437776b94
|
7
|
+
data.tar.gz: da41863c1b1e8668b2176cdca70331e519d194fc157638eff61cac5037c6e6f3d7ef07609204e88f1008d4e324ca654202200bf4f7843ff82a1757e07e340a4d
|
@@ -30,15 +30,17 @@ module RocketJobMissionControl
|
|
30
30
|
QUEUED_COLUMNS = [
|
31
31
|
{display: 'Class', value: :class_with_link, field: '_type'},
|
32
32
|
{display: 'Description', value: :description, field: 'description'},
|
33
|
+
{display: 'Record Count', value: :record_count, field: 'record_count'},
|
33
34
|
{display: 'Priority', value: :priority, field: 'priority'},
|
34
35
|
{display: 'Queued For', value: :duration, field: 'duration', orderable: false},
|
35
36
|
{display: 'Actions', value: :action_buttons, orderable: false}
|
36
37
|
]
|
37
|
-
QUEUED_FIELDS = (COMMON_FIELDS + [:run_at, :priority]).freeze
|
38
|
+
QUEUED_FIELDS = (COMMON_FIELDS + [:record_count, :run_at, :priority]).freeze
|
38
39
|
|
39
40
|
RUNNING_COLUMNS = [
|
40
41
|
{display: 'Class', value: :class_with_link, field: '_type'},
|
41
42
|
{display: 'Description', value: :description, field: 'description'},
|
43
|
+
{display: 'Record Count', value: :record_count, field: 'record_count'},
|
42
44
|
{display: 'Progress', value: :progress, field: 'percent_complete', orderable: false},
|
43
45
|
{display: 'Workers', value: :worker_count, field: 'worker_count', orderable: false},
|
44
46
|
{display: 'Priority', value: :priority, field: 'priority'},
|
@@ -118,6 +120,10 @@ module RocketJobMissionControl
|
|
118
120
|
h(job.worker_count)
|
119
121
|
end
|
120
122
|
|
123
|
+
def record_count(job)
|
124
|
+
job.attributes.key?('record_count') ? h(job.record_count) : 0
|
125
|
+
end
|
126
|
+
|
121
127
|
def started(job)
|
122
128
|
"#{RocketJob.seconds_as_duration(Time.now - (job.started_at || Time.now))} ago" if job.started_at
|
123
129
|
end
|
@@ -23,6 +23,7 @@ module RocketJobMissionControl
|
|
23
23
|
let(:server) do
|
24
24
|
server = RocketJob::Server.new
|
25
25
|
server.started
|
26
|
+
server.build_heartbeat(updated_at: 1.hour.ago, workers: 0)
|
26
27
|
server
|
27
28
|
end
|
28
29
|
|
@@ -50,6 +51,7 @@ module RocketJobMissionControl
|
|
50
51
|
let(:server) do
|
51
52
|
server = RocketJob::Server.new
|
52
53
|
server.started
|
54
|
+
server.build_heartbeat(updated_at: 1.hour.ago, workers: 0)
|
53
55
|
server
|
54
56
|
end
|
55
57
|
|
@@ -3,6 +3,7 @@ require_relative '../../test_helper'
|
|
3
3
|
class QueryTest < Minitest::Test
|
4
4
|
|
5
5
|
class NoopJob < RocketJob::Job
|
6
|
+
field :record_count, type: Integer, default: 0
|
6
7
|
def perform(record)
|
7
8
|
# noop
|
8
9
|
end
|
@@ -10,7 +11,7 @@ class QueryTest < Minitest::Test
|
|
10
11
|
|
11
12
|
describe RocketJobMissionControl::Query do
|
12
13
|
before do
|
13
|
-
@jobs = (1..10).collect { |i| NoopJob.create(description: "Job #{i}") }
|
14
|
+
@jobs = (1..10).collect { |i| NoopJob.create(description: "Job #{i}", record_count: i) }
|
14
15
|
end
|
15
16
|
|
16
17
|
after do
|
@@ -98,6 +99,27 @@ class QueryTest < Minitest::Test
|
|
98
99
|
assert_equal 3, count
|
99
100
|
end
|
100
101
|
|
102
|
+
it 'sorts ascending by record_count' do
|
103
|
+
count = 0
|
104
|
+
previous = nil
|
105
|
+
RocketJobMissionControl::Query.new(NoopJob.all, record_count: 1).query.each do |job|
|
106
|
+
assert(previous < job.record_count, "Wrong sort order. #{previous} < #{job.record_count}") if previous
|
107
|
+
previous = job.record_count
|
108
|
+
count += 1
|
109
|
+
end
|
110
|
+
assert_equal @jobs.count, count
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'sorts descending by record_count' do
|
114
|
+
count = 0
|
115
|
+
previous = nil
|
116
|
+
RocketJobMissionControl::Query.new(NoopJob.all, record_count: -1).query.each do |job|
|
117
|
+
assert(previous > job.record_count, "Wrong sort order. #{previous} > #{job.record_count}") if previous
|
118
|
+
previous = job.record_count
|
119
|
+
count += 1
|
120
|
+
end
|
121
|
+
assert_equal @jobs.count, count
|
122
|
+
end
|
101
123
|
end
|
102
124
|
|
103
125
|
describe '#count' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocketjob_mission_control
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Cloutier
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2019-
|
14
|
+
date: 2019-04-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|