From bfedc0a239828985887ae7bddc9e0569dbfc9374 Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Sat, 23 May 2026 06:17:56 +0200 Subject: [PATCH 1/5] Fixed the check on maximum_distance in event_based_risk --- openquake/calculators/event_based_risk.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openquake/calculators/event_based_risk.py b/openquake/calculators/event_based_risk.py index 5d75579e5ab0..42fe85d5e35d 100644 --- a/openquake/calculators/event_based_risk.py +++ b/openquake/calculators/event_based_risk.py @@ -468,7 +468,8 @@ def execute(self): oq.gsim == '[FromFile]'): raise InvalidFile('%s: missing gsim or gsim_logic_tree_file' % oq.inputs['job_ini']) - elif not hasattr(oq, 'maximum_distance'): + elif oq.hazard_calculation_id is None and not hasattr( + oq, 'maximum_distance'): raise InvalidFile('Missing maximum_distance in %s' % oq.inputs['job_ini']) rup0 = self.datastore['ruptures'][0] From 2a803d57330c1a88f31efa77ff2e0157c333cf9f Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Sat, 23 May 2026 06:38:13 +0200 Subject: [PATCH 2/5] Fix --- openquake/calculators/event_based.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openquake/calculators/event_based.py b/openquake/calculators/event_based.py index 5fc4c7052181..68b4b31b689d 100644 --- a/openquake/calculators/event_based.py +++ b/openquake/calculators/event_based.py @@ -377,7 +377,8 @@ def get_allargs(oq, sitecol, assetcol, sec_perils, dstore): grp = dstore.parent['oqparam'] if isinstance(grp, h5py.Group): oq_by = {} - for model in grp: + for name in grp: + model = name[-3:] # i.e. AfricaNAF -> NAF oq_by[model] = oq.from_parent( dstore.parent[f'oqparam/{model}'], new=True) oq_by[model].mags_by_trt = AccumDict(accum=set()) From 7d0e877bfb23c839cf9b7fd211469efe63c40c9e Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Sat, 23 May 2026 06:40:42 +0200 Subject: [PATCH 3/5] Fix --- openquake/calculators/event_based.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openquake/calculators/event_based.py b/openquake/calculators/event_based.py index 68b4b31b689d..93e7af8e3cfe 100644 --- a/openquake/calculators/event_based.py +++ b/openquake/calculators/event_based.py @@ -380,7 +380,7 @@ def get_allargs(oq, sitecol, assetcol, sec_perils, dstore): for name in grp: model = name[-3:] # i.e. AfricaNAF -> NAF oq_by[model] = oq.from_parent( - dstore.parent[f'oqparam/{model}'], new=True) + dstore.parent[f'oqparam/{name}'], new=True) oq_by[model].mags_by_trt = AccumDict(accum=set()) else: oq_by = {'???': oq} From 1054073820a2a1b69ce719aac94e173bf30ea992 Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Sat, 23 May 2026 07:35:32 +0200 Subject: [PATCH 4/5] Fixed build_ses --- openquake/engine/postjobs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openquake/engine/postjobs.py b/openquake/engine/postjobs.py index aca6b0247609..17c703ad0e48 100644 --- a/openquake/engine/postjobs.py +++ b/openquake/engine/postjobs.py @@ -38,7 +38,8 @@ def build_ses(dstore, calcs, out_file): generated by each job. """ with performance.Monitor(measuremem=True, h5=dstore) as mon: - names = dstore.read_df('workflow', 'calc_id').name + df = dstore.read_df('workflow', 'calc_id') + names = list(df.loc[calcs].name) dstores = [datastore.read(calc) for calc in calcs] fnames = [ds.filename for ds in dstores] logging.warning(f'Saving {out_file}') From d0387f1cc960ebd36d77a099f51ebe046a2978c1 Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Sat, 23 May 2026 07:38:12 +0200 Subject: [PATCH 5/5] Better logging [ci skip] --- openquake/engine/postjobs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openquake/engine/postjobs.py b/openquake/engine/postjobs.py index 17c703ad0e48..5f2d3de7627d 100644 --- a/openquake/engine/postjobs.py +++ b/openquake/engine/postjobs.py @@ -40,6 +40,7 @@ def build_ses(dstore, calcs, out_file): with performance.Monitor(measuremem=True, h5=dstore) as mon: df = dstore.read_df('workflow', 'calc_id') names = list(df.loc[calcs].name) + logging.info(f'Importing {" ".join(names)}') dstores = [datastore.read(calc) for calc in calcs] fnames = [ds.filename for ds in dstores] logging.warning(f'Saving {out_file}')