diff --git a/API/api_worker.py b/API/api_worker.py index 5dbf4d40..48281f27 100644 --- a/API/api_worker.py +++ b/API/api_worker.py @@ -19,7 +19,12 @@ from src.config import USE_S3_TO_UPLOAD as use_s3_to_upload from src.config import logger as logging from src.query_builder.builder import format_file_name_str -from src.validation.models import DatasetConfig, RawDataOutputType +from src.validation.models import ( + DatasetConfig, + DynamicCategoriesModel, + RawDataCurrentParams, + RawDataOutputType, +) celery = Celery("Raw Data API") celery.conf.broker_url = celery_broker_uri @@ -32,6 +37,7 @@ @celery.task(bind=True, name="process_raw_data") def process_raw_data(self, params): + params = RawDataCurrentParams(**params) try: start_time = dt.now() bind_zip = params.bind_zip if ALLOW_BIND_ZIP_FILTER else True @@ -188,6 +194,7 @@ def process_raw_data(self, params): @celery.task(bind=True, name="process_hdx_request") def process_hdx_request(self, params): + params = DynamicCategoriesModel(**params) if not params.dataset: params.dataset = DatasetConfig() hdx_object = HDX(params) diff --git a/API/hdx.py b/API/hdx.py index 1421fe6a..f358fa00 100644 --- a/API/hdx.py +++ b/API/hdx.py @@ -394,6 +394,6 @@ async def process_hdx_requests( """ queue_name = "raw_special" task = process_hdx_request.apply_async( - args=(params,), queue=queue_name, track_started=True + args=(params.model_dump(),), queue=queue_name, track_started=True ) return JSONResponse({"task_id": task.id, "track_link": f"/tasks/status/{task.id}/"}) diff --git a/API/raw_data.py b/API/raw_data.py index b9f010e0..d22cf456 100644 --- a/API/raw_data.py +++ b/API/raw_data.py @@ -446,7 +446,7 @@ def get_osm_current_snapshot_as_file( # queue_name = "raw_special" if not params.uuid else "raw_default" queue_name = "raw_default" # Everything directs to default now task = process_raw_data.apply_async( - args=(params,), queue=queue_name, track_started=True + args=(params.model_dump(),), queue=queue_name, track_started=True ) return JSONResponse({"task_id": task.id, "track_link": f"/tasks/status/{task.id}/"})