-
Notifications
You must be signed in to change notification settings - Fork 24
adds daily task to update global bot leaderboard, refactors command for convenience #3933
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing that happens here is to factor out the handle action so it can be called with a task
| bootstrap_iterations = 30 | ||
|
|
||
| # SETUP: users to evaluate & questions | ||
| print("Initializing...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prints won't be typically visible in django command handlers, so I suggest using logging instead
| metadata__bot_details__metac_bot=True, | ||
| metadata__bot_details__include_in_calculations=True, | ||
| metadata__bot_details__display_in_leaderboard=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this might be a slow operation since we don't index User.metadata col
| related_posts__post__default_project_id__in=[ | ||
| 3349, # aib q3 2024 | ||
| 32506, # aib q4 2024 | ||
| 32627, # aib q1 2025 | ||
| 32721, # aib q2 2025 | ||
| 32813, # aib fall 2025 | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to refactor this so we don’t hardcode these values here?
At the very least, I’d move these IDs into constants.py.
| Score.objects.filter(user=user, question__in=question_list) | ||
| .distinct("question_id") | ||
| .count() | ||
| .exclude(related_posts__post__default_project__slug__startswith="minibench") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned here, I don't like this slug approach
closes #3808
This task will take ~20 minutes long, so it might be worth considering optimizing the approach.
The only thing that takes a long time is the head to head scoring for popular questions. The simplest solution would be to store all of the head to head scores at question resolution in a new table. This would take the task down to 1-2 minutes from upwards of 30 (and maybe some memory issues).