diff --git a/docling_serve/__main__.py b/docling_serve/__main__.py index 38b0f7e..b2fa616 100644 --- a/docling_serve/__main__.py +++ b/docling_serve/__main__.py @@ -376,6 +376,7 @@ def rq_worker() -> Any: results_prefix=docling_serve_settings.eng_rq_results_prefix, sub_channel=docling_serve_settings.eng_rq_sub_channel, scratch_dir=get_scratch(), + results_ttl=docling_serve_settings.eng_rq_results_ttl, ) cm_config = DoclingConverterManagerConfig( diff --git a/docling_serve/orchestrator_factory.py b/docling_serve/orchestrator_factory.py index 64f4462..514f641 100644 --- a/docling_serve/orchestrator_factory.py +++ b/docling_serve/orchestrator_factory.py @@ -202,9 +202,11 @@ async def _store_task_in_redis(self, task: Task) -> None: data: dict[str, Any] = { "task_id": task.task_id, - "task_type": task.task_type.value - if hasattr(task.task_type, "value") - else str(task.task_type), + "task_type": ( + task.task_type.value + if hasattr(task.task_type, "value") + else str(task.task_type) + ), "task_status": task.task_status.value, "processing_meta": meta, } @@ -312,6 +314,7 @@ class RedisAwareRQOrchestrator(RedisTaskStatusMixin, RQOrchestrator): # type: i results_prefix=docling_serve_settings.eng_rq_results_prefix, sub_channel=docling_serve_settings.eng_rq_sub_channel, scratch_dir=get_scratch(), + results_ttl=docling_serve_settings.eng_rq_results_ttl, ) return RedisAwareRQOrchestrator(config=rq_config) diff --git a/docling_serve/settings.py b/docling_serve/settings.py index 0ee088a..fd3360c 100644 --- a/docling_serve/settings.py +++ b/docling_serve/settings.py @@ -80,6 +80,7 @@ class DoclingServeSettings(BaseSettings): eng_rq_redis_url: str = "" eng_rq_results_prefix: str = "docling:results" eng_rq_sub_channel: str = "docling:updates" + eng_rq_results_ttl: int = 3_600 * 4 # 4 hours default # KFP engine eng_kfp_endpoint: Optional[AnyUrl] = None eng_kfp_token: Optional[str] = None diff --git a/docs/configuration.md b/docs/configuration.md index 3d4c112..06de940 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -98,6 +98,7 @@ The following table describes the options to configure the Docling Serve RQ engi | `DOCLING_SERVE_ENG_RQ_REDIS_URL` | (required) | The connection Redis url, e.g. `redis://localhost:6373/` | | `DOCLING_SERVE_ENG_RQ_RESULTS_PREFIX` | `docling:results` | The prefix used for storing the results in Redis. | | `DOCLING_SERVE_ENG_RQ_SUB_CHANNEL` | `docling:updates` | The channel key name used for storing communicating updates between the workers and the orchestrator. | +| `DOCLING_SERVE_ENG_RQ_RESULTS_TTL` | `14400` (4 hours) | Time To Live (in seconds) for RQ job results in Redis. This controls how long job results are kept before being automatically deleted. | #### KFP engine