Skip to content

Commit

Permalink
enh: include DCOR worker configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Apr 20, 2024
1 parent b012a55 commit bf6a90e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
0.10.2
- enh: include DCOR worker configuration
- update compatible versions
0.10.1
- fix: add ckanext.dc_serve.tmp_dir, a temporary data location for
Expand Down
20 changes: 10 additions & 10 deletions dcor_control/inspect/config_supervisord.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pkg_resources import resource_filename
import subprocess as sp

import click
Expand All @@ -8,23 +9,22 @@

def check_supervisord(autocorrect):
"""Check whether the separate dcor worker files exist"""
path_worker = resource_filename(
"dcor_control.resources.config",
"etc_supervisor_conf.d_ckan-worker-dcor.conf")
template = path_worker.read_text()

svd_path = get_supervisord_worker_config_path()
for worker in ["long", "normal", "short"]:
wpath = svd_path.with_name("ckan-worker-dcor-{}.conf".format(worker))
wpath = svd_path.with_name(f"ckan-worker-dcor-{worker}.conf")
if not wpath.exists():
if autocorrect:
wcr = True
print("Creating '{}'.".format(wpath))
print(f"Creating '{wpath}'.")
else:
wcr = ask("Supervisord entry 'dcor-{}' missing".format(worker))
wcr = ask(f"Supervisord entry 'dcor-{worker}' missing")
if wcr:
data = svd_path.read_text()
data = data.replace(
"[program:ckan-worker]",
"[program:ckan-ckan-worker-dcor-{}]".format(worker))
data = data.replace(
"/ckan.ini jobs worker",
"/ckan.ini jobs worker dcor-{}".format(worker))
data = template.replace("{{QUEUE}}", f"dcor-{worker}")
wpath.write_text(data)


Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[program:ckan-worker-{{QUEUE}}]

environment=CKAN_INI=/etc/ckan/default/ckan.ini,PYTHONUNBUFFERED=1
command=/usr/lib/ckan/default/bin/ckan -c /etc/ckan/default/ckan.ini jobs worker {{QUEUE}}

user=www-data

; Start just a single worker. Increase this number if you have many or
; particularly long running background jobs.
numprocs=1
process_name=%(program_name)s-%(process_num)02d

; Log files
stdout_logfile=/var/log/ckan/ckan-worker-{{QUEUE}}.stdout.log
stderr_logfile=/var/log/ckan/ckan-worker-{{QUEUE}}.stderr.log

; Make sure that the worker is started on system start and automatically
; restarted if it crashes unexpectedly.
autostart=true
autorestart=true

; Number of seconds the process has to run before it is considered to have
; started successfully.
startsecs=10

; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs=60

0 comments on commit bf6a90e

Please sign in to comment.