Skip to content
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/engine_pr_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ jobs:
env:
GITHUB_HEAD_REF: ${{ github.head_ref }}
FROM_FORK: ${{ github.event.pull_request.head.repo.fork }}
OQ_APPLICATION_MODE: ARISTOTLE
OQ_APPLICATION_MODE: IMPACT
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -250,7 +250,7 @@ jobs:
for file in openquake/server/templates/registration/*.impact.tmpl; do
cp -- "$file" "${file%.impact.tmpl}"
done
- name: Server 'ARISTOTLE' mode tests
- name: Server 'IMPACT' mode tests
run: |
set -x
date
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/engine_weekly_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ jobs:
env:
GITHUB_HEAD_REF: ${{ github.head_ref }}
FROM_FORK: ${{ github.event.pull_request.head.repo.fork }}
OQ_APPLICATION_MODE: ARISTOTLE
OQ_APPLICATION_MODE: IMPACT
OQ_CONFIG_FILE: openquake/server/tests/data/openquake.cfg
steps:
# This Checkout use git-ref keyword from dispatch
Expand Down Expand Up @@ -429,7 +429,7 @@ jobs:
for file in ./openquake/server/templates/registration/*.impact.tmpl; do
cp -- "$file" "${file%.impact.tmpl}"
done
- name: Server 'ARISTOTLE' mode tests
- name: Server 'IMPACT' mode tests
run: |
set -x
date
Expand Down
2 changes: 1 addition & 1 deletion openquake/calculators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ def save_crmodel(self):
self.datastore.create_df('taxmap', self.crmodel.tmap_df, 'gzip')

def _plot_assets(self):
# called by post_risk in ARISTOTLE mode
# called by post_risk in IMPACT mode
plt = plot_assets(self.datastore.calc_id, show=False,
assets_only=True)
bio = io.BytesIO()
Expand Down
2 changes: 1 addition & 1 deletion openquake/calculators/event_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ def save_avg_gmf(self):
avg_gmf[:, sid] = avgstd
self.datastore['avg_gmf'] = avg_gmf
# make avg_gmf plots only if running via the webui
if os.environ.get('OQ_APPLICATION_MODE') == 'ARISTOTLE':
if os.environ.get('OQ_APPLICATION_MODE') == 'IMPACT':
imts = list(self.oqparam.imtls)
ex = Extractor(self.datastore.calc_id)
for imt in imts:
Expand Down
2 changes: 1 addition & 1 deletion openquake/calculators/post_risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ def post_execute(self, ok):
"""
Sanity checks and save agg_curves-stats
"""
if os.environ.get('OQ_APPLICATION_MODE') == 'ARISTOTLE':
if os.environ.get('OQ_APPLICATION_MODE') == 'IMPACT':
try:
self._plot_assets()
except Exception:
Expand Down
2 changes: 1 addition & 1 deletion openquake/commands/plot_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def main(calc_id: int = -1, site_model=False,
dist = sitecol.get_cdist(rec)
print('rupture(%s, %s), dist=%s' % (lon, lat, dist))
xlon, xlat = [lon], [lat]
if (os.environ.get('OQ_APPLICATION_MODE') == 'ARISTOTLE'
if (os.environ.get('OQ_APPLICATION_MODE') == 'IMPACT'
and not use_shakemap):
# assuming there is only 1 rupture, so rup_id=0
rup = get_ebrupture(dstore, rup_id=0).rupture
Expand Down
8 changes: 4 additions & 4 deletions openquake/server/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def ready(self):
raise ValueError(
f'Invalid application mode: "{settings.APPLICATION_MODE}".'
f' It must be one of {settings.APPLICATION_MODES}')
if settings.APPLICATION_MODE == 'ARISTOTLE':
if settings.APPLICATION_MODE == 'IMPACT':
try:
# NOTE: optional dependency needed for ARISTOTLE
# NOTE: optional dependency needed for IMPACT
from timezonefinder import TimezoneFinder # noqa
except ImportError:
raise ImportError(
Expand All @@ -79,13 +79,13 @@ def ready(self):
f'If authentication is enabled (without PAM)'
f' all the following settings must be specified:'
f' {required_email_settings}')
if settings.APPLICATION_MODE in ('AELO', 'ARISTOTLE'):
if settings.APPLICATION_MODE in ('AELO', 'IMPACT'):
if not config.directory.mosaic_dir:
raise NameError(
f'If APPLICATION_MODE is {settings.APPLICATION_MODE}, '
f'mosaic_dir must be specified in openquake.cfg')
if settings.APPLICATION_MODE == 'AELO':
# NOTE: this might be needed also for ARISTOTLE
# NOTE: this might be needed also for IMPACT
aelo_changelog_path = os.path.join(
config.directory.mosaic_dir, 'aelo_changelog.ini')
if not os.path.isfile(aelo_changelog_path):
Expand Down
4 changes: 2 additions & 2 deletions openquake/server/local_settings.py.aelo_impact
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import os

APPLICATION_MODE = <'AELO'|'ARISTOTLE'>
APPLICATION_MODE = <'AELO'|'IMPACT'>
ALLOWED_HOSTS = (<domain_name_of_the_server>, 'localhost', '127.0.0.1')
DISABLE_VERSION_WARNING = True

IMPACT_DEFAULT_USGS_ID = ''

# Set it to False in ARISTOTLE mode
# Set it to False in IMPACT mode
# ALLOW_DATASTORE_DOWNLOAD = False

# By default it is 'openquake'
Expand Down
6 changes: 3 additions & 3 deletions openquake/server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
SERVER_NAME = socket.gethostname()

APPLICATION_MODES = [
'PUBLIC', 'RESTRICTED', 'AELO', 'ARISTOTLE', 'READ_ONLY', 'TOOLS_ONLY']
'PUBLIC', 'RESTRICTED', 'AELO', 'IMPACT', 'READ_ONLY', 'TOOLS_ONLY']

APPLICATION_MODE = 'PUBLIC'

Expand Down Expand Up @@ -305,7 +305,7 @@ def filter(self, record):
# both the default setting and the one specified in the local settings
APPLICATION_MODE = os.environ.get('OQ_APPLICATION_MODE', APPLICATION_MODE)

if APPLICATION_MODE in ('RESTRICTED', 'AELO', 'ARISTOTLE'):
if APPLICATION_MODE in ('RESTRICTED', 'AELO', 'IMPACT'):
LOCKDOWN = True

STATIC_URL = f'{WEBUI_PATHPREFIX}/static/'
Expand Down Expand Up @@ -338,7 +338,7 @@ def filter(self, record):
'app-messages')
else:
EMAIL_BACKEND = EMAIL_BACKEND or 'django.core.mail.backends.smtp.EmailBackend'
if APPLICATION_MODE == 'ARISTOTLE':
if APPLICATION_MODE == 'IMPACT':
EMAIL_HOST_USER = EMAIL_HOST_USER or 'impactnoreply@openquake.org'
EMAIL_SUPPORT = EMAIL_SUPPORT or 'impactsupport@openquake.org'
elif APPLICATION_MODE == 'AELO':
Expand Down
2 changes: 1 addition & 1 deletion openquake/server/static/js/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ site-specific hazard and site response could be warranted.`;

// IMPACT

if (window.application_mode === 'ARISTOTLE') {
if (window.application_mode === 'IMPACT') {
set_shakemap_version_selector();
$.ajax({
url: "/v1/get_impact_form_defaults",
Expand Down
4 changes: 2 additions & 2 deletions openquake/server/templates/engine/get_outputs.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h2>Outputs from calculation {{ calc_id }}</h2>
Show hazard map</a>
</div>
{% endif %}
{% if application_mode == 'ARISTOTLE' %}
{% if application_mode == 'IMPACT' %}
{% for img in pngs.avg_gmf %}
<div class="my-pngs">
<a href="{{ oq_engine_server_url }}/v1/calc/{{ calc_id }}/download_png/{{img}}" class="btn btn-sm">
Expand All @@ -80,7 +80,7 @@ <h2>Outputs from calculation {{ calc_id }}</h2>
Show assets</a>
</div>
{% endif %}
{% endif %} {# end if ARISTOTLE #}
{% endif %} {# end if IMPACT #}
{% if application_mode == 'AELO' %}
{% if pngs.mce %}
<div class="my-pngs">
Expand Down
8 changes: 4 additions & 4 deletions openquake/server/templates/engine/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{% block nav-items %}
{{ block.super }}
{% if application_mode != 'AELO' and application_mode != 'ARISTOTLE' and application_mode != 'READ_ONLY' %}
{% if application_mode != 'AELO' and application_mode != 'IMPACT' and application_mode != 'READ_ONLY' %}
<li class="calc">
<form class="calc-form form-horizontal"
enctype="multipart/form-data"
Expand All @@ -27,7 +27,7 @@
</div>
{% if application_mode == 'AELO' %}
{% include './includes/aelo_form.html' %}
{% elif application_mode == 'ARISTOTLE' %}
{% elif application_mode == 'IMPACT' %}
{% with './includes/impact_form_level_'|addstr:user_level|add:'.html' as template_path %}
{% include template_path %}
{% endwith %}
Expand Down Expand Up @@ -101,8 +101,8 @@ <h2>List of calculations{% if server_name %} from {{ server_name }}{% endif %}</
<% } %>
{% endif %}

<a href="{% url "index" %}/<%= calc.get('id') %>/{% if application_mode == 'AELO'%}outputs_aelo{% elif application_mode == 'ARISTOTLE' %}outputs_impact{% else %}outputs{% endif %}" class="btn btn-sm calc-list-btn" style="margin: 2px 0 2px 0">Outputs</a>
{% if application_mode != 'AELO' and application_mode != 'ARISTOTLE' and application_mode != 'READ_ONLY' and user_level > 0 %}
<a href="{% url "index" %}/<%= calc.get('id') %>/{% if application_mode == 'AELO'%}outputs_aelo{% elif application_mode == 'IMPACT' %}outputs_impact{% else %}outputs{% endif %}" class="btn btn-sm calc-list-btn" style="margin: 2px 0 2px 0">Outputs</a>
{% if application_mode != 'AELO' and application_mode != 'IMPACT' and application_mode != 'READ_ONLY' and user_level > 0 %}
<form class="calc-form" enctype="multipart/form-data"
style="margin: 0; display: inline-block"
method="post" action="{{ oq_engine_server_url }}/v1/calc/run">
Expand Down
4 changes: 2 additions & 2 deletions openquake/server/tests/test_impact_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,13 @@ def test_run_by_usgs_id_then_remove_calc_success(self):
data = dict(usgs_id=usgs_id, shakemap_version=shakemap_id)
self.impact_run_then_remove('impact_run_with_shakemap', data)

# check that the URL 'run' cannot be accessed in ARISTOTLE mode
# check that the URL 'run' cannot be accessed in IMPACT mode
def test_can_not_run_normal_calc(self):
with open(os.path.join(self.datadir, 'archive_ok.zip'), 'rb') as a:
resp = self.post('run', data=dict(archive=a))
self.assertEqual(resp.status_code, 404, resp)

# check that the URL 'validate_zip' cannot be accessed in ARISTOTLE mode
# check that the URL 'validate_zip' cannot be accessed in IMPACT mode
def test_can_not_validate_zip(self):
with open(os.path.join(self.datadir, 'archive_err_1.zip'), 'rb') as a:
resp = self.post('validate_zip', data=dict(archive=a))
Expand Down
2 changes: 1 addition & 1 deletion openquake/server/tests/views_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def wait(cls):
running_calcs = cls.get('list', is_running='true')
if not running_calcs:
if os.environ.get('OQ_APPLICATION_MODE') in ('AELO',
'ARISTOTLE'):
'IMPACT'):
# NOTE: some more time is needed in order to wait for the
# callback to finish and produce the email notification
time.sleep(1)
Expand Down
2 changes: 1 addition & 1 deletion openquake/server/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
re_path(r'^v1/aelo_site_classes$', views.aelo_site_classes,
name="aelo_site_classes"),
]
elif settings.APPLICATION_MODE == 'ARISTOTLE':
elif settings.APPLICATION_MODE == 'IMPACT':
urlpatterns += [
re_path(r'^engine/(\d+)/outputs_impact$',
views.web_engine_get_outputs_impact,
Expand Down
2 changes: 1 addition & 1 deletion openquake/server/v1/calc_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
re_path(r'^(\d+)/abort$', views.calc_abort),
re_path(r'^(\d+)/remove$', views.calc_remove),
])
elif settings.APPLICATION_MODE == 'ARISTOTLE':
elif settings.APPLICATION_MODE == 'IMPACT':
urlpatterns.extend([
re_path(r'^impact_get_rupture_data$',
views.impact_get_rupture_data),
Expand Down
6 changes: 3 additions & 3 deletions openquake/server/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1839,7 +1839,7 @@ def web_engine(request, **kwargs):
params['site_classes'] = oqvalidation.SITE_CLASSES
params['default_asce_version'] = (
oqvalidation.OqParam.asce_version.default)
elif application_mode == 'ARISTOTLE':
elif application_mode == 'IMPACT':
params['impact_form_labels'] = IMPACT_FORM_LABELS
params['impact_form_placeholders'] = IMPACT_FORM_PLACEHOLDERS
params['impact_form_defaults'] = IMPACT_FORM_DEFAULTS
Expand Down Expand Up @@ -1869,7 +1869,7 @@ def web_engine_get_outputs(request, calc_id, **kwargs):
if 'png' in ds:
# NOTE: only one hmap can be visualized currently
pngs['hmaps'] = any([k.startswith('hmap') for k in ds['png']])
if application_mode == 'ARISTOTLE':
if application_mode == 'IMPACT':
pngs['avg_gmf'] = [
k for k in ds['png'] if k.startswith('avg_gmf-')]
pngs['assets'] = 'assets.png' in ds['png']
Expand Down Expand Up @@ -1900,7 +1900,7 @@ def web_engine_get_outputs(request, calc_id, **kwargs):
kwargs['calc_aelo_version'] = '1.0.0'
kwargs['asce_version'] = oqvalidation.ASCE_VERSIONS[asce_version]
kwargs['notes'], kwargs['warnings'] = get_aelo_notes_and_warnings(ds)
elif application_mode == 'ARISTOTLE':
elif application_mode == 'IMPACT':
kwargs['warnings'] = get_aristotle_warnings(ds)
return render(request, "engine/get_outputs.html", kwargs)

Expand Down