gem / oq-engine

OpenQuake's Engine for Seismic Hazard and Risk Analysis
https://github.com/gem/oq-engine/#openquake-engine
GNU Affero General Public License v3.0
374 stars 272 forks source link

Add AELO release information #9759

Closed ptormene closed 3 weeks ago

ptormene commented 1 month ago

The idea is to read the release information from a changelog file and display to the user portions of it.

micheles commented 1 month ago

Here is a proposal for the changelog file, to be discussed:

[Release 2.0.0]
Date: 2024-12-31
Requires: engine-3.22
Notes: Final version
Private: see file XXX

[Release _1.1.0]
Date: 2024-09-30
Requires: engine-3.21
Notes:
  Preliminary version only available on the beta machine.
  It has the following features:
  1. extended to 10 IMTs
  2. implemented ASCE17
  3. ...
Private: see file XXX

[Release 1.0.0]
Date: 2024-06-31
Requires: engine-3.20
Notes: Initial version
Private: see file XXX

and here is an example of how to read it:

import configparser
import collections
import pandas

dic = collections.defaultdict(list)
c = configparser.ConfigParser()
c.read('AELO.ini')
for sec in c.sections():
    dic['release'].append(sec)
    for k, v in c.items(sec):
        dic[k].append(v)
print(pandas.DataFrame(dic))
          release        date     requires                                              notes       private
0   Release 2.0.0  2024-12-31  engine-3.22                                      Final version  see file XXX
1   Release _1.1.0 2024-09-31  engine-3.21  \nPreliminary version only available on the be...  see file XXX
2   Release 1.0.0  2024-06-31  engine-3.20                                    Initial version  see file XXX
ptormene commented 1 month ago

I modified the implementation as suggested by @micheles. If APPLICATION_MODE='AELO', a aelo_changelog.ini file must be placed into the mosaic_dir. Follows an example of changelog file and the corresponding rendering in the web application:

[Release 2.0.0]
Date: 2024-12-31
Requires: engine-3.22
Notes: Final version
Private: see file XXX

[Release 1.1.0]
Date: 2024-09-30
Requires: engine-3.21
Notes:
  Preliminary version only available on the beta machine.
  It has the following features:
  1. extended to 10 IMTs
  2. implemented ASCE17
  3. ...
Private: see file XXX

[Release _1.0.1]
Date: 2024-07-10
Requires: engine-3.20
Notes:
  Version not to be displayed in the changelog web page
Private: see file XXX

[Release 1.0.0]
Date: 2024-06-31
Requires: engine-3.20
Notes: Initial version
Private: see file XXX

Screenshot from 2024-06-11 09-43-03

ptormene commented 3 weeks ago

image

ptormene commented 3 weeks ago

NOTE: the aelo_version is saved into the datastore only if the calculation runs through the webui with APPLICATION_MODE == 'AELO' in local_settings.py or via the command line using the environment variable OQ_APPLICATION_MODE=AELO. If aelo_version is not in the datastore, the AELO outputs page will look as it was before this PR and the downloaded csv outputs will display the engine_version instead.

ptormene commented 3 weeks ago

I simplified a bit the format of the aelo_changelog.ini file:

[2.1.0]
date: 2024-12-31
engine_version: engine-3.22
notes: Changed presentation
private: see file XXX

[2.0.0]
date: 2024-09-30
engine_version: engine-3.21
notes:
  Preliminary version only available on the beta machine.
  It has the following features:
  1. extended to 10 IMTs
  2. implemented ASCE17
  3. ...
private: see file XXX

[1.0.0]
date: 2024-06-31
engine_version: engine-3.20
notes: Initial version
private: see file XXX

If a calculation has not aelo_version stored in the datastore, version 1.0.0 is automatically assigned. This happens for the existing calculations in the currently running installations or when a calculation runs via the command line without the OQ_APPLICATION_MODE=AELO environment variable.

NOTE: the keys in the ini file are case-insensitive; they are anyway displayed uppercase in the changelog webpage (see screenshot): image