User profile troubleshooting#142
Closed
crockettz wants to merge 3 commits into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the daily user-stats upload pipeline to fetch user profile data in batches (with retry/skip behavior) so that failures in the profile service don’t prevent processing all remaining users.
Changes:
- Refactors
get_profile_infoto request profile data in batches, retry failed batches, and optionally re-run a failing batch without known problematic users. - Adds exception-message truncation to avoid flooding logs with very large profile-service error payloads.
- Updates the cron entrypoint to call
get_profile_infowith explicit batching/retry parameters.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| source/daily_cron_jobs/upload_user_stats.py | Passes batching/retry parameters into get_profile_info during the daily upload run. |
| source/daily_cron_jobs/methods_upload_user_stats.py | Implements batched profile-service requests with retries, skipping behavior, and safer error logging. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+35
to
+38
| # rather than just failing to return that one user's profile. Add usernames | ||
| # here once you've tracked them down (see | ||
| # methods_upload_user_stats_troubleshooting.py) so get_profile_info retries | ||
| # their batch without them instead of losing every other user in it. |
Comment on lines
+335
to
+338
| matter how many times it's retried as-is. When a batch fails and it | ||
| contains one of these users, the batch is NOT retried unchanged. | ||
| Instead it's re-run exactly once more with just those users removed | ||
| (batch size n - len(bad users in that batch)), so the rest of the |
Comment on lines
364
to
+365
| counter = 0 | ||
| for obj in resp["result"][0]: | ||
| if obj is None: | ||
| continue | ||
| counter += 1 | ||
| if obj["user"]["username"] in user_stats_dict: | ||
| user_stats_dict[obj["user"]["username"]]["department"] = obj["profile"][ | ||
| "userdata" | ||
| ].get("department") | ||
| failed_batches = [] |
Comment on lines
+475
to
+477
| user_stats_dict[obj["user"]["username"]]["research_statement"] = obj["profile"][ | ||
| "userdata" | ||
| ].get("country") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batches the user profiles instead of running them all at once. When it comes across the user profiles that are causing trouble, skips those and continues on. Modified the upload script to account for the changes to the methods_upload script.