Skip to content

BOM import / export improvements - #2349

Closed
SchrodingersGat wants to merge 12 commits into
inventree:masterfrom
SchrodingersGat:import-wizard
Closed

SchrodingersGat wants to merge 12 commits into
inventree:masterfrom
SchrodingersGat:import-wizard

Conversation

@SchrodingersGat

Copy link
Copy Markdown
Member

No description provided.

@SchrodingersGat

Copy link
Copy Markdown
Member Author

Closing for now, this approach is not working...

@SchrodingersGat
SchrodingersGat deleted the import-wizard branch December 13, 2021 12:13
@matmair

matmair commented Dec 13, 2021

Copy link
Copy Markdown
Member

@SchrodingersGat what was the problem / painpoint?

@SchrodingersGat

Copy link
Copy Markdown
Member Author

The current BOM import is incredibly slow, especially when you have a db with lots (> 1000) of parts.

The existing import process iterates through every single part, for each imported line item. It takes enough time to timeout our production server at work.

There are a few different approaches I've been considering, I want to reduce code duplication as much as possible also. I've been trying to work out how we can use django-import-export to do the bulk of the heavy lifting here.

@matmair

matmair commented Dec 13, 2021

Copy link
Copy Markdown
Member

@SchrodingersGat I meant with the PR 😆

@SchrodingersGat

Copy link
Copy Markdown
Member Author

Ah, I wanted to investigate some other options...

@matmair

matmair commented Dec 13, 2021 •

Copy link
Copy Markdown
Member

I tried using import-export for something similar a while ago and gave up on it. Anything per-line is problematic. I found it is faster to do this in multiple subsequent steps. So create all parts as a bulk operation, then run all operations that need to run on the new objects. Also optimising the save() overrides and signals helped a lot with my last project. Maybe this is an option for us too. Profiling is def. a must for something like this.

@SchrodingersGat

Copy link
Copy Markdown
Member Author

I also found django-data-wizard which might be an option, but it doesn't feel like it's 100% the right solution... I'll keep having a tinker

@matmair

matmair commented Dec 13, 2021

Copy link
Copy Markdown
Member

@SchrodingersGat I am quite full this week but I would love to give it a try next week. Could you add a foo file that reflects the structure that makes the problem you want to be solved? So we can have a baseline to run tests against?

@eeintech

Copy link
Copy Markdown
Contributor

It's probably only the 3rd step (part matching) that needs profiling/speed improvement, right? Even with 1000s of parts in DB the matching should be straightforward with IPN, maybe not so much with name of description though...

@SchrodingersGat

Copy link
Copy Markdown
Member Author

@eeintech the third step is the worst offender, true.

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