queue icon indicating copy to clipboard operation
queue copied to clipboard

[IMP] queue_job: Add split method

Open paradoxxxzero opened this issue 1 year ago • 8 comments

This is a draft PR trying an alternative approach for https://github.com/OCA/queue/pull/566

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

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

    # or

     def copy_all_partners(self):
          # Duplicate all partners in batches of 30:
          self.delayable().set(description='Copy Partners').copy().split(30).delay()

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

The split function on Delayable returns a DelayableGroup.

This is an attempt and I am open to suggestions

paradoxxxzero avatar Jun 04 '24 07:06 paradoxxxzero

Hi @guewen, some modules you are maintaining are being modified, check this out!

OCA-git-bot avatar Jun 04 '24 07:06 OCA-git-bot

The coverage does not seem to include the unittest :/

paradoxxxzero avatar Jun 04 '24 14:06 paradoxxxzero

The coverage does not seem to include the unittest :/

Import the new test in tests/__init__.py

amh-mw avatar Jun 04 '24 14:06 amh-mw

They weren't run as they were unitest.TestCase, I changed them to TransactionCase for odoo to run them.

paradoxxxzero avatar Jun 04 '24 15:06 paradoxxxzero

I added a chain parameter to split into a chain instead of a group.

Is there anything lacking for this to be merged?

paradoxxxzero avatar Jul 02 '24 10:07 paradoxxxzero

Is there anything lacking for this to be merged?

Just the attention of @OCA/connector-maintainers

amh-mw avatar Jul 02 '24 11:07 amh-mw

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

OCA-git-bot avatar Jul 17 '24 08:07 OCA-git-bot

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

OCA-git-bot avatar Jul 17 '24 08:07 OCA-git-bot

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 Nov 17 '24 12:11 github-actions[bot]

As this is not touching any existing feature and is not adding a lot of code IMO we can move on w/ the merge. Yet, I think we miss a bit of documentation. Can you add something to the README pls?

simahawk avatar Nov 18 '24 13:11 simahawk

Done

paradoxxxzero avatar Nov 19 '24 08:11 paradoxxxzero

/ocabot merge minor

simahawk avatar Nov 19 '24 13:11 simahawk

On my way to merge this fine PR! Prepared branch 14.0-ocabot-merge-pr-658-by-simahawk-bump-minor, awaiting test results.

OCA-git-bot avatar Nov 19 '24 13:11 OCA-git-bot

Congratulations, your PR was merged at cf2ff24f186468af40cfc27ddaa3d59959875496. Thanks a lot for contributing to OCA. ❤️

OCA-git-bot avatar Nov 19 '24 13:11 OCA-git-bot