From 7db17acd0a28bbf9f6c7462223b52c3480ee8cfa Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Wed, 31 Dec 2025 10:39:54 +0100 Subject: [PATCH] Replace all instances of ARISTOTLE -> IMPACT --- .github/workflows/engine_pr_test.yml | 4 ++-- .github/workflows/engine_weekly_test.yml | 4 ++-- openquake/calculators/base.py | 2 +- openquake/calculators/event_based.py | 2 +- openquake/calculators/post_risk.py | 2 +- openquake/commands/plot_assets.py | 2 +- openquake/server/apps.py | 8 ++++---- openquake/server/local_settings.py.aelo_impact | 4 ++-- openquake/server/settings.py | 6 +++--- openquake/server/static/js/engine.js | 2 +- openquake/server/templates/engine/get_outputs.html | 4 ++-- openquake/server/templates/engine/index.html | 8 ++++---- openquake/server/tests/test_impact_mode.py | 4 ++-- openquake/server/tests/views_test.py | 2 +- openquake/server/urls.py | 2 +- openquake/server/v1/calc_urls.py | 2 +- openquake/server/views.py | 6 +++--- 17 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.github/workflows/engine_pr_test.yml b/.github/workflows/engine_pr_test.yml index f23e0afaca15..f90d4ccdd52f 100644 --- a/.github/workflows/engine_pr_test.yml +++ b/.github/workflows/engine_pr_test.yml @@ -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 }} @@ -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 diff --git a/.github/workflows/engine_weekly_test.yml b/.github/workflows/engine_weekly_test.yml index 3f03375b5a47..868c8f259d8f 100644 --- a/.github/workflows/engine_weekly_test.yml +++ b/.github/workflows/engine_weekly_test.yml @@ -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 @@ -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 diff --git a/openquake/calculators/base.py b/openquake/calculators/base.py index 2d80f787f06b..b486958ed094 100644 --- a/openquake/calculators/base.py +++ b/openquake/calculators/base.py @@ -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() diff --git a/openquake/calculators/event_based.py b/openquake/calculators/event_based.py index 989cffa7672f..94862ca66062 100644 --- a/openquake/calculators/event_based.py +++ b/openquake/calculators/event_based.py @@ -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: diff --git a/openquake/calculators/post_risk.py b/openquake/calculators/post_risk.py index e573d221e40f..bed951b03d5b 100644 --- a/openquake/calculators/post_risk.py +++ b/openquake/calculators/post_risk.py @@ -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: diff --git a/openquake/commands/plot_assets.py b/openquake/commands/plot_assets.py index f3fb0d7a3cd7..88d5d1b9765b 100644 --- a/openquake/commands/plot_assets.py +++ b/openquake/commands/plot_assets.py @@ -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 diff --git a/openquake/server/apps.py b/openquake/server/apps.py index cc8117581983..5723587b87fb 100644 --- a/openquake/server/apps.py +++ b/openquake/server/apps.py @@ -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( @@ -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): diff --git a/openquake/server/local_settings.py.aelo_impact b/openquake/server/local_settings.py.aelo_impact index 3c8979f33d41..e89c5172549a 100644 --- a/openquake/server/local_settings.py.aelo_impact +++ b/openquake/server/local_settings.py.aelo_impact @@ -1,12 +1,12 @@ import os -APPLICATION_MODE = <'AELO'|'ARISTOTLE'> +APPLICATION_MODE = <'AELO'|'IMPACT'> ALLOWED_HOSTS = (, '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' diff --git a/openquake/server/settings.py b/openquake/server/settings.py index 9989ab96a664..8c5255d4dc4f 100644 --- a/openquake/server/settings.py +++ b/openquake/server/settings.py @@ -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' @@ -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/' @@ -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': diff --git a/openquake/server/static/js/engine.js b/openquake/server/static/js/engine.js index 1c9e551b0502..77b8ff2bc52b 100644 --- a/openquake/server/static/js/engine.js +++ b/openquake/server/static/js/engine.js @@ -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", diff --git a/openquake/server/templates/engine/get_outputs.html b/openquake/server/templates/engine/get_outputs.html index f8ad1eebbaaf..9adfd4650aa9 100644 --- a/openquake/server/templates/engine/get_outputs.html +++ b/openquake/server/templates/engine/get_outputs.html @@ -67,7 +67,7 @@

Outputs from calculation {{ calc_id }}

Show hazard map {% endif %} - {% if application_mode == 'ARISTOTLE' %} + {% if application_mode == 'IMPACT' %} {% for img in pngs.avg_gmf %} {% endif %} - {% endif %} {# end if ARISTOTLE #} + {% endif %} {# end if IMPACT #} {% if application_mode == 'AELO' %} {% if pngs.mce %}
diff --git a/openquake/server/templates/engine/index.html b/openquake/server/templates/engine/index.html index 7c236f447ca8..92525ed55cf1 100644 --- a/openquake/server/templates/engine/index.html +++ b/openquake/server/templates/engine/index.html @@ -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' %}
  • {% 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 %} @@ -101,8 +101,8 @@

    List of calculations{% if server_name %} from {{ server_name }}{% endif %} {% endif %} - /{% 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 - {% if application_mode != 'AELO' and application_mode != 'ARISTOTLE' and application_mode != 'READ_ONLY' and user_level > 0 %} + /{% 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 + {% if application_mode != 'AELO' and application_mode != 'IMPACT' and application_mode != 'READ_ONLY' and user_level > 0 %} diff --git a/openquake/server/tests/test_impact_mode.py b/openquake/server/tests/test_impact_mode.py index 02a126a04bf3..089434d61274 100644 --- a/openquake/server/tests/test_impact_mode.py +++ b/openquake/server/tests/test_impact_mode.py @@ -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)) diff --git a/openquake/server/tests/views_test.py b/openquake/server/tests/views_test.py index 0e591a908d03..e4b68462e3e8 100644 --- a/openquake/server/tests/views_test.py +++ b/openquake/server/tests/views_test.py @@ -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) diff --git a/openquake/server/urls.py b/openquake/server/urls.py index 7a7f567febdb..522ee75bc320 100644 --- a/openquake/server/urls.py +++ b/openquake/server/urls.py @@ -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, diff --git a/openquake/server/v1/calc_urls.py b/openquake/server/v1/calc_urls.py index 510a647bd507..7baec662bb51 100644 --- a/openquake/server/v1/calc_urls.py +++ b/openquake/server/v1/calc_urls.py @@ -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), diff --git a/openquake/server/views.py b/openquake/server/views.py index 9392a6949e51..06b872bb8193 100644 --- a/openquake/server/views.py +++ b/openquake/server/views.py @@ -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 @@ -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'] @@ -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)