Skip to content

Commit 9bd1bf0

Browse files
committed
fix: fetch features from basins instead of attempting to load all basins
1 parent 5f2bdcb commit 9bd1bf0

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

ckanext/dc_serve/jobs.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def _get_intra_dataset_upstream_basins(res_dict, ds) -> list[dict]:
233233

234234
# get the actual features available for this basin
235235
ds_s3_res = s3cc.get_s3_dc_handle(u_rid, "resource")
236-
basin_feats = ds_s3_res.features
236+
basin_feats = _get_remote_features_from_basins(ds_s3_res)
237237
for ii in range(10):
238238
# Workaround. I experienced AttributeErrors during
239239
# testing ('S3File' object has no attribute 'seek'),
@@ -257,8 +257,8 @@ def _get_intra_dataset_upstream_basins(res_dict, ds) -> list[dict]:
257257
f"intra-dataset basin; traceback follows.")
258258
logger.warning(traceback.format_exc())
259259
else:
260-
basin_feats = list(set(
261-
basin_feats + ds_s3_con.features))
260+
con_f = _get_remote_features_from_basins(ds_s3_con)
261+
basin_feats = sorted(set(basin_feats + con_f))
262262
break
263263

264264
# Add DCOR basin
@@ -285,6 +285,15 @@ def _get_intra_dataset_upstream_basins(res_dict, ds) -> list[dict]:
285285
return basin_dicts
286286

287287

288+
def _get_remote_features_from_basins(ds):
289+
"""Return list of remote features from basins of this dataset"""
290+
features = []
291+
for bn in ds.basins_get_dicts():
292+
if bn["type"] == "remote":
293+
features += bn["features"]
294+
return sorted(set(features))
295+
296+
288297
def _is_basin_of_dataset(ds,
289298
resource_basin,
290299
basin_dict,

0 commit comments

Comments
 (0)