barbeque 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 2e9cf425229aa453c69b0b10724cd42f16d3d5a9
4
- data.tar.gz: d8434e65e0d541f19b5424ffe906fa1519999f83
3
+ metadata.gz: a43082ae404cbe883e4ba07cbd59e6704c928ab3
4
+ data.tar.gz: a2f5fabeb566ac7c2345c5b77f7e4093d43243f9
5
5
  SHA512:
6
- metadata.gz: a751d7a94159f26dab6a2b434af7dc47a4e826657d7c3d7ebb33b67174eddf9104bd7b1f80d6fd5397ce82b7a5905c7c55a4424d3e7e14da63f7fe12aa7d356e
7
- data.tar.gz: e18f9585c6a98e66c4b0285912c6ad8a7079f39d5a8dc3b4fab066652d29b9a4aecec0a70ee71ccfa2eb8d1372641e01670792feebcffee6ac690bfc873d4d52
6
+ metadata.gz: cb8b997431c6661bd6c5fd03dfcc17a1c86146b8e88db452aa43b1d668ea1473375c6dd42ce6c54057c965cc6a6fab7181818e01a9aab337f6acf1cee2149e5d
7
+ data.tar.gz: 833426bd91b0901351f491b4962ebc7f15460cb181b66f2d9242358279e9ae288a49a13563c96a4d705ffffe512c26d7bfa5268072717b977fc7af90053f62f6
data/README.md CHANGED
@@ -8,7 +8,7 @@ Job queue system to run job with Docker
8
8
  ## Project Status
9
9
 
10
10
  Barbeque is under development but already used on production at Cookpad.
11
- Documentation and open-sourcing plugins are work in progress.
11
+ Documentation is work in progress.
12
12
 
13
13
  ## What's Barbeque?
14
14
 
@@ -24,8 +24,8 @@ In Barbeque worker, they are done on Docker container.
24
24
 
25
25
  ## Why Barbeque?
26
26
 
27
- - You can achieve job-level auto scaling using tools like [Amazon ECS](https://aws.amazon.com/ecs/) and [EC2 Auto Scaling group](https://aws.amazon.com/autoscaling/)
28
- - It requires a plugin to run job with ECS, but it's not open-sourced for now
27
+ - You can achieve job-level auto scaling using tools like [Amazon ECS](https://aws.amazon.com/ecs/) [EC2 Auto Scaling group](https://aws.amazon.com/autoscaling/)
28
+ - For Amazon ECS, Barbeque has Hako runner
29
29
  - You don't have to manage infrastructure for each application like Resque or Sidekiq
30
30
 
31
31
  For details, see [Scalable Job Queue System Built with Docker // Speaker Deck](https://speakerdeck.com/k0kubun/scalable-job-queue-system-built-with-docker).
@@ -15,12 +15,19 @@ class Barbeque::JobDefinition < Barbeque::ApplicationRecord
15
15
  DATE_HOUR_SQL = 'date_format(created_at, "%Y-%m-%d %H:00:00")'
16
16
 
17
17
  def execution_stats(from, to)
18
- job_executions.where(created_at: from .. to).group(DATE_HOUR_SQL).order(DATE_HOUR_SQL).pluck("#{DATE_HOUR_SQL}, count(1), avg(timestampdiff(second, created_at, finished_at))").map do |date_hour, count, avg_time|
19
- {
20
- date_hour: Time.zone.parse("#{date_hour} UTC"),
18
+ from = from.beginning_of_hour
19
+ to = to.beginning_of_hour
20
+ stats = Hash.new { |h, k| h[k] = { count: 0, avg_time: 0 } }
21
+ job_executions.where(created_at: from .. to).group(DATE_HOUR_SQL).order(DATE_HOUR_SQL).pluck("#{DATE_HOUR_SQL}, count(1), avg(timestampdiff(second, created_at, finished_at))").each do |date_hour, count, avg_time|
22
+ time = Time.zone.parse("#{date_hour} UTC")
23
+ stats[time] = {
21
24
  count: count,
22
25
  avg_time: avg_time,
23
26
  }
24
27
  end
28
+ (from.to_i ... to.to_i).step(1.hour).map do |t|
29
+ time = Time.at(t)
30
+ stats[time].merge(date_hour: time)
31
+ end
25
32
  end
26
33
  end
@@ -1,3 +1,3 @@
1
1
  module Barbeque
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
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: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-20 00:00:00.000000000 Z
11
+ date: 2017-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: adminlte2-rails
@@ -387,7 +387,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
387
387
  version: '0'
388
388
  requirements: []
389
389
  rubyforge_project:
390
- rubygems_version: 2.5.2
390
+ rubygems_version: 2.6.8
391
391
  signing_key:
392
392
  specification_version: 4
393
393
  summary: Job queue system to run job with Docker