rails-autoscale-good_job 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails-autoscale-good_job.rb +1 -1
- metadata +7 -31
- data/Gemfile +0 -9
- data/Gemfile-activerecord-6-1 +0 -9
- data/Gemfile-activerecord-7-0 +0 -9
- data/Rakefile +0 -11
- data/judoscale-good_job.gemspec +0 -30
- data/lib/judoscale/good_job/metrics_collector.rb +0 -70
- data/lib/judoscale/good_job/version.rb +0 -7
- data/lib/judoscale/good_job.rb +0 -19
- data/lib/judoscale-good_job.rb +0 -3
- data/rails-autoscale-good_job.gemspec +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f4f0ab846249e5f8b445270c7cfa78d30e35d1be6630d30d10eaf05cec5b2af
|
4
|
+
data.tar.gz: ec41daa6426f66ed1a8e70ebed17f45c4e572309804353f63bcec1e1a3997b7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 814dbe81d43c288883d4bc20577ac0ea33145eb664bb22c91226f0d0ec5f943462a7e7235618cd5cdccdcc0973a40796f018b93b879713dc820804f0216d5c03
|
7
|
+
data.tar.gz: 55dd89f11e37c1c57e3356ffcef8861374166b674601cc07c8b11c02f78c2c18d871f1dc9d032cfcb3162a3f1970faa5f9e50086347966b4c513b5f88a6799d1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-autoscale-good_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam McCrea
|
@@ -10,36 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-07-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: judoscale-good_job
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.7.
|
21
|
+
version: 1.7.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.7.
|
29
|
-
- !ruby/object:Gem::Dependency
|
30
|
-
name: good_job
|
31
|
-
requirement: !ruby/object:Gem::Requirement
|
32
|
-
requirements:
|
33
|
-
- - ">="
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: '3.0'
|
36
|
-
type: :runtime
|
37
|
-
prerelease: false
|
38
|
-
version_requirements: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '3.0'
|
28
|
+
version: 1.7.1
|
43
29
|
description:
|
44
30
|
email:
|
45
31
|
- hello@judoscale.com
|
@@ -47,17 +33,7 @@ executables: []
|
|
47
33
|
extensions: []
|
48
34
|
extra_rdoc_files: []
|
49
35
|
files:
|
50
|
-
- Gemfile
|
51
|
-
- Gemfile-activerecord-6-1
|
52
|
-
- Gemfile-activerecord-7-0
|
53
|
-
- Rakefile
|
54
|
-
- judoscale-good_job.gemspec
|
55
|
-
- lib/judoscale-good_job.rb
|
56
|
-
- lib/judoscale/good_job.rb
|
57
|
-
- lib/judoscale/good_job/metrics_collector.rb
|
58
|
-
- lib/judoscale/good_job/version.rb
|
59
36
|
- lib/rails-autoscale-good_job.rb
|
60
|
-
- rails-autoscale-good_job.gemspec
|
61
37
|
homepage: https://judoscale.com
|
62
38
|
licenses:
|
63
39
|
- MIT
|
@@ -75,14 +51,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
51
|
requirements:
|
76
52
|
- - ">="
|
77
53
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
54
|
+
version: '0'
|
79
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
56
|
requirements:
|
81
57
|
- - ">="
|
82
58
|
- !ruby/object:Gem::Version
|
83
59
|
version: '0'
|
84
60
|
requirements: []
|
85
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.5.11
|
86
62
|
signing_key:
|
87
63
|
specification_version: 4
|
88
64
|
summary: Autoscaling for Good Job workers.
|
data/Gemfile
DELETED
data/Gemfile-activerecord-6-1
DELETED
data/Gemfile-activerecord-7-0
DELETED
data/Rakefile
DELETED
data/judoscale-good_job.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
lib = File.expand_path("../lib", __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require "judoscale/good_job/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "judoscale-good_job"
|
7
|
-
spec.version = Judoscale::GoodJob::VERSION
|
8
|
-
spec.authors = ["Adam McCrea", "Carlos Antonio da Silva", "Jon Sullivan"]
|
9
|
-
spec.email = ["hello@judoscale.com"]
|
10
|
-
|
11
|
-
spec.summary = "Autoscaling for Good Job workers."
|
12
|
-
spec.homepage = "https://judoscale.com"
|
13
|
-
spec.license = "MIT"
|
14
|
-
|
15
|
-
spec.metadata = {
|
16
|
-
"homepage_uri" => "https://judoscale.com",
|
17
|
-
"bug_tracker_uri" => "https://github.com/judoscale/judoscale-ruby/issues",
|
18
|
-
"documentation_uri" => "https://judoscale.com/docs",
|
19
|
-
"changelog_uri" => "https://github.com/judoscale/judoscale-ruby/blob/main/CHANGELOG.md",
|
20
|
-
"source_code_uri" => "https://github.com/judoscale/judoscale-ruby"
|
21
|
-
}
|
22
|
-
|
23
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
-
spec.require_paths = ["lib"]
|
25
|
-
|
26
|
-
spec.required_ruby_version = ">= 2.6.0"
|
27
|
-
|
28
|
-
spec.add_dependency "judoscale-ruby", Judoscale::GoodJob::VERSION
|
29
|
-
spec.add_dependency "good_job", ">= 3.0"
|
30
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "judoscale/job_metrics_collector"
|
4
|
-
require "judoscale/job_metrics_collector/active_record_helper"
|
5
|
-
require "judoscale/metric"
|
6
|
-
|
7
|
-
module Judoscale
|
8
|
-
module GoodJob
|
9
|
-
class MetricsCollector < Judoscale::JobMetricsCollector
|
10
|
-
include ActiveRecordHelper
|
11
|
-
|
12
|
-
def self.adapter_config
|
13
|
-
Judoscale::Config.instance.good_job
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.collect?(config)
|
17
|
-
super && ActiveRecordHelper.table_exists_for_model?(::GoodJob::Execution)
|
18
|
-
end
|
19
|
-
|
20
|
-
def initialize
|
21
|
-
super
|
22
|
-
|
23
|
-
queue_names = run_silently do
|
24
|
-
::GoodJob::Execution.select("distinct queue_name").map(&:queue_name)
|
25
|
-
end
|
26
|
-
self.queues |= queue_names
|
27
|
-
end
|
28
|
-
|
29
|
-
def collect
|
30
|
-
metrics = []
|
31
|
-
time = Time.now.utc
|
32
|
-
|
33
|
-
# logically we don't need the finished_at condition, but it lets postgres use the indexes
|
34
|
-
oldest_execution_time_by_queue = run_silently do
|
35
|
-
::GoodJob::Execution
|
36
|
-
.where(performed_at: nil, finished_at: nil)
|
37
|
-
.group(:queue_name)
|
38
|
-
.pluck(:queue_name, Arel.sql("min(coalesce(scheduled_at, created_at))"))
|
39
|
-
.to_h
|
40
|
-
end
|
41
|
-
self.queues |= oldest_execution_time_by_queue.keys
|
42
|
-
|
43
|
-
if track_busy_jobs?
|
44
|
-
busy_count_by_queue = run_silently do
|
45
|
-
::GoodJob::Execution.running.group(:queue_name).count
|
46
|
-
end
|
47
|
-
self.queues |= busy_count_by_queue.keys
|
48
|
-
end
|
49
|
-
|
50
|
-
queues.each do |queue|
|
51
|
-
run_at = oldest_execution_time_by_queue[queue]
|
52
|
-
# DateTime.parse assumes a UTC string
|
53
|
-
run_at = DateTime.parse(run_at) if run_at.is_a?(String)
|
54
|
-
latency_ms = run_at ? ((time - run_at) * 1000).ceil : 0
|
55
|
-
latency_ms = 0 if latency_ms < 0
|
56
|
-
|
57
|
-
metrics.push Metric.new(:qt, latency_ms, time, queue)
|
58
|
-
|
59
|
-
if track_busy_jobs?
|
60
|
-
busy_count = busy_count_by_queue[queue] || 0
|
61
|
-
metrics.push Metric.new(:busy, busy_count, Time.now, queue)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
log_collection(metrics)
|
66
|
-
metrics
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
data/lib/judoscale/good_job.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# require "good_job" fails unless we require these first
|
4
|
-
require "rails"
|
5
|
-
require "active_support/core_ext/numeric/time"
|
6
|
-
require "active_job/railtie"
|
7
|
-
require "good_job"
|
8
|
-
require "judoscale-ruby"
|
9
|
-
require "judoscale/config"
|
10
|
-
require "judoscale/good_job/version"
|
11
|
-
require "judoscale/good_job/metrics_collector"
|
12
|
-
|
13
|
-
Judoscale.add_adapter :"judoscale-good_job",
|
14
|
-
{
|
15
|
-
adapter_version: Judoscale::GoodJob::VERSION,
|
16
|
-
framework_version: ::GoodJob::VERSION
|
17
|
-
},
|
18
|
-
metrics_collector: Judoscale::GoodJob::MetricsCollector,
|
19
|
-
expose_config: Judoscale::Config::JobAdapterConfig.new(:good_job)
|
data/lib/judoscale-good_job.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
lib = File.expand_path("../lib", __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require "judoscale/good_job/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "rails-autoscale-good_job"
|
7
|
-
spec.version = Judoscale::GoodJob::VERSION
|
8
|
-
spec.authors = ["Adam McCrea", "Carlos Antonio da Silva", "Jon Sullivan"]
|
9
|
-
spec.email = ["hello@judoscale.com"]
|
10
|
-
|
11
|
-
spec.summary = "Autoscaling for Good Job workers."
|
12
|
-
spec.homepage = "https://judoscale.com"
|
13
|
-
spec.license = "MIT"
|
14
|
-
|
15
|
-
spec.metadata = {
|
16
|
-
"homepage_uri" => "https://judoscale.com",
|
17
|
-
"bug_tracker_uri" => "https://github.com/judoscale/judoscale-ruby/issues",
|
18
|
-
"documentation_uri" => "https://judoscale.com/docs",
|
19
|
-
"changelog_uri" => "https://github.com/judoscale/judoscale-ruby/blob/main/CHANGELOG.md",
|
20
|
-
"source_code_uri" => "https://github.com/judoscale/judoscale-ruby"
|
21
|
-
}
|
22
|
-
|
23
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
-
spec.require_paths = ["lib"]
|
25
|
-
|
26
|
-
spec.required_ruby_version = ">= 2.6.0"
|
27
|
-
|
28
|
-
spec.add_dependency "rails-autoscale-core", Judoscale::GoodJob::VERSION
|
29
|
-
spec.add_dependency "good_job", ">= 3.0"
|
30
|
-
end
|