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

[IMP] start extraction of chunk processing \o/ #80

Open
wants to merge 10 commits into
base: 14.0
Choose a base branch
from

Conversation

sebastienbeau
Copy link
Contributor

@sebastienbeau sebastienbeau commented Dec 8, 2021

/!\ Big change

Start the extraction of chunk processing, the aim is to have a generic module that manage chunk processing (this can be usefull in the EDI project)
I will see with oca team where to move this generic chunk processing

TODO:

  • finish extraction
  • add test
  • migrate data
  • start using it in other project

Copy link
Contributor

@kevinkhao kevinkhao left a comment

Choose a reason for hiding this comment

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

code review LGTM just some minor suggestions on readability


class ChunkGroup(models.Model):
_inherit = "collection.base"
_name = "chunk.group"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the word "batch" is very standard and expressive for this kind of purpose, instead of "group"

usage = fields.Char()

@api.depends("item_ids.nbr_error", "item_ids.nbr_success")
def _compute_stat(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpicking: stats

def _create_chunk(self, start_idx, stop_idx, data):
vals = self._prepare_chunk(start_idx, stop_idx, data)
chunk = self.env["chunk.item"].create(vals)
# we enqueue the chunk in case of multi process of if it's the first chunk
Copy link
Contributor

Choose a reason for hiding this comment

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

this comment gives no new info, is equivalent to reading the next line


def split_in_chunk(self):
"""Split Group into Chunk"""
# purge chunk in case of retring a job
Copy link
Contributor

Choose a reason for hiding this comment

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

retrying

@@ -12,9 +12,9 @@
<field name="state" />
<field name="date_done" readonly="1" />
<field name="kind" />
<field name="nbr_error" />
<!--<field name="nbr_error" />
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this was forgotten, same for L17

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.

2 participants