barbeque 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3026b077536df0611a58ba0aa89d874684f9034c770acda9dcb3157bd3eb3038
|
4
|
+
data.tar.gz: 2483622e8a5509fba04ee65cb211f9310499de78c4728f043e020e86dad3d1ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f3ad0c7751118435c9e08f1a7dabc8a9b26244d1658b4a09726234fb1da4b0a8de06e41b7909f378dfed6c1f3fc4d3946eccf2104982376ab517e3cd48b0b33
|
7
|
+
data.tar.gz: 6b0872c02ecea57d88b2512ffb23ffc6bbb65942a25f9240eafa4b251a114aae3d41f19aa0e8e012c5c5035908f9de19904cd1df6a809fc6d04e7bcc129bb729
|
@@ -1,21 +1,40 @@
|
|
1
1
|
class Barbeque::MonitorsController < Barbeque::ApplicationController
|
2
2
|
def index
|
3
|
-
hour_sql = "date_format(#{Barbeque::JobExecution.table_name}.created_at, '%Y-%m-%d %H:00:00')"
|
4
3
|
now = Time.zone.now
|
5
4
|
from = 6.hours.ago(now.beginning_of_hour)
|
6
|
-
rows = Barbeque::JobExecution.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
rows = Barbeque::JobExecution.find_by_sql([<<SQL.strip_heredoc, from, now]).map(&:attributes)
|
6
|
+
select
|
7
|
+
t.date_hour
|
8
|
+
, app.id as app_id
|
9
|
+
, app.name as app_name
|
10
|
+
, def.id as job_id
|
11
|
+
, def.job as job_name
|
12
|
+
, t.cnt
|
13
|
+
from
|
14
|
+
(
|
15
|
+
select
|
16
|
+
date_format(e.created_at, '%Y-%m-%d %H:00:00') as date_hour
|
17
|
+
, e.job_definition_id
|
18
|
+
, count(1) as cnt
|
19
|
+
from #{Barbeque::JobExecution.table_name} e
|
20
|
+
where
|
21
|
+
e.created_at between ? and ?
|
22
|
+
group by
|
23
|
+
date_hour
|
24
|
+
, e.job_definition_id
|
25
|
+
) t
|
26
|
+
inner join #{Barbeque::JobDefinition.table_name} def on def.id = t.job_definition_id
|
27
|
+
inner join #{Barbeque::App.table_name} app on app.id = def.app_id
|
28
|
+
SQL
|
11
29
|
|
12
30
|
jobs = {}
|
13
|
-
rows.each do |
|
31
|
+
rows.each do |row|
|
32
|
+
job_id = row.fetch('job_id')
|
14
33
|
job = {
|
15
|
-
app_id: app_id,
|
16
|
-
app_name: app_name,
|
34
|
+
app_id: row.fetch('app_id'),
|
35
|
+
app_name: row.fetch('app_name'),
|
17
36
|
job_id: job_id,
|
18
|
-
job_name: job_name,
|
37
|
+
job_name: row.fetch('job_name'),
|
19
38
|
}
|
20
39
|
jobs[job_id] = job
|
21
40
|
end
|
@@ -30,9 +49,10 @@ class Barbeque::MonitorsController < Barbeque::ApplicationController
|
|
30
49
|
t += 1.hour
|
31
50
|
end
|
32
51
|
|
33
|
-
rows.each do |
|
34
|
-
date_hour = Time.zone.parse("#{date_hour} UTC")
|
35
|
-
|
52
|
+
rows.each do |row|
|
53
|
+
date_hour = Time.zone.parse("#{row.fetch('date_hour')} UTC")
|
54
|
+
job_id = row.fetch('job_id')
|
55
|
+
@recently_processed_jobs[date_hour][job_id] = jobs[job_id].merge(count: row.fetch('cnt'))
|
36
56
|
end
|
37
57
|
end
|
38
58
|
end
|
data/lib/barbeque/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barbeque
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: adminlte2-rails
|
@@ -420,6 +420,7 @@ files:
|
|
420
420
|
- db/migrate/20170711085157_create_barbeque_docker_containers.rb
|
421
421
|
- db/migrate/20170712075449_create_barbeque_ecs_hako_tasks.rb
|
422
422
|
- db/migrate/20170724025542_add_index_to_job_execution_status.rb
|
423
|
+
- db/migrate/20180411070937_add_index_to_barbeque_job_executions_created_at.rb
|
423
424
|
- lib/barbeque.rb
|
424
425
|
- lib/barbeque/config.rb
|
425
426
|
- lib/barbeque/docker_image.rb
|