-
Notifications
You must be signed in to change notification settings - Fork 8
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
create_unique sometimes causes excessive recursion #337
Comments
Here's a little code sample of what I am proposing: I will try to get around to testing it today/tomorrow
|
It probably means the regex always matches and a new incremental name is created. I like what you are suggesting above. Short and sweet. Any luck with testing? Testing is essentially checking that the tUmiTemplateEditor can read a template library produced by archetypal. Unfortunately, there isn't an official schema we can test against because the UmiTemplateLibrary does not follow a regular schema. This is somewhat a side-conversation but I was wondering if you had any thoughts as to how to improve the format of the template library. It looks like it is an ORM serialized into different lists. |
Do you mean the format at the mongo db level? Or in archetypal/pyumi? Just took a quick look at the schema in From our zoom on tuesday, I gather that main "issue" we are wanting to work around is this notion that all of the entities associated with a template (in the One possibility might be to just add a new Maybe this is not the question you were asking, if not let me know more what you were thinking about it trying to resolve and I will have a think on it. |
Yeah I was more thinking in terms of the structure of umi templates. Maybe we are stuck with the ORM based approach. It is just not meant to be serialized as json, if I am not mistaken; I have to make some real funky acrobatics to parse umi libraries in python. Btw, feel free to create a pull request if you think your fix solves the recursion issue. |
archetypal/archetypal/template/umi_base.py
Line 536 in d0aed03
This recursion call sometimes raises a
RecursionError: maximum recursion depth exceeded while calling a Python object
I have not yet been able to reliably repro - error is happening in umiverse flask backend.
Sometimes the following steps execute successfully, sometimes, the final step fails with an recursion error.
["MediumOffice_Post1980_2A", "MediumOffice_New2004_2A", "MediumOffice_Pre1980_2A"]
from MongoDB (though I have not yet found a single template or collection of templates which always causes the error - my guess is it has to do with the order that the templates arrive as results from the db, if that is not the same every time?)bld.to_template(...)
template_lib
withUmiTemplateLibrary(BuildingTemplates=[<templates>])
template_lib.unique_components()
template_lib.to_dict()
When it fails, this stack trace occurs:
Seems like there is some sort of issue with the regex matching when it shouldn't, causing the recurse call to keep happening.
It's possible to increase the python recursion limit (default is 1k I believe) if it is actually possible for the count to go past 1k, but that seems like it shouldn't be necessary, and anyways doesn't seem like the most performant solution if it is. I wonder if it makes sense to use a method like keeping track of the count for each base name, and then just incrementing that, rather than trying to determine the current count with the regex and then recursing.
The text was updated successfully, but these errors were encountered: