File tree Expand file tree Collapse file tree 4 files changed +39
-10
lines changed Expand file tree Collapse file tree 4 files changed +39
-10
lines changed Original file line number Diff line number Diff line change 1
1
0.10.2
2
+ - enh: include DCOR worker configuration
2
3
- update compatible versions
3
4
0.10.1
4
5
- fix: add ckanext.dc_serve.tmp_dir, a temporary data location for
Original file line number Diff line number Diff line change
1
+ from pkg_resources import resource_filename
1
2
import subprocess as sp
2
3
3
4
import click
8
9
9
10
def check_supervisord (autocorrect ):
10
11
"""Check whether the separate dcor worker files exist"""
12
+ path_worker = resource_filename (
13
+ "dcor_control.resources.config" ,
14
+ "etc_supervisor_conf.d_ckan-worker-dcor.conf" )
15
+ template = path_worker .read_text ()
16
+
11
17
svd_path = get_supervisord_worker_config_path ()
12
18
for worker in ["long" , "normal" , "short" ]:
13
- wpath = svd_path .with_name ("ckan-worker-dcor-{}.conf" . format ( worker ) )
19
+ wpath = svd_path .with_name (f "ckan-worker-dcor-{ worker } .conf" )
14
20
if not wpath .exists ():
15
21
if autocorrect :
16
22
wcr = True
17
- print ("Creating '{}'." . format ( wpath ) )
23
+ print (f "Creating '{ wpath } '." )
18
24
else :
19
- wcr = ask ("Supervisord entry 'dcor-{}' missing" . format ( worker ) )
25
+ wcr = ask (f "Supervisord entry 'dcor-{ worker } ' missing" )
20
26
if wcr :
21
- data = svd_path .read_text ()
22
- data = data .replace (
23
- "[program:ckan-worker]" ,
24
- "[program:ckan-ckan-worker-dcor-{}]" .format (worker ))
25
- data = data .replace (
26
- "/ckan.ini jobs worker" ,
27
- "/ckan.ini jobs worker dcor-{}" .format (worker ))
27
+ data = template .replace ("{{QUEUE}}" , f"dcor-{ worker } " )
28
28
wpath .write_text (data )
29
29
30
30
Original file line number Diff line number Diff line change
1
+ [program:ckan-worker-{{QUEUE}}]
2
+
3
+ environment=CKAN_INI=/etc/ckan/default/ckan.ini,PYTHONUNBUFFERED=1
4
+ command=/usr/lib/ckan/default/bin/ckan -c /etc/ckan/default/ckan.ini jobs worker {{QUEUE}}
5
+
6
+ user=www-data
7
+
8
+ ; Start just a single worker. Increase this number if you have many or
9
+ ; particularly long running background jobs.
10
+ numprocs=1
11
+ process_name=%(program_name)s-%(process_num)02d
12
+
13
+ ; Log files
14
+ stdout_logfile=/var/log/ckan/ckan-worker-{{QUEUE}}.stdout.log
15
+ stderr_logfile=/var/log/ckan/ckan-worker-{{QUEUE}}.stderr.log
16
+
17
+ ; Make sure that the worker is started on system start and automatically
18
+ ; restarted if it crashes unexpectedly.
19
+ autostart=true
20
+ autorestart=true
21
+
22
+ ; Number of seconds the process has to run before it is considered to have
23
+ ; started successfully.
24
+ startsecs=10
25
+
26
+ ; Need to wait for currently executing tasks to finish at shutdown.
27
+ ; Increase this if you have very long running tasks.
28
+ stopwaitsecs=60
You can’t perform that action at this time.
0 commit comments