Skip to content

Commit

Permalink
add okcomputer check for number of workers
Browse files Browse the repository at this point in the history
  • Loading branch information
ndushay committed Mar 17, 2020
1 parent 659d173 commit 5909f9b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions config/initializers/okcomputer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,21 @@ def check
# Confirm job_output_parent_dir exists (or else jobs cannot output)
OkComputer::Registry.register 'feature-job_output_parent_dir', DirectoryExistsCheck.new(Settings.job_output_parent_dir)

# check for the right number of workers
class WorkerCountCheck < OkComputer::Check
def check
expected_count = Settings.exp_worker_count
actual_count = Resque.workers.count
message = "#{actual_count} out of expected #{expected_count} workers are up."
if actual_count >= expected_count
mark_message message
else
mark_failure
mark_message "only #{message}"
end
end
OkComputer::Registry.register 'feature-worker-count', WorkerCountCheck.new
end

# To make checks optional:
# OkComputer.make_optional %w[feature-resque-down]
3 changes: 2 additions & 1 deletion config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ DOR_SERVICES:
URL: 'http://localhost:3003'
TOKEN: 'secret-token'


workflow_url: 'https://workflow-env.stanford.edu/workflow'
workflow:
logfile: 'log/workflow_service.log'
shift_age: 'weekly'
timeout: 60

exp_worker_count: 5 # for okcomputer endpoint

0 comments on commit 5909f9b

Please sign in to comment.