openquake.engine package#

Subpackages#

Submodules#

openquake.engine.engine module#

Engine: A collection of fundamental functions for initializing and running calculations.

exception openquake.engine.engine.MasterKilled[source]#

Bases: KeyboardInterrupt

Exception raised when a job is killed manually

openquake.engine.engine.check_obsolete_version(calculation_mode='WebUI')[source]#

Check if there is a newer version of the engine.

Parameters:

calculation_mode

  • the calculation mode when called from the engine

  • an empty string when called from the WebUI

Returns:

  • a message if the running version of the engine is obsolete

  • the empty string if the engine is updated

  • None if the check could not be performed (i.e. github is down)

openquake.engine.engine.create_jobs(job_inis, log_level=20, log_file=None, user_name='runner', hc_id=None, host=None)[source]#

Create job records on the database.

Parameters:

job_inis – a list of pathnames or a list of dictionaries

Returns:

a list of LogContext objects

openquake.engine.engine.get_zmq_ports()[source]#
Returns:

an array with the receiver ports

openquake.engine.engine.manage_signals(job_id, signum, _stack)[source]#

Convert a SIGTERM into a SystemExit exception and a SIGINT/SIGHUP into a MasterKilled exception with an appropriate error message.

Parameters:
  • signum (int) – the number of the received signal

  • _stack – the current frame object, ignored

openquake.engine.engine.poll_queue(job_id, poll_time)[source]#

Check the queue of executing/submitted jobs and exit when there is a free slot.

openquake.engine.engine.register_signals(job_id)[source]#
openquake.engine.engine.run_calc(log)[source]#

Run a calculation.

Parameters:

log – LogContext of the current job

openquake.engine.engine.run_jobs(jobctxs, concurrent_jobs=None, nodes=1, sbatch=False, precalc=False)[source]#

Run jobs using the specified config file and other options.

Parameters:
  • jobctxs – List of LogContexts

  • concurrent_jobs – How many jobs to run concurrently (default num_cores/4)

openquake.engine.engine.set_concurrent_tasks_default(calc)[source]#

Look at the number of available workers and update the parameter OqParam.concurrent_tasks.default. Abort the calculations if no workers are available. Do nothing for trivial distributions.

openquake.engine.engine.start_workers(job_id, dist, nodes)[source]#

Start the workers via the DbServer or via slurm

openquake.engine.engine.stop_workers(job_id)[source]#

Stop the workers spawned by the current job via the WorkerMaster

openquake.engine.engine.version_triple(tag)[source]#

returns: a triple of integers from a version tag

Module contents#

OpenQuake is an open-source platform for the calculation of hazard and risk impact. It is a project of the Global Earthquake Model, and may be extended by other organizations to address additional classes of peril.

For more information, please see the website at http://www.globalquakemodel.org This software may be downloaded at gem/openquake

The continuous integration server is at

https://ci.openquake.org

Up-to-date sphinx documentation is at

http://docs.openquake.org

This software is licensed under the AGPL license, for more details please see the LICENSE file.

Copyright (C) 2010-2023 GEM Foundation

OpenQuake is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

OpenQuake is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with OpenQuake. If not, see <http://www.gnu.org/licenses/>.