queue icon indicating copy to clipboard operation
queue copied to clipboard

[14.0] [ADD] queue_job_batch_size

Open paradoxxxzero opened this issue 2 years ago • 2 comments

This module allows to seemlessly split a big job into smaller jobs.

It uses queue_job_batch to group the created jobs into a batch.

Example:

  class ResPartner(models.Model):
      # ...

      def copy_all_partners(self):
          # Duplicate all partners in batches of 30:
          self.with_delay(batch_size=30).copy()

  # ...
  self.env['res.partner'].search([], limit=1000).copy_all_partners()

This will create 34 jobs, each one copying 30 partners (except the last one which will copy 10) and will group them into a batch.

Instead of batch_size, one can also use batch_count to specify the number of batches to create instead.

paradoxxxzero avatar Oct 20 '23 14:10 paradoxxxzero

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Jul 07 '24 12:07 github-actions[bot]

@paradoxxxzero shall we close this one in favor of https://github.com/OCA/queue/pull/658 ?

simahawk avatar Jul 18 '24 09:07 simahawk