Skip to content

Commit

Permalink
Takes and put the logic checking for the specific env variable into t…
Browse files Browse the repository at this point in the history
…he worker script. And only set that env variable in the importWorker so that the reg worker will just use the default or one set in the deployment extraEnvVars
  • Loading branch information
aprilrieger committed Feb 22, 2024
1 parent 65db11c commit 6870463
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions bin/worker
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ if ENV['AAPB_HOST']
%x{mkdir ~/.ssh && ssh-keyscan $AAPB_HOST >> ~/.ssh/known_hosts}
end

# Dynamically set SIDEKIQ_CONCURRENCY based on the worker type
if ENV['IMPORT_WORKER_SIDEKIQ_CONCURRENCY']
ENV['SIDEKIQ_CONCURRENCY'] = ENV.fetch('IMPORT_WORKER_SIDEKIQ_CONCURRENCY', '10')
end

queues = if !ARGV.empty?
' -q ' + ARGV.join(' -q ')
else
Expand Down
2 changes: 1 addition & 1 deletion hyrax/templates/import-deployment-worker.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.worker.enabled }}
{{- if .Values.importWorker.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
7 changes: 5 additions & 2 deletions ops/demo-deploy.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,12 @@ worker:
extraEnvVars: *envVars

importWorker:
enabled: true
# extraEnvVars will not handle overriden values
# only additional to the original workerEnvVars list
extraEnvVars:
- name: SIDEKIQ_CONCURRENCY
value: "10"
- name: IMPORT_WORKER_SIDEKIQ_CONCURRENCY
value: "20"

podSecurityContext:
runAsUser: 1001
Expand Down

0 comments on commit 6870463

Please sign in to comment.