openquake.server package#

Subpackages#

Submodules#

openquake.server.dbserver module#

class openquake.server.dbserver.DbServer(db, address, num_workers=5)[source]#

Bases: object

A server collecting the received commands into a queue

dworker(sock)[source]#
start()[source]#

Start database worker threads

stop()[source]#

Stop the DbServer

openquake.server.dbserver.check_foreign()[source]#

Check if we the DbServer is the right one

openquake.server.dbserver.different_paths(path1, path2)[source]#
openquake.server.dbserver.ensure_on()[source]#

Start the DbServer if it is off

openquake.server.dbserver.get_status(address=None)[source]#

Check if the DbServer is up.

Parameters:

address – pair (hostname, port)

Returns:

‘running’ or ‘not-running’

openquake.server.dbserver.run_server(dbhostport=None, loglevel='WARN', foreground=False)[source]#

Run the DbServer on the given database file and port. If not given, use the settings in openquake.cfg.

openquake.server.manage module#

openquake.server.manage.fakedbcmd(action, *args)[source]#

A dispatcher to the database server.

Parameters:
  • action – database action to perform

  • args – arguments

openquake.server.middleware module#

class openquake.server.middleware.LoginRequiredMiddleware(get_response)[source]#

Bases: object

Middleware that requires a user to be authenticated to view any page other than LOGIN_URL. Exemptions to this requirement can be specified in settings via a list of regular expressions in LOGIN_EXEMPT_URLS.

Requires authentication middleware and template context processors to be loaded. You’ll get an error if they aren’t.

openquake.server.settings module#

openquake.server.urls module#

openquake.server.utils module#

openquake.server.utils.check_webserver_running(url='http://localhost:8800', max_retries=30)[source]#

Returns True if a given URL is responding within a given timeout.

openquake.server.utils.get_acl_on(request)[source]#

Returns True if ACL should be honorated, returns otherwise False.

openquake.server.utils.get_user(request)[source]#

Returns the users from request if authentication is enabled, otherwise returns the default user (from settings, or as reported by the OS).

openquake.server.utils.get_valid_users(request)[source]#

” Returns a list of users based on groups membership. Returns a list made of a single user when it is not member of any group.

openquake.server.utils.is_superuser(request)[source]#

Without authentication (settings.LOCKDOW is false) every user is considered a superuser, otherwise look at the attribute request.user.is_superuser.

openquake.server.utils.oq_server_context_processor(request)[source]#

A custom context processor which allows injection of additional context variables.

openquake.server.utils.user_has_permission(request, owner)[source]#

Returns True if user coming from the request has the permission to view a resource, returns false otherwise.

openquake.server.views module#

openquake.server.views.DEFAULT_EXPORT_TYPE = 'xml'#

For exporting calculation outputs, the client can request a specific format (xml, geojson, csv, etc.). If the client does not specify give them (NRML) XML by default.

openquake.server.views.aelo_callback(job_id, job_owner_email, outputs_uri, inputs, exc=None, warnings=None)[source]#
openquake.server.views.aelo_run(request, *args, **kwargs)[source]#
openquake.server.views.aelo_validate(request)[source]#
openquake.server.views.ajax_login(request, *args, **kwargs)[source]#
openquake.server.views.ajax_logout(request, *args, **kwargs)[source]#
openquake.server.views.aristotle_callback(job_id, params, job_owner_email, outputs_uri, exc=None, warnings=None)[source]#
openquake.server.views.aristotle_get_rupture_data(request, *args, **kwargs)[source]#
openquake.server.views.aristotle_run(request, *args, **kwargs)[source]#
openquake.server.views.aristotle_validate(request)[source]#
openquake.server.views.calc(request, *args, **kwargs)[source]#
openquake.server.views.calc_abort(request, *args, **kwargs)[source]#
openquake.server.views.calc_datastore(request, *args, **kwargs)[source]#
openquake.server.views.calc_list(request, *args, **kwargs)[source]#
openquake.server.views.calc_log(request, *args, **kwargs)[source]#
openquake.server.views.calc_log_size(request, *args, **kwargs)[source]#
openquake.server.views.calc_remove(request, *args, **kwargs)[source]#
openquake.server.views.calc_result(request, *args, **kwargs)[source]#
openquake.server.views.calc_results(request, *args, **kwargs)[source]#
openquake.server.views.calc_run(request, *args, **kwargs)[source]#
openquake.server.views.calc_traceback(request, *args, **kwargs)[source]#
openquake.server.views.cross_domain_ajax(func)[source]#
openquake.server.views.download_aggrisk(request, *args, **kwargs)[source]#
openquake.server.views.download_png(request, *args, **kwargs)[source]#
openquake.server.views.extract(request, *args, **kwargs)[source]#
openquake.server.views.get_available_gsims(request, *args, **kwargs)[source]#
openquake.server.views.get_disp_val(val)[source]#
openquake.server.views.get_engine_latest_version(request, *args, **kwargs)[source]#
openquake.server.views.get_engine_version(request, *args, **kwargs)[source]#
openquake.server.views.get_ini_defaults(request, *args, **kwargs)[source]#
openquake.server.views.is_model_preliminary(ds)[source]#
openquake.server.views.license(request, **kwargs)[source]#
openquake.server.views.log_to_json(log)[source]#

Convert a log record into a list of strings

openquake.server.views.on_same_fs(request, *args, **kwargs)[source]#
openquake.server.views.save_pik(job, dirname)[source]#

Save a LogContext object in pickled format; returns the path to it

openquake.server.views.store(request_files, ini, calc_id)[source]#

Store the uploaded files in calc_dir and select the job file by looking at the .ini extension.

Returns:

full path of the ini file

openquake.server.views.submit_job(request_files, ini, username, hc_id)[source]#

Create a job object from the given files and run it in a new process.

Returns:

a job ID

openquake.server.views.validate_nrml(request, *args, **kwargs)[source]#
openquake.server.views.validate_zip(request, *args, **kwargs)[source]#
openquake.server.views.web_engine(request, **kwargs)[source]#
openquake.server.views.web_engine_get_outputs(request, *args, **kwargs)[source]#
openquake.server.views.web_engine_get_outputs_aelo(request, *args, **kwargs)[source]#
openquake.server.views.web_engine_get_outputs_aristotle(request, *args, **kwargs)[source]#

openquake.server.wsgi module#

Module contents#