Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] [ADD] queue_job_batch_size #566

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from

Conversation

paradoxxxzero
Copy link

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.

Copy link
Contributor

@amh-mw amh-mw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generally feels like it should be an improvement to queue_job_batch, not its own module. I'm setting up a local test environment today and will report back with observations.

channel=None,
identity_key=None,
batch_size=None,
batch_count=None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems straightforward enough, but the corresponding change to def delayable is missing.

Copy link

github-actions bot commented Jul 7, 2024

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 github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jul 7, 2024
@simahawk
Copy link
Contributor

simahawk commented Jul 18, 2024

@paradoxxxzero shall we close this one in favor of #658 ?

@github-actions github-actions bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants