Closed Bug 697772 Opened 13 years ago Closed 13 years ago

Need new cron jobs for reports_clean, hang_report

Categories

(Socorro :: General, task)

x86
macOS
task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jberkus, Assigned: lonnen)

Details

We'll need some new cron jobs for the new reports.  Particularly:

update_reports_clean( timestamp, interval ) which should really run hourly, and depends on job report_duplicates (which is a preexisting job, but probably not currently part of the dependancy system).

update_hang_report ( update date ) which gets run daily, but depends on reports_clean having completed for the previous hour.

I don't know if rhelmer set up anything for this before he left ...
Hmmm, I just realized the timestamp and interval thing for update_reports_clean is a bit too complicated for cron.  So I've added a new simpler function:

update_reports_clean_cron( timestamptz )

That runs the reports_clean update for a period of one hour, ending at the clock hour of the timestamp supplied.  In other words if you run:

update_reports_clean_cron( '2011-10-15 15:17:22' )

it will fill in reports_clean for the period '2011-10-15 14:00:00' to '2011-10-15 15:00:00'.
Just to make things more complicated, reports_clean (like OldTCBS) should run behind the clock time ... say, 2 hours behind.  Just to make sure we don't miss any trailing reports.
Assignee: rhelmer → chris.lonnen
The cron for update_hang_report was added as part of Rhelmer's last large batch of commits for the hang report. I've drafted the crons for update_reports_clean and you can check the code here: https://github.com/Lonnen/socorro/compare/master...697772-draft

I do not know how to introduce the necessary dependencies for these. Rob, feel free to take this, or talk with me on Monday morning and we'll get things figured out.
Assignee: chris.lonnen → nobody
(In reply to Chris Lonnen :lonnen from comment #3)
> The cron for update_hang_report was added as part of Rhelmer's last large
> batch of commits for the hang report. I've drafted the crons for
> update_reports_clean and you can check the code here:
> https://github.com/Lonnen/socorro/compare/master...697772-draft
> 
> I do not know how to introduce the necessary dependencies for these. Rob,
> feel free to take this, or talk with me on Monday morning and we'll get
> things figured out.

We don't really have a cross-cronjob dependency system going yet, the closest example of this is the "newtcbs" cron (not a great name) which implements dependencies in the context of a single cron job (call stored procedure, if it fails either continue or not depending on dependency rules).

I think right now it would be simpler to:

a) have one cron job which calls the stored procedures in the order you need
or
b) have the stored procedure check to see if dependencies have been satisfied

(b) is similar to what a lot of the aggregation functions do now, by checking the data itself.

We could make this more efficient by using the cronjobs table (either now or in a near-future release) instead of checking the data directly.

Now that I think about it, we had intended the cronjobs table to be modified from python code but maybe it'd make more sense for it to be done as postgres functions?
Assignee: nobody → rhelmer
Status: NEW → ASSIGNED
rhelmer,

Sure, that would be easy.  Let's tackle that for 2.3.3?

In the meantime, just make sure reports_duplicates is first in the cronjob sequence, and that it's running for the right time window to be "before" update_reports_clean.

There's also the issue of checking for the "last hour in the day" for reports_clean before we run the daily cronjobs, which I don't think we're prepared for either.
Commit pushed to https://github.com/mozilla/socorro

https://github.com/mozilla/socorro/commit/d5fcbb5b4186eb52a1c8d5aab0083836560ae120
Merge pull request #122 from Lonnen/697772-reports-clean-cron

Bug 697772 add update_reports_clean cron
Assignee: rhelmer → chris.lonnen
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Component: Socorro → General
Product: Webtools → Socorro
You need to log in before you can comment on or make changes to this bug.