Skip to content

Commit

Permalink
[IMP] queue_job: Add chain parameter on split method
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Jul 2, 2024
1 parent 5459b92 commit 3865f14
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions queue_job/delay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3865f14

Please sign in to comment.