diff --git a/openquake/calculators/event_based.py b/openquake/calculators/event_based.py index 5fc4c7052181..93e7af8e3cfe 100644 --- a/openquake/calculators/event_based.py +++ b/openquake/calculators/event_based.py @@ -377,9 +377,10 @@ 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) + dstore.parent[f'oqparam/{name}'], new=True) oq_by[model].mags_by_trt = AccumDict(accum=set()) else: oq_by = {'???': oq} 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] diff --git a/openquake/engine/postjobs.py b/openquake/engine/postjobs.py index aca6b0247609..5f2d3de7627d 100644 --- a/openquake/engine/postjobs.py +++ b/openquake/engine/postjobs.py @@ -38,7 +38,9 @@ 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) + 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}')