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

[BUG] ORM object reprs are excessively large #656

Open
chisholm opened this issue Oct 16, 2024 · 0 comments
Open

[BUG] ORM object reprs are excessively large #656

chisholm opened this issue Oct 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@chisholm
Copy link
Collaborator

Describe the bug
The repr of a single object can be enormous.

To Reproduce
Steps to reproduce the behavior:

You can try the following script:

# This creates 10 queues each of which has 3 tags randomly chosen from a
# set of 10.
import random
import dioptra.restapi.db.models as m

user = m.User("name", "password", "[email protected]")
group = m.Group("groupname", user)

tags = [m.Tag(f"tag_{i}", group, user) for i in range(10)]

queues = []
for i in range(10):
    res = m.Resource("queue", group)
    queues.append(m.Queue("a queue", res, user, f"queue_{i}"))

for queue in queues:
    queue.tags.extend(random.sample(tags, k=3))

print(repr(queues[0]))

This will repr one of the queues so created. You'll want to redirect the output to a file and wait a bit. I've run this a couple times; both times, the resulting file was over 1GB in size!

Expected behavior

A reasonably sized repr.

@chisholm chisholm added the bug Something isn't working label Oct 16, 2024
jkglasbrenner pushed a commit that referenced this issue Nov 8, 2024
This update reduces the size of reprs of instances of all ORM-mapped classes.

Closes #656
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant