Closed Bug 1330391 Opened 8 years ago Closed 8 years ago

SETA - Logic to bootstrap SETA is not expecting load_preseed to run first

Categories

(Tree Management Graveyard :: Treeherder: SETA, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: armenzg, Assigned: anejaalisha)

References

Details

Attachments

(2 files)

The logic we added for bootstrapping [1] makes all jobs to have expiration_date to be null if the table is empty. If it is not empty it creates the rows with expiration date of 2 weeks. Unfortunately, in the PR we recently made "load_preseed" to run first which adds a bunch of talos and PGO test builders. Thus, when analyze failures runs for the first time, the table is not empty and rows are created with 2 weeks expiration date. I can fix the production data but this should be fixed to allow users setting this up locally to not be in an improper state. I will run the command via TH folks. The other option is to guarantee that load_preseed would run after the first time "analyze_failures" has run. [1] https://github.com/mozilla/treeherder/blob/master/treeherder/seta/update_job_priority.py#L131-L144
I have deleted all job priorities and run the commands in the right order. In short: ~ $ ./manage.py shell >>> from treeherder.seta.models import JobPriority >>> JobPriority.objects.all().delete() ~ $ ./manage.py analyze_failures ~ $ ./manage.py load_preseed >>> len(JobPriority.objects.filter(expiration_date__gt=datetime.date(2017, 2, 1))) 256 Longer output: armenzg-loaner:treeherder armenzg$ heroku run --app treeherder-prod bash Running bash on ⬢ treeherder-prod... up, run.4331 (Standard-1X) /tmp/memcachier-stunnel.conf ~ $ ./manage.py shell Python 2.7.13 (default, Dec 17 2016, 23:50:34) [GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from treeherder.seta.models import JobPriority >>> len(JobPriority.objects.filter(expiration_date__isnull=False)) 2273 >>> len(JobPriority.objects.filter(expiration_date__isnull=True)) 0 >>> JobPriority.objects.filter(expiration_date__isnull=False)[100].expiration_date datetime.datetime(2017, 1, 25, 19, 18, 26, 245809) >>> JobPriority.objects.all().delete() (2273L, {u'seta.JobPriority': 2273L}) >>> JobPriority.objects.all() <QuerySet []> >>> exit() ~ $ ./manage.py analyze_failures ~ $ ./manage.py load_preseed >>> from treeherder.seta.models import JobPriority >>> import datetime >>> len(JobPriority.objects.filter(expiration_date__gt=datetime.date(2017, 2, 1))) 256
rwood: this is a bug that you will notice when loading the job priorities endpoint. It will always kick in when you start TH from scratch (Using vagrant up for the first time OR after you use 'vagrant destroy; vagrant up'; maybe after 'vagrant provision; vagrant up' as well). You can fixing by running these: > ~ $ ./manage.py shell > >>> from treeherder.seta.models import JobPriority > >>> JobPriority.objects.all().delete() > ~ $ ./manage.py analyze_failures > ~ $ ./manage.py load_preseed
Component: Treeherder → Treeherder: SETA
Assignee: nobody → anejaalisha
Attachment #8841155 - Flags: review?(jmaher)
Comment on attachment 8841155 [details] [treeherder] alisha17:Bug1330391-SETA-is-not-expecting-load_preseed-to-run-first > mozilla:master marking r- for now based on comment in the PR- great start.
Attachment #8841155 - Flags: review?(jmaher) → review-
Attachment #8841155 - Flags: review- → review?(jmaher)
Comment on attachment 8841155 [details] [treeherder] alisha17:Bug1330391-SETA-is-not-expecting-load_preseed-to-run-first > mozilla:master sorry for the r- again, I left 2 comments in the PR, this is looking to me as if the solution is much closer to ideal.
Attachment #8841155 - Flags: review?(jmaher) → review-
Yup, there were some mistakes in the last commit. But I think the recent commit is the solution. Also, I don't think we need to add load_preseed command because now it's not being called anywhere. Only thing is we need to document somewhere that reset_seta management command erases all JobPriority DB entries, so it needs to be run on clean dev environment.
Attachment #8841155 - Flags: feedback?(jmaher)
Comment on attachment 8841155 [details] [treeherder] alisha17:Bug1330391-SETA-is-not-expecting-load_preseed-to-run-first > mozilla:master I don't see any big changes, but I still have a question pending about changing the command from load_preseed to reset_seta and who will call that.
Attachment #8841155 - Flags: feedback?(jmaher) → feedback+
(In reply to Joel Maher ( :jmaher) from comment #7) > Comment on attachment 8841155 [details] > [treeherder] > alisha17:Bug1330391-SETA-is-not-expecting-load_preseed-to-run-first > > mozilla:master > > I don't see any big changes, but I still have a question pending about > changing the command from load_preseed to reset_seta and who will call that. load_initial_data management command now instead of load_preseed will call reset_seta command which ensures JobPriority table is empty and then analyze_failures and load_preseed will run which prevents creation of rows with 2 weeks expiration time. This is according to my understanding of the issue and it's solution as :rwood-moz suggested here:https://github.com/mozilla/treeherder/pull/2203/files/9751f6c740a4dba48f398f31b43f6180c028d9d3. Since this is my first SETA bug,I am not so familiar with it,so I might be wrong. Please suggest me how should I proceed to correctly resolve it:)
Commit pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/55770698e3460de4fa643abbac0016253cf691e6 Bug 1330391 - Make load_preseed do nothing if JobPriority table empty (#2418) Since it depends on analyze_failures having populated it first.
Thank you for fixing this! :-)
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Product: Tree Management → Tree Management Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: