Skip to content

Commit

Permalink
Bulk Creation User Model
Browse files Browse the repository at this point in the history
  • Loading branch information
shiva-menta committed Jan 24, 2024
1 parent 0de7037 commit dcf81ab
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions backend/clubs/management/commands/stress_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class Command(BaseCommand):
"""

def setUp(self):
self.num_clubs = 500
self.num_users = 1000
self.subset_size = 3
self.num_questions_per_club = 5
self.total_submissions = 3
self.num_clubs = 10
self.num_users = 10
self.subset_size = 1
self.num_questions_per_club = 2
self.total_submissions = 1
self.club_prefix = "test_club_"
self.user_prefix = "test_user_"

Expand Down Expand Up @@ -69,6 +69,7 @@ def setUp(self):
word_limit=150,
application=application,
)
for _ in range(self.num_questions_per_club)
for application in applications
]
ApplicationQuestion.objects.bulk_create(questions)
Expand Down Expand Up @@ -155,6 +156,7 @@ async def handleAsync(self, *args, **kwargs):
)
tasks.append(task)
all_tasks = await asyncio.gather(*tasks, return_exceptions=True)
print(all_tasks)
end_time = time.time()

print(f"Throughput was: {sum(all_tasks) / len(all_tasks)} seconds per txn.")
Expand All @@ -164,8 +166,8 @@ def handle(self, *args, **kwargs):
self.setUp()
try:
asyncio.run(self.handleAsync(args, kwargs))
# self.tearDown()
self.tearDown()
except Exception as e:
print(e)
logging.exception("Something happened!")
# self.tearDown()
self.tearDown()

0 comments on commit dcf81ab

Please sign in to comment.