From 3865f141cd377040887856c98a074b7810ecdbb1 Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Tue, 2 Jul 2024 12:42:29 +0200 Subject: [PATCH] [IMP] queue_job: Add chain parameter on split method --- queue_job/delay.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/queue_job/delay.py b/queue_job/delay.py index 1836ce8550..00603b6840 100644 --- a/queue_job/delay.py +++ b/queue_job/delay.py @@ -534,9 +534,9 @@ def delay(self): """Delay the whole graph""" self._graph.delay() - def split(self, size): - """Split the Delayable into a DelayableGroup containing batches - of size `size` + def split(self, size, chain=False): + """Split the Delayable into a DelayableGroup or DelayableChain + if `chain` is True containing batches of size `size` """ if not self._job_method: raise ValueError("No method set on the Delayable") @@ -576,7 +576,7 @@ def split(self, size): # Prevent warning on deletion self._generated_job = True - return DelayableGroup(*delayables) + return (DelayableChain if chain else DelayableGroup)(*delayables) def _build_job(self): if self._generated_job: