From 623abe2746da19add303f100bcf51e439be3dc6d Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Mon, 19 Oct 2026 12:07:53 +0200 Subject: [PATCH 1/2] Remove the DbServer configuration and kubectl support - rename the [dbserver] section of openquake.cfg to [server] - rename the file key to dbfile and remove the unused port key - use config.server everywhere instead of config.dbserver - remove the kubectl submission path, the job.yaml template, the min_input_size key and the experimental k8s directory - remove the openquake-dbserver service handling from packager.sh, reset-db and tox.ini --- .../cluster/templates/openquake.zmq.cfg.j2 | 7 +-- debian/changelog | 5 ++ .../installation-instructions/cluster.md | 2 +- .../installation-instructions/server.md | 4 +- docker/openquake.cfg | 7 +-- install.py | 4 +- k8s/README.md | 13 ---- k8s/deploy-engine.yaml | 61 ------------------ k8s/openquake.cfg | 21 ------- openquake/baselib/__init__.py | 2 +- openquake/baselib/parallel.py | 10 +-- openquake/baselib/workerpool.py | 6 +- openquake/commands/engine.py | 2 +- openquake/commands/info.py | 2 +- openquake/commands/reset.py | 2 +- openquake/commands/run.py | 2 +- openquake/commands/webui.py | 2 +- openquake/commonlib/dbapi.py | 2 +- openquake/engine/engine.py | 4 +- openquake/engine/multiuser.cfg | 2 +- openquake/engine/openquake.cfg | 5 +- openquake/hazardlib/valid.py | 19 +----- openquake/server/job.yaml | 63 ------------------- openquake/server/services.py | 11 ---- openquake/server/settings.py | 4 +- openquake/server/views.py | 12 ---- packager.sh | 22 +------ tox.ini | 3 - utils/reset-db | 17 +---- 29 files changed, 40 insertions(+), 276 deletions(-) delete mode 100644 k8s/README.md delete mode 100644 k8s/deploy-engine.yaml delete mode 100644 k8s/openquake.cfg delete mode 100644 openquake/server/job.yaml diff --git a/ansible/cluster/templates/openquake.zmq.cfg.j2 b/ansible/cluster/templates/openquake.zmq.cfg.j2 index 64c3fefd05a3..a1a1d229a8a0 100644 --- a/ansible/cluster/templates/openquake.zmq.cfg.j2 +++ b/ansible/cluster/templates/openquake.zmq.cfg.j2 @@ -26,8 +26,8 @@ soft_mem_limit = 90 # use a lower value to protect against loss of control when OOM occurs hard_mem_limit = 98 -[dbserver] -file = {{ workdir_services }}/oqdata/db.sqlite3 +[server] +dbfile = {{ workdir_services }}/oqdata/db.sqlite3 # daemon bind address; must be a valid IP address # example: 0.0.0.0 listen = {{ server_host }} @@ -36,9 +36,6 @@ listen = {{ server_host }} # of the master node (on the master node cfg too) # example: master.hpc host = {{ server_host }} -# port 1908 has a good reputation: -# https://isc.sans.edu/port.html?port=1908 -port = 1908 # port range used by workers to send back results # to the master node receiver_ports = 1921-1930 diff --git a/debian/changelog b/debian/changelog index 64b3adfa3fde..90b2d1241e13 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,9 @@ [Michele Simionato] + * Internal: the `[dbserver]` section of openquake.cfg has been renamed + to `[server]`, the `file` key is now `dbfile` and the unused `port` + key has been removed. Update existing configuration files accordingly. + The leftover `openquake-dbserver` service handling in the packaging + and reset-db scripts has been removed as well * Internal: the `host_cores` entries of the `[zworkers]` section can now specify a port, as in `127.0.0.1:1910 4`, so that several workerpools can run on the same host; `oq workers status` shows each pool as diff --git a/doc/getting-started/installation-instructions/cluster.md b/doc/getting-started/installation-instructions/cluster.md index e1777080df98..abd4067af783 100644 --- a/doc/getting-started/installation-instructions/cluster.md +++ b/doc/getting-started/installation-instructions/cluster.md @@ -117,7 +117,7 @@ The following file (on all nodes) should be modified to enable # enable celery only if you have a cluster oq_distribute = zmq -[dbserver] +[server] # address of the dbserver # on multi-node cluster it must be the IP or hostname # of the master node (on the master node cfg too) diff --git a/doc/getting-started/installation-instructions/server.md b/doc/getting-started/installation-instructions/server.md index 783966f281ec..ab81df6dcf76 100644 --- a/doc/getting-started/installation-instructions/server.md +++ b/doc/getting-started/installation-instructions/server.md @@ -63,9 +63,9 @@ since the universal installer already writes in the `openquake.cfg` file a section ``` -[dbserver] +[server] host = localhost -file = /path/to/db.sqlite3 +dbfile = /path/to/db.sqlite3 ``` If the database is on a different machine, you have to edit the file and diff --git a/docker/openquake.cfg b/docker/openquake.cfg index db70fff1cf2e..09dd22320f57 100644 --- a/docker/openquake.cfg +++ b/docker/openquake.cfg @@ -28,8 +28,8 @@ soft_mem_limit = 90 # use a lower value to protect against loss of control when OOM occurs hard_mem_limit = 98 -[dbserver] -file = /home/openquake/oqdata/db.sqlite3 +[server] +dbfile = /home/openquake/oqdata/db.sqlite3 # daemon bind address; must be a valid IP address # example: 0.0.0.0 listen = 127.0.0.1 @@ -38,9 +38,6 @@ listen = 127.0.0.1 # of the master node (on the master node cfg too) # example: master.hpc host = 127.0.0.1 -# port 1908 has a good reputation: -# https://isc.sans.edu/port.html?port=1908 -port = 1908 # port range used by workers to send back results # to the master node receiver_ports = 1921-1930 diff --git a/install.py b/install.py index 802903dbcf7e..4f642b96c3fb 100644 --- a/install.py +++ b/install.py @@ -100,9 +100,9 @@ class server: OQ = "/usr/bin/oq" OQDATA = "/opt/openquake/oqdata" DBPATH = os.path.join(OQDATA, "db.sqlite3") - CONFIG = f"""[dbserver] + CONFIG = f"""[server] host = localhost - file = {DBPATH} + dbfile = {DBPATH} [directory] """ USER = "openquake" diff --git a/k8s/README.md b/k8s/README.md deleted file mode 100644 index 4ed8b8f8edb1..000000000000 --- a/k8s/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# OpenQuake Kubernetes Deployments - -## End user documentation - -This page contain the first deployments of the engine for Kubernetes. These are experimental and not to use for production. - -deploy-engine.yaml : deployment of one engine from nightly docker image - - -## - -The main documentation, intended for end users on docker container, is available under the [documentation area](../doc/installing/docker.md) -## diff --git a/k8s/deploy-engine.yaml b/k8s/deploy-engine.yaml deleted file mode 100644 index a32f21d0fce7..000000000000 --- a/k8s/deploy-engine.yaml +++ /dev/null @@ -1,61 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: master - labels: - app: master -spec: - replicas: 2 - selector: - matchLabels: - app: master - template: - metadata: - labels: - app: master - spec: - securityContext: - runAsUser: 1000 - runAsGroup: 1000 - fsGroup: 1000 - containers: - - name: master - image: openquake/engine:nightly - imagePullPolicy: Always - #resources: - # limits: - # memory: "8Gi" - # cpu: "8" - # requests: - # memory: "24Gi" - # cpu: "6" - env: - - name: OQ_CONFIG_FILE - value: /opt/openquake/venv/openquake.cfg - - name: HOME - value: /opt/openquake - - name: PATH - value: /opt/openquake/venv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - - name: OQ_WORKER_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: OQ_WORKER_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - volumeMounts: - - mountPath: "/opt/openquake" - name: azure - readOnly: false - volumes: - - name: azure - persistentVolumeClaim: - claimName: nfsdata - nodeSelector: - vCpu: AMD - tolerations: - - key: "kubernetes.azure.com/scalesetpriority" - operator: "Equal" - value: "spot" - effect: "NoSchedule" diff --git a/k8s/openquake.cfg b/k8s/openquake.cfg deleted file mode 100644 index 9cd5942b6ef7..000000000000 --- a/k8s/openquake.cfg +++ /dev/null @@ -1,21 +0,0 @@ -[dbserver] -host = # IP of Master VM -listen = # IP of Master VM -port = 1908 -file = /opt/openquake/oqdata/db.sqlite3 - - -[distribution] -serialize_jobs = 5 -# num_cores = 1 -# log level for jobs spawned by the WebAPI -log_level = info -# External command -submit_cmd = kubectl apply -f - -min_input_size = 1 -# -[directory] -shared_dir = /opt/openquake -mosaic = /opt/openquake/mosaic -custom_tmp = /opt/openquake/tmp -# diff --git a/openquake/baselib/__init__.py b/openquake/baselib/__init__.py index b8c03d118432..1afe1b274f81 100644 --- a/openquake/baselib/__init__.py +++ b/openquake/baselib/__init__.py @@ -126,7 +126,7 @@ def read(*paths, **validators): def multi_user(): - return config.dbserver.host != '127.0.0.1' + return config.server.host != '127.0.0.1' def use_server(): diff --git a/openquake/baselib/parallel.py b/openquake/baselib/parallel.py index 068ef8a72678..bf873bdcced4 100644 --- a/openquake/baselib/parallel.py +++ b/openquake/baselib/parallel.py @@ -457,10 +457,10 @@ def new(cls, func, args, mon, sentbytes=0): 'The master is at version %s while the worker %s is at ' 'version %s' % (mon.version, socket.gethostname(), engine_version())) - if mon.database_host != config.dbserver.host: + if mon.database_host != config.server.host: raise RuntimeError( 'The worker has database.host=%s while the master has %s' - % (mon.database_host, config.dbserver.host)) + % (mon.database_host, config.server.host)) with mon: val = func(*args) except StopIteration: @@ -847,7 +847,7 @@ def __init__(self, task_func, task_args=(), distribute=None, h5 = hdf5.File(gettemp(suffix='.hdf5'), 'w') init_performance(h5) self.name = task_func.__name__ - self.monitor = Monitor(self.name, database_host=config.dbserver.host) + self.monitor = Monitor(self.name, database_host=config.server.host) self.monitor.filename = h5.filename self.monitor.calc_id = self.calc_id if distribute == 'zmq': @@ -864,11 +864,11 @@ def __init__(self, task_func, task_args=(), distribute=None, self.sent = AccumDict(accum=AccumDict()) # fname -> argname -> nbytes self.monitor.inject = (self.argnames[-1].startswith('mon') or self.argnames[-1].endswith('mon')) - self.receiver = 'tcp://0.0.0.0:%s' % config.dbserver.receiver_ports + self.receiver = 'tcp://0.0.0.0:%s' % config.server.receiver_ports if self.distribute in ('no', 'processpool') or sys.platform != 'linux': self.return_ip = '127.0.0.1' # zmq returns data to localhost else: # zmq returns data to the receiver_host - self.return_ip = get_return_ip(config.dbserver.receiver_host) + self.return_ip = get_return_ip(config.server.receiver_host) logging.debug(f'{self.return_ip=}') self.monitor.backurl = None # overridden later self.tasks = {} # populated by .submit diff --git a/openquake/baselib/workerpool.py b/openquake/baselib/workerpool.py index d535e7515f54..f76c53113fd6 100644 --- a/openquake/baselib/workerpool.py +++ b/openquake/baselib/workerpool.py @@ -213,12 +213,12 @@ def debug(self): self.start() try: mon = performance.Monitor( - 'zmq-debug', database_host=config.dbserver.host) + 'zmq-debug', database_host=config.server.host) mon.inject = True - rec_host = (config.dbserver.receiver_host or config.dbserver.host + rec_host = (config.server.receiver_host or config.server.host or '127.0.0.1') receiver = 'tcp://%s:%s' % ( - rec_host, config.dbserver.receiver_ports) + rec_host, config.server.receiver_ports) ntasks = len(self.host_cores) * 2 task_no = 0 with z.Socket(receiver, z.zmq.PULL, 'bind') as pull: diff --git a/openquake/commands/engine.py b/openquake/commands/engine.py index e9c0a8d34ea5..9ae9e58dbf42 100644 --- a/openquake/commands/engine.py +++ b/openquake/commands/engine.py @@ -119,7 +119,7 @@ def main( if not os.path.exists(datadir): os.makedirs(datadir) - fname = os.path.expanduser(config.dbserver.file) + fname = os.path.expanduser(config.server.dbfile) if not os.path.exists(fname): upgrade_db = True # automatically creates the db diff --git a/openquake/commands/info.py b/openquake/commands/info.py index be8037bb3475..94d43ca7cf41 100644 --- a/openquake/commands/info.py +++ b/openquake/commands/info.py @@ -318,7 +318,7 @@ def main(what, report=False): elif what.startswith('geohash'): print_geohash(what) elif what == 'db': - print(config.dbserver.file) + print(config.server.dbfile) elif what == 'venv': print(sys.prefix) elif what == 'cfg': diff --git a/openquake/commands/reset.py b/openquake/commands/reset.py index 103ae45a4b48..87720867a4f7 100644 --- a/openquake/commands/reset.py +++ b/openquake/commands/reset.py @@ -32,7 +32,7 @@ def main(yes=False): if not ok: return - dbpath = os.path.realpath(os.path.expanduser(config.dbserver.file)) + dbpath = os.path.realpath(os.path.expanduser(config.server.dbfile)) if not os.path.isfile(dbpath): sys.exit('%s does not exist' % dbpath) else: diff --git a/openquake/commands/run.py b/openquake/commands/run.py index ef571ed14bf6..4538f33278da 100644 --- a/openquake/commands/run.py +++ b/openquake/commands/run.py @@ -88,7 +88,7 @@ def main(job_ini, """ user_name = getpass.getuser() - dbfile = os.path.expanduser(config.dbserver.file) + dbfile = os.path.expanduser(config.server.dbfile) if not os.path.exists(dbfile): db.actions.upgrade_db(dbapi.db) try: diff --git a/openquake/commands/webui.py b/openquake/commands/webui.py index 962e2c095972..1edd5eed9834 100644 --- a/openquake/commands/webui.py +++ b/openquake/commands/webui.py @@ -113,7 +113,7 @@ def main(cmd, hostport='127.0.0.1:8800', skip_browser: bool = False): api_host = '127.0.0.1' os.environ.setdefault( 'OQ_WEBAPI_SERVER', 'http://%s:%s' % (api_host, api_port)) - dbpath = os.path.realpath(os.path.expanduser(config.dbserver.file)) + dbpath = os.path.realpath(os.path.expanduser(config.server.dbfile)) if os.path.isfile(dbpath) and not os.access(dbpath, os.W_OK): sys.exit('This command must be run by the proper user: ' 'see the documentation for details') diff --git a/openquake/commonlib/dbapi.py b/openquake/commonlib/dbapi.py index ea59fcb4a722..d10c1ba397cc 100644 --- a/openquake/commonlib/dbapi.py +++ b/openquake/commonlib/dbapi.py @@ -453,7 +453,7 @@ def __repr__(self): # datetime.datetime, lambda val: val.isoformat()) # sqlite3.register_converter( # "datetime", lambda val: datetime.datetime.fromisoformat(val.decode())) -db = Db(sqlite3.connect, os.path.expanduser(config.dbserver.file), +db = Db(sqlite3.connect, os.path.expanduser(config.server.dbfile), isolation_level=None, detect_types=sqlite3.PARSE_DECLTYPES, timeout=20) # NB: I am increasing the timeout from 5 to 20 seconds and the random diff --git a/openquake/engine/engine.py b/openquake/engine/engine.py index 6ed977a5faa6..845c1450e859 100644 --- a/openquake/engine/engine.py +++ b/openquake/engine/engine.py @@ -68,7 +68,7 @@ def get_zmq_ports(): """ :returns: an array with the receiver ports """ - start, stop = config.dbserver.receiver_ports.split('-') + start, stop = config.server.receiver_ports.split('-') return numpy.arange(int(start), int(stop)) @@ -476,7 +476,7 @@ def check_obsolete_version(calculation_mode='WebUI'): if __name__ == '__main__': - # run LogContexts stored in jobs.pik, called by job.yaml or slurm + # run LogContexts stored in jobs.pik, called by submit_cmd or slurm with open(sys.argv[1], 'rb') as f: jobctxs = pickle.load(f) try: diff --git a/openquake/engine/multiuser.cfg b/openquake/engine/multiuser.cfg index 47b247093a8e..42024ca62001 100644 --- a/openquake/engine/multiuser.cfg +++ b/openquake/engine/multiuser.cfg @@ -13,7 +13,7 @@ # You should have received a copy of the GNU Affero General Public License # along with OpenQuake. If not, see . -[dbserver] +[server] host = localhost [webapi] diff --git a/openquake/engine/openquake.cfg b/openquake/engine/openquake.cfg index 2e9062fa8ca5..b3a8123a3433 100644 --- a/openquake/engine/openquake.cfg +++ b/openquake/engine/openquake.cfg @@ -20,7 +20,6 @@ serialize_jobs = 1 # num_cores = 1 # log level for jobs spawned by the WebAPI log_level = info -min_input_size = 1_000_000 compress = # slurm parameters @@ -70,8 +69,8 @@ max_multi_fault_ruptures = 2000 # limit for num_sites * num_events max_potential_gmfs = 1E12 -[dbserver] -file = ~/oqdata/db.sqlite3 +[server] +dbfile = ~/oqdata/db.sqlite3 # address of the dbserver # on multi-node cluster it must be the IP or hostname # of the master node (on the master node cfg too) diff --git a/openquake/hazardlib/valid.py b/openquake/hazardlib/valid.py index 3744740a9b5d..743ae2d17770 100644 --- a/openquake/hazardlib/valid.py +++ b/openquake/hazardlib/valid.py @@ -26,14 +26,13 @@ import json import string import toml -import socket import logging import inspect from functools import partial import numpy from openquake.baselib.general import distinct, pprod -from openquake.baselib import config, hdf5 +from openquake.baselib import hdf5 from openquake.hazardlib import imt, scalerel, gsim, pmf, site, tom from openquake.hazardlib.codes import SOURCE_CODES from openquake.hazardlib.gsim.base import registry, gsim_aliases, fix_toml @@ -1338,22 +1337,6 @@ def uncertainty_model(value): return ' '.join(value.split()) # remove newlines too -def host_port(value=None): - """ - Returns a pair (host_IP, port_number). - - >>> host_port('localhost:1908') - ('127.0.0.1', 1908) - - If value is missing returns the parameters in openquake.cfg - """ - if not value: - host = os.environ.get('OQ_DATABASE', config.dbserver.host) - return (host, config.dbserver.port) - host, port = value.split(':') - return socket.gethostbyname(host), int(port) - - # used for the exposure validation cost_type_type = Choice('aggregated', 'per_area', 'per_asset') diff --git a/openquake/server/job.yaml b/openquake/server/job.yaml deleted file mode 100644 index bd4f25704319..000000000000 --- a/openquake/server/job.yaml +++ /dev/null @@ -1,63 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: ${CALC_NAME} -spec: - ttlSecondsAfterFinished: 60 - #activeDeadlineSeconds: 60 - template: - metadata: - name: worker - spec: - securityContext: - runAsUser: 1000 - runAsGroup: 1000 - fsGroup: 1000 - containers: - - name: worker - image: openquake/engine:nightly - imagePullPolicy: Always - #resources: - # limits: - # memory: "8Gi" - # cpu: "8" - # requests: - # memory: "24Gi" - # cpu: "6" - env: - - name: OQ_CONFIG_FILE - value: /opt/openquake/venv/openquake.cfg - #- name: HDF5_USE_FILE_LOCKING - # value: "FALSE" - - name: HOME - value: /opt/openquake - - name: PATH - value: /opt/openquake/venv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - - name: OQ_WORKER_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: OQ_WORKER_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - ports: # need for svc - - containerPort: 1909 - command: ["/bin/sh"] - args: ["-c", "python -m openquake.engine.engine ${CALC_PIK}"] - volumeMounts: - - mountPath: "/opt/openquake" - name: azure - readOnly: false - volumes: - - name: azure - persistentVolumeClaim: - claimName: nfsdata - restartPolicy: Never - nodeSelector: - vCpu: AMD - tolerations: - - key: "kubernetes.azure.com/scalesetpriority" - operator: "Equal" - value: "spot" - effect: "NoSchedule" diff --git a/openquake/server/services.py b/openquake/server/services.py index 22a2967e5c11..e003208b6075 100644 --- a/openquake/server/services.py +++ b/openquake/server/services.py @@ -8,7 +8,6 @@ import os import pickle import shutil -import string import subprocess import sys import tempfile @@ -54,8 +53,6 @@ def get_impact_rupture_data(post, user, rupture_path): return rupdic, 200 -CWD = os.path.dirname(__file__) -KUBECTL = 'kubectl apply -f -'.split() ENGINE = 'python -m openquake.engine.engine'.split() XML = 'application/xml' @@ -181,16 +178,8 @@ def submit_job(request_files, ini, username, hc_id, notify_to=None): raise custom_tmp = os.path.dirname(job_ini) submit_cmd = config.distribution.submit_cmd.split() - big_job = oq.get_input_size() > int(config.distribution.min_input_size) if submit_cmd == ENGINE: subprocess.Popen(submit_cmd + [save_pik(job, custom_tmp)]) - elif submit_cmd == KUBECTL and big_job: - with open(os.path.join(CWD, 'job.yaml')) as fobj: - yaml = string.Template(fobj.read()).substitute( - DATABASE='%(host)s:%(port)d' % config.dbserver, - CALC_PIK=save_pik(job, custom_tmp), - CALC_NAME='calc%d' % job.calc_id) - subprocess.run(submit_cmd, input=yaml.encode('ascii')) else: kwargs = {'notify_to': notify_to} if notify_to is not None else {} proc = mp.Process(target=engine.run_jobs, args=([job], 1), diff --git a/openquake/server/settings.py b/openquake/server/settings.py index bad3a1ed3cf8..d462f1e8f430 100644 --- a/openquake/server/settings.py +++ b/openquake/server/settings.py @@ -87,9 +87,9 @@ DATABASE = { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.expanduser(config.dbserver.file), + 'NAME': os.path.expanduser(config.server.dbfile), 'USER': getpass.getuser(), - 'HOST': config.dbserver.host, + 'HOST': config.server.host, } DATABASES = {'default': DATABASE} diff --git a/openquake/server/views.py b/openquake/server/views.py index 36ca6ae0ec50..0f71ed8fcf9d 100644 --- a/openquake/server/views.py +++ b/openquake/server/views.py @@ -21,7 +21,6 @@ import csv import shutil import json -import string import pickle import logging import os @@ -82,7 +81,6 @@ from django.contrib.auth import authenticate, login, logout UTC = timezone.utc -CWD = os.path.dirname(__file__) METHOD_NOT_ALLOWED = 405 NOT_IMPLEMENTED = 501 @@ -99,7 +97,6 @@ 'Access-Control-Max-Age': 1000, 'Access-Control-Allow-Headers': '*'} -KUBECTL = "kubectl apply -f -".split() ENGINE = "python -m openquake.engine.engine".split() AELO_FORM_LABELS = { @@ -1601,18 +1598,9 @@ def submit_job(request_files, ini, username, hc_id, notify_to=None): custom_tmp = os.path.dirname(job_ini) submit_cmd = config.distribution.submit_cmd.split() - big_job = oq.get_input_size() > int(config.distribution.min_input_size) if submit_cmd == ENGINE: # used for debugging for job in jobs: subprocess.Popen(submit_cmd + [save_pik(job, custom_tmp)]) - elif submit_cmd == KUBECTL and big_job: - for job in jobs: - with open(os.path.join(CWD, 'job.yaml')) as f: - yaml = string.Template(f.read()).substitute( - DATABASE='%(host)s:%(port)d' % config.dbserver, - CALC_PIK=save_pik(job, custom_tmp), - CALC_NAME='calc%d' % job.calc_id) - subprocess.run(submit_cmd, input=yaml.encode('ascii')) else: kwargs = {} if notify_to is not None: diff --git a/packager.sh b/packager.sh index 253c4daef3ab..d6e3b1ee6682 100755 --- a/packager.sh +++ b/packager.sh @@ -98,7 +98,6 @@ sig_hand () { echo "signal trapped" if [ "$lxc_name" != "" ]; then set +e - scp "${lxc_ip}:/tmp/dbserver.log" "out_${BUILD_UBUVER}/" scp "${lxc_ip}:ssh.log" "out_${BUILD_UBUVER}/ssh.history" echo "Destroying [$lxc_name] lxc" sudo $LXC_KILL -n "$lxc_name" @@ -698,9 +697,7 @@ _devtest_innervm_run () { # configure the machine to run tests if [ -z "$GEM_DEVTEST_SKIP_TESTS" ]; then ssh "$lxc_ip" "set -e - export PYTHONPATH=\"\$PWD/oq-engine\" - echo 'Starting DbServer. Log is saved to /tmp/dbserver.log' - cd oq-engine; nohup /opt/openquake/bin/python3 bin/oq dbserver start &>/tmp/dbserver.log &2 - exit 1 - fi -} - getdbpath() { local OQ_CFG='/etc/openquake/openquake.cfg' if [ -f $OQ_CFG ]; then - grep 'file = ' $OQ_CFG | tr -d ' ' | cut -d '=' -f 2 + grep 'dbfile = ' $OQ_CFG | tr -d ' ' | cut -d '=' -f 2 else echo -e "!! Configuration file not found. Aborting." >&2 exit 1 @@ -110,13 +98,10 @@ echo '' echo '' if [[ "$answer" == "y" ]]; then - echo " * OpenQuake Engine DbServer stopped" - startstop stop rm $(getdbpath) echo " * Database dropped" find /home -maxdepth 2 -type d -name "oqdata" -exec rm -Rf '{}' \; || true if [ -z $skipnew ]; then - startstop start echo " * Migrating schema" cd /usr/share/openquake/engine || true python3 -m openquake.server.manage migrate From c7678bb8e2887d9a06b71f7c81260727429d6ecd Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Mon, 19 Oct 2026 12:16:39 +0200 Subject: [PATCH 2/2] Document the removal of the [dbserver] section Add a warning in the server and cluster installation docs and in the dev release notes: from version 3.27 the settings live in [server] (file is now dbfile, port is removed), while versions up to 3.26, including the LTS 3.23, still use [dbserver]. --- .../installation-instructions/cluster.md | 14 ++++++++++++++ .../installation-instructions/server.md | 14 ++++++++++++++ doc/release-notes/whats-new.md | 14 ++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/doc/getting-started/installation-instructions/cluster.md b/doc/getting-started/installation-instructions/cluster.md index abd4067af783..eeccbdf39751 100644 --- a/doc/getting-started/installation-instructions/cluster.md +++ b/doc/getting-started/installation-instructions/cluster.md @@ -105,6 +105,20 @@ need to install anything on the worker nodes except Python. ## OpenQuake Engine 'master' node configuration File +```{warning} +The `[dbserver]` section of `openquake.cfg` does not exist anymore. +Starting from version 3.27 its keys live in the `[server]` section: + +- `host`, `receiver_host` and `receiver_ports` keep their names; +- `file` has been renamed `dbfile`; +- the `port` key has been removed; +- the `oq dbserver` command and the DbServer daemon have been removed. + +Versions up to 3.26, including the LTS release 3.23, still use the +`[dbserver]` section with the `file` key, so the configuration files +must be updated when upgrading. +``` + ### Enable zmq distribution The following file (on all nodes) should be modified to enable diff --git a/doc/getting-started/installation-instructions/server.md b/doc/getting-started/installation-instructions/server.md index ab81df6dcf76..45eebe296130 100644 --- a/doc/getting-started/installation-instructions/server.md +++ b/doc/getting-started/installation-instructions/server.md @@ -56,6 +56,20 @@ sudo mkdir /var/log/oq-engine sudo chown -R openquake /var/log/oq-engine ``` +```{warning} +The `[dbserver]` section of `openquake.cfg` does not exist anymore. +Starting from version 3.27 its keys live in the `[server]` section: + +- `host`, `receiver_host` and `receiver_ports` keep their names; +- `file` has been renamed `dbfile`; +- the `port` key has been removed; +- the `oq dbserver` command and the DbServer daemon have been removed. + +Versions up to 3.26, including the LTS release 3.23, still use the +`[dbserver]` section with the `file` key, so the configuration files +must be updated when upgrading. +``` + #### Configuring the database host If the database file is on the local machine, there is nothing to do diff --git a/doc/release-notes/whats-new.md b/doc/release-notes/whats-new.md index c94f8f36e15f..4690fc1a1696 100644 --- a/doc/release-notes/whats-new.md +++ b/doc/release-notes/whats-new.md @@ -1,2 +1,16 @@ Release notes (dev) =================== + +```{warning} +The `[dbserver]` section of `openquake.cfg` does not exist anymore. +Starting from version 3.27 its keys live in the `[server]` section: + +- `host`, `receiver_host` and `receiver_ports` keep their names; +- `file` has been renamed `dbfile`; +- the `port` key has been removed; +- the `oq dbserver` command and the DbServer daemon have been removed. + +Versions up to 3.26, including the LTS release 3.23, still use the +`[dbserver]` section with the `file` key, so the configuration files +must be updated when upgrading. +```