diff --git a/openquake/calculators/post_risk.py b/openquake/calculators/post_risk.py index 10af8ed0a9fe..2e834afa7a9f 100644 --- a/openquake/calculators/post_risk.py +++ b/openquake/calculators/post_risk.py @@ -242,7 +242,7 @@ def fix_dtypes(dic): fix_dtype(dic, F32, floatcolumns) -def build_aggcurves(items, builder, num_events, aggregate_loss_curves_types): +def build_aggcurves(items, builder, num_events, aggregate_loss_curves_types, monitor): """ :param items: a list of pairs ((agg_id, rlz_id, loss_id), losses) :param builder: a :class:`LossCurvesMapsBuilder` instance @@ -295,6 +295,7 @@ def store_aggcurves(oq, agg_ids, rbe_df, builder, loss_cols, if len(year): data['year'] = year[df.event_id.to_numpy()] items.append([(agg_id, rlz_id, loss_id), data]) + dstore.swmr_on() dic = parallel.Starmap.apply( build_aggcurves, (items, builder, num_events, aggtypes), concurrent_tasks=oq.concurrent_tasks, diff --git a/openquake/commonlib/datastore.py b/openquake/commonlib/datastore.py index 956edfd22261..065f09d710cf 100644 --- a/openquake/commonlib/datastore.py +++ b/openquake/commonlib/datastore.py @@ -134,7 +134,8 @@ def new(calc_id, oqparam, datadir=None, mode=None): a DataStore instance associated to the given calc_id """ dstore = _read(calc_id, mode, datadir) - dstore['oqparam'] = oqparam + if 'oqparam' not in dstore: + dstore['oqparam'] = oqparam if oqparam.hazard_calculation_id: dstore.ppath = read(calc_id, 'r', datadir).ppath return dstore