Revise db users and django/ORM router logic

Bug #832711 reported by Muharem Hrnjadovic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenQuake (deprecated)
Fix Released
High
Muharem Hrnjadovic

Bug Description

We need to re-structure the database users to retain some degree of
control but still make it easy to use the django ORM.

The openquake process roughly consists of the following phases:

    1 - job initialization
        - write NRML files to hzrdi.* and riski.* tables, insert the
          uiapi.input, uiapi.oq_params and uiapi.oq_job rows
        - spawn the job supervisor and update the uiapi.oq_job record
          with the supervisor's pid.
        [suggested db user: oq_job_init]
    2 - calculation
    3 - result serialization: write hzrdr.* and riskr.* tables, insert
        an uiapi.output record.
        [suggested db user: oq_reslt_writer]

On the job supervisor side we have the following actions:

    1 - update the uiapi.oq_job record with the job's status
    2 - potentially insert rows into uiapi.error_msg
    [suggested db user: oq_job_supervisor]

In light of the above the only point of ambiguity for the django/ORM
router code is the write access to uiapi.oq_job. It can either be
requested by oq_job_init or by oq_job_supervisor.

The resolution is to utilise something like:

    OqJob.objects.using('job_supervisor').filter()

and

    job.save(using='job_supervisor')

in the job supervisor code.

We need to add the following db users:

    oq_job_init
    oq_job_supervisor

We also need to delete the following users:

    oq_hzrdi_reader
    oq_hzrdi_writer
    oq_reslt_reader
    oq_riski_reader
    oq_riski_writer
    oq_uiapi_reader
    oq_uiapi_writer

Changed in openquake:
status: New → Confirmed
importance: Undecided → High
milestone: none → 0.4.3
tags: added: database sys-quality
description: updated
Changed in openquake:
assignee: nobody → Muharem Hrnjadovic (al-maisan)
status: Confirmed → In Progress
Changed in openquake:
status: In Progress → Fix Committed
Changed in openquake:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.