-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: add backfill one off scripts #734
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #734 +/- ##
==========================================
- Coverage 98.09% 98.02% -0.07%
==========================================
Files 432 438 +6
Lines 36325 36283 -42
==========================================
- Hits 35632 35566 -66
- Misses 693 717 +24
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #734 +/- ##
==========================================
- Coverage 98.09% 98.02% -0.07%
==========================================
Files 432 438 +6
Lines 36325 36283 -42
==========================================
- Hits 35632 35566 -66
- Misses 693 717 +24
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #734 +/- ##
==========================================
- Coverage 98.09% 98.02% -0.07%
==========================================
Files 432 438 +6
Lines 36325 36283 -42
==========================================
- Hits 35632 35566 -66
- Misses 693 717 +24
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #734 +/- ##
==========================================
- Coverage 98.09% 98.02% -0.07%
==========================================
Files 432 438 +6
Lines 36325 36283 -42
==========================================
- Hits 35632 35566 -66
- Misses 693 717 +24
Flags with carried forward coverage won't be shown. Click here to find out more.
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_scaffold.settings") | ||
django.setup() |
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.
any reason this is duplicated from the main
script? does this actually run twice when you import one of the child scripts?
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.
These scripts are meant to be run separately from the actual application running on a pod so we'd invoke it directly using python one_off_script.py
and that means we have to setup django separately
try: | ||
first_test_instance = TestInstance.objects.filter( | ||
test_id=test.id | ||
).select_related("upload")[0] | ||
except IndexError: | ||
continue |
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 first
method might be an alternative here, it even mentions it being the same pattern in its doc example.
these are one off python scripts to be run directly that will modify the database the first backfills the daily test rollups starting on a given day, and ending on a given date, starting for a given repo (it will backfill in repo id order) the second backfills the TestFlagBridge objects for all repos with the option to focus on a given repo, specified by repoid
first_test_instance = ( | ||
TestInstance.objects.filter(test_id=test.id) | ||
.select_related("upload") | ||
.first() |
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.
my comment might have been confusing. I believe first
returns None
if the element does not exist instead of the IndexError
.
e795f6d
to
66a56d1
Compare
This PR includes changes to |
).order_by("repoid") | ||
|
||
if start_repoid is not None: | ||
test_analytics_repos = test_analytics_repos.filter(repoid__gte=start_repoid) |
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.
smart
these are one off python scripts to be run directly that will modify the database
the first backfills the daily test rollups starting on a given day, and ending on a given date, starting for a given repo (it will backfill in repo id order)
the second backfills the TestFlagBridge objects for all repos with the option to focus on a given repo, specified by repoid