engine-server: bug when running risk calculations

Bug #1382554 reported by Michele Simionato
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenQuake Engine
Fix Released
High
Michele Simionato

Bug Description

Here is the problem:
[14:06:32] Daniele Viganò: ERROR Internal Server Error: /v1/calc/hazard/run
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 109, in get_response
    response = callback(request, callback_args, *callback_kwargs)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 39, in wrapped_view
    resp = view_func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 52, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/local/openquake/oq-engine/openquake/server/views.py", line 58, in wrap
    response = func(request, args, *kwargs)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/http.py", line 45, in inner
    return func(request, args, *kwargs)
  File "/usr/local/openquake/oq-engine/openquake/server/views.py", line 259, in run_calc
    response_data = _get_calc_info(job_type, job.calc_id)
  File "/usr/local/openquake/oq-engine/openquake/server/views.py", line 190, in _get_calc_info
    .get(hazard_calculation=calc_id)
  File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 357, in get
    clone = self.filter(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 571, in filter
    return self._filter_or_exclude(False, args, *kwargs)
  File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 589, in _filter_or_exclude
    clone.query.add_q(Q(*args, **kwargs))
  File "/usr/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 1194, in add_q
    can_reuse=used_aliases, force_having=force_having)
  File "/usr/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 1069, in add_filter
    negate=negate, process_extras=process_extras)
  File "/usr/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 1260, in setup_joins
    "Choices are: %s" % (name, ", ".join(names)))
FieldError: Cannot resolve keyword 'hazard_calculation' into field. Choices are: assetsite, duration, exposuremodel, hazardlib_version, hazardsite, id, imttaxonomy, is_running, jo
b_pid, jobinfo, jobparam, jobstats, last_update, log_level, ltsourcemodel, nrml_version, oq_version, output, performance, risk_calculation, riskcalculation, risklib_version, sitem
odel, status, supervisor_pid, user_name

Changed in oq-engine:
status: New → In Progress
importance: Undecided → Critical
assignee: nobody → Michele Simionato (michele-simionato)
milestone: none → 1.0.1
Revision history for this message
Michele Simionato (michele-simionato) wrote :
Revision history for this message
Daniele Viganò (daniele-vigano) wrote :

Issue has partially resolved in:

https://github.com/gem/oq-engine/pull/1561
https://github.com/gem/oq-engine/pull/1558
https://github.com/gem/oq-engine/pull/1555

There are still some issue as pointed out by Michele in PR#1561.
There is also the issue that risk outputs from API are only under "hazard" (instead of risk) i.e:

http://172.16.12.213:8800/v1/calc/hazard/46 should not work, instead http://172.16.12.213:8800/v1/calc/risk/46 must be the right URL (when #46 is a risk calculation)

Changed in oq-engine:
importance: Critical → High
Revision history for this message
Michele Simionato (michele-simionato) wrote :

This should be solved after the changes in https://github.com/gem/oq-engine/pull/1569

Revision history for this message
Daniele Viganò (daniele-vigano) wrote :

Hazard and risk calculations work through the engine server after https://github.com/gem/oq-engine/commit/e58c6c0676dd1d06de4da6c51ec555f439db7bfa

However the API is reporting same results under both hazard and risk namespaces (for both types of calculation):

GET /v1/calc/hazard/64
{"status": "complete", "inputs": {"nonstructural_vulnerability": "/tmp/tmpb4g5L_/nonstructural_vulnerability_model.xml", "occupants_vulnerability": "/tmp/tmpb4g5L_/occupants_vulnerability_model.xml", "structural_vulnerability": "/tmp/tmpb4g5L_/structural_vulnerability_model.xml"}, "export_dir": "/tmp", "description": "Classical PSHA-based Risk", "hazard_calculation_id": 63, "lrem_steps_per_interval": 1, "poes_disagg": [], "base_path": "/tmp/tmpb4g5L_", "sites_disagg": [], "intensity_measure_types_and_levels": {"PGA": [0.0001, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4]}, "calculation_mode": "classical_risk", "quantile_loss_curves": [], "conditional_loss_poes": [], "maximum_distance": 20.0, "region_constraint": "POLYGON((78.0 31.5, 89.5 31.5, 89.5 25.5, 78.0 25.5, 78.0 31.5))", "hazard_output_id": null, "specific_assets": []}

GET /v1/calc/risk/64
{"status": "complete", "inputs": {"nonstructural_vulnerability": "/tmp/tmpb4g5L_/nonstructural_vulnerability_model.xml", "occupants_vulnerability": "/tmp/tmpb4g5L_/occupants_vulnerability_model.xml", "structural_vulnerability": "/tmp/tmpb4g5L_/structural_vulnerability_model.xml"}, "export_dir": "/tmp", "description": "Classical PSHA-based Risk", "hazard_calculation_id": 63, "lrem_steps_per_interval": 1, "poes_disagg": [], "base_path": "/tmp/tmpb4g5L_", "sites_disagg": [], "intensity_measure_types_and_levels": {"PGA": [0.0001, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4]}, "calculation_mode": "classical_risk", "quantile_loss_curves": [], "conditional_loss_poes": [], "maximum_distance": 20.0, "region_constraint": "POLYGON((78.0 31.5, 89.5 31.5, 89.5 25.5, 78.0 25.5, 78.0 31.5))", "hazard_output_id": null, "specific_assets": []}

Changed in oq-engine:
status: In Progress → Fix Committed
Changed in oq-engine:
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

Remote bug watches

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