Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions ansible/cluster/templates/openquake.zmq.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 15 additions & 1 deletion doc/getting-started/installation-instructions/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -117,7 +131,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)
Expand Down
18 changes: 16 additions & 2 deletions doc/getting-started/installation-instructions/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,30 @@ 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
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
Expand Down
14 changes: 14 additions & 0 deletions doc/release-notes/whats-new.md
Original file line number Diff line number Diff line change
@@ -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.
```
7 changes: 2 additions & 5 deletions docker/openquake.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 0 additions & 13 deletions k8s/README.md

This file was deleted.

61 changes: 0 additions & 61 deletions k8s/deploy-engine.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions k8s/openquake.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion openquake/baselib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
10 changes: 5 additions & 5 deletions openquake/baselib/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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':
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions openquake/baselib/workerpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion openquake/commands/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion openquake/commands/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
2 changes: 1 addition & 1 deletion openquake/commands/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion openquake/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion openquake/commands/webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion openquake/commonlib/dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions openquake/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"""
: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))


Expand Down Expand Up @@ -115,7 +115,7 @@
:param _stack: the current frame object, ignored
"""
if signum == signal.SIGINT:
raise MasterKilled('The oq-job process was killed manually')

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, firefox)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, firefox)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, firefox)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, firefox)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, firefox)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, firefox)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, firefox)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, firefox)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, chromium)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, chromium)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, chromium)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, chromium)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, chromium)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, chromium)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, chromium)

The oq-job process was killed manually

Check failure on line 118 in openquake/engine/engine.py

View workflow job for this annotation

GitHub Actions / server_UI (ubuntu-24.04, 3.11, chromium)

The oq-job process was killed manually

if signum == signal.SIGTERM:
sys.exit(f'Killed {job_id}')
Expand Down Expand Up @@ -476,7 +476,7 @@


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:
Expand Down
2 changes: 1 addition & 1 deletion openquake/engine/multiuser.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with OpenQuake. If not, see <http://www.gnu.org/licenses/>.

[dbserver]
[server]
host = localhost

[webapi]
Expand Down
Loading
Loading