Skip to content

Commit

Permalink
pass through modules in merge_datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
dale-wahl committed Nov 29, 2024
1 parent 0792ef4 commit 1396bb5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions processors/conversion/merge_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,23 @@ def is_compatible_with(cls, module=None, user=None):
return module.get_extension() in ("csv", "ndjson") and (module.is_from_collector())

@staticmethod
def get_dataset_from_url(url, db):
def get_dataset_from_url(url, db, modules=None):
"""
Get dataset object based on dataset URL
Uses the last part of the URL path as the Dataset ID
:param str url: Dataset URL
:param db: Database handler (to retrieve metadata)
:param modules: Modules handler (pass through to DataSet)
:return DataSet: The dataset
"""
if not url:
raise DataSetException("URL empty or not provided")

source_url = ural.normalize_url(url)
source_key = source_url.split("/")[-1]
return DataSet(key=source_key, db=db)
return DataSet(key=source_key, db=db, modules=modules)

def process(self):
"""
Expand All @@ -96,7 +97,7 @@ def process(self):
continue

try:
source_dataset = self.get_dataset_from_url(source_dataset_url, self.db)
source_dataset = self.get_dataset_from_url(source_dataset_url, self.db, modules=self.modules)
except DataSetException:
return self.dataset.finish_with_error(f"Dataset URL '{source_dataset_url} not found - cannot perform "
f"merge.")
Expand Down

0 comments on commit 1396bb5

Please sign in to comment.