-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mr_good_job_its_got_to_be_good' into adventist_dev
- Loading branch information
Showing
8 changed files
with
133 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
# frozen_string_literal: true | ||
|
||
if ENV.fetch('HYRAX_ACTIVE_JOB_QUEUE', 'sidekiq') == 'good_job' | ||
Rails.application.configure do | ||
# Configure options individually... | ||
config.good_job.preserve_job_records = true | ||
config.good_job.retry_on_unhandled_error = false | ||
config.good_job.on_thread_error = ->(exception) { Raven.capture_exception(exception) } | ||
config.good_job.execution_mode = :external | ||
# config.good_job.queues = '*' | ||
config.good_job.shutdown_timeout = 60 # seconds | ||
config.good_job.poll_interval = 5 | ||
# config.good_job.enable_cron = true | ||
# config.good_job.cron = { example: { cron: '0 * * * *', class: 'ExampleJob' } } | ||
end | ||
|
||
# Wrapping this in an after_initialize block to ensure that all constants are loaded | ||
Rails.application.config.after_initialize do | ||
# baseline of 0, higher is sooner | ||
|
||
# Commented out the following two jobs because they were | ||
# specfically used for the sdapi ingests. | ||
# see sdapi_ingest_script directory and | ||
# ref: https://github.com/scientist-softserv/adventist-dl/issues/468 | ||
# CollectionMembershipJob.priority = 70 | ||
# UpdateCollectionMembershipJob.priority = 60 | ||
Bulkrax::ScheduleRelationshipsJob.priority = 50 | ||
CreateDerivativesJob.priority = 40 | ||
CharacterizeJob.priority = 30 | ||
Hyrax::GrantEditToMembersJob.priority = 10 | ||
ImportUrlJob.priority = 10 | ||
IngestJob.priority = 10 | ||
ApplicationJob.priority = 0 | ||
AttachFilesToWorkJob.priority = -1 | ||
Bulkrax::ImportWorkJob.priority = -5 | ||
Bulkrax::ImportFileSetJob.priority = -15 | ||
Bulkrax::CreateRelationshipsJob.priority = -20 | ||
Bulkrax::ImporterJob.priority = -20 | ||
IiifPrint::Jobs::CreateRelationshipsJob.priority = -20 | ||
ContentDepositEventJob.priority = -50 | ||
ContentUpdateEventJob.priority = -50 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
config = YAML.load(ERB.new(IO.read(Rails.root + 'config' + 'redis.yml')).result)[Rails.env].with_indifferent_access | ||
redis_config = config.merge(thread_safe: true) | ||
if ENV.fetch('HYRAX_ACTIVE_JOB_QUEUE', 'sidekiq') == 'sidekiq' | ||
|
||
Sidekiq.configure_server do |s| | ||
s.redis = redis_config | ||
end | ||
config = YAML.load(ERB.new(IO.read(Rails.root + 'config' + 'redis.yml')).result)[Rails.env].with_indifferent_access | ||
redis_config = config.merge(thread_safe: true) | ||
|
||
Sidekiq.configure_server do |s| | ||
s.redis = redis_config | ||
end | ||
|
||
Sidekiq.configure_client do |s| | ||
s.redis = redis_config | ||
Sidekiq.configure_client do |s| | ||
s.redis = redis_config | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# frozen_string_literal: true | ||
class CreateGoodJobs < ActiveRecord::Migration[5.2] | ||
def change | ||
enable_extension 'pgcrypto' | ||
|
||
create_table :good_jobs, id: :uuid do |t| | ||
t.text :queue_name | ||
t.integer :priority | ||
t.jsonb :serialized_params | ||
t.timestamp :scheduled_at | ||
t.timestamp :performed_at | ||
t.timestamp :finished_at | ||
t.text :error | ||
|
||
t.timestamps | ||
|
||
t.uuid :active_job_id | ||
t.text :concurrency_key | ||
t.text :cron_key | ||
t.uuid :retried_good_job_id | ||
t.timestamp :cron_at | ||
end | ||
|
||
create_table :good_job_processes, id: :uuid do |t| | ||
t.timestamps | ||
t.jsonb :state | ||
end | ||
|
||
add_index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: "index_good_jobs_on_scheduled_at" | ||
add_index :good_jobs, [:queue_name, :scheduled_at], where: "(finished_at IS NULL)", name: :index_good_jobs_on_queue_name_and_scheduled_at | ||
add_index :good_jobs, [:active_job_id, :created_at], name: :index_good_jobs_on_active_job_id_and_created_at | ||
add_index :good_jobs, :concurrency_key, where: "(finished_at IS NULL)", name: :index_good_jobs_on_concurrency_key_when_unfinished | ||
add_index :good_jobs, [:cron_key, :created_at], name: :index_good_jobs_on_cron_key_and_created_at | ||
add_index :good_jobs, [:cron_key, :cron_at], name: :index_good_jobs_on_cron_key_and_cron_at, unique: true | ||
add_index :good_jobs, [:active_job_id], name: :index_good_jobs_on_active_job_id | ||
add_index :good_jobs, [:finished_at], where: "retried_good_job_id IS NULL AND finished_at IS NOT NULL", name: :index_good_jobs_jobs_on_finished_at | ||
end | ||
end |