Cron job metadata

Bug #1680633 reported by Kenneth Hendricks
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Confirmed
Wishlist
Kenneth Hendricks

Bug Description

Hello,

Currently the meta data stored for cron jobs is fairly limited having only the following fields:
<TABLE NAME="cron">
    <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
        <FIELD NAME="callfunction" TYPE="char" LENGTH="255" NOTNULL="true" />
        <FIELD NAME="nextrun" TYPE="datetime" NOTNULL="false" />
        <FIELD NAME="minute" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*" />
        <FIELD NAME="hour" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*" />
        <FIELD NAME="day" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*" />
        <FIELD NAME="month" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*" />
        <FIELD NAME="dayofweek" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*" />
    </FIELDS>

We are implementing a plugin for Mahara that will mirror the cron check functionality present in this Moodle plugin: https://github.com/brendanheywood/moodle-tool_heartbeat.

It would be beneficial if Mahara included two new fields in the cron and the plugintype_cron tables:

1. lastruntime - the last runtime of the cron job.

Currently on /admin/statistics.php the following sql is used to determine if cron has run.
record_exists_select('cron', 'nextrun IS NULL OR nextrun < CURRENT_DATE') - from a monitoring standpoint this is not acceptable as it will give false positives/negatives depending on the situation. With this change, the max lastruntime could be used to determine if cron had run recently.

2. faildelay - An Exponentially increasing fail delay that is updated when the cron job fails (if it throws an exception). This way if there is a consistently failing cron job its execution is throttled and its failure is being tracked in some way aside from just logging an error. The heartbeat plugin above uses this to help us to identify and fix issues that would otherwise go undetected.

Aside from the benefits from a monitoring perspective, these fields provide useful information when it comes to debugging anything cron related.

I'm happy to discuss at any time and more than happy to do the dev on this. Ill be floating around the Mahara IRC under the kenH handle if you would like to talk at any time.

Thanks,
Kenneth

Changed in mahara:
assignee: nobody → Kenneth Hendricks (kennethhendricks)
milestone: none → 17.10.0
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Robert Lyon (robertl-9) wrote :

Hi Kenneth

What you propose in indeed something that Mahara could use!

And I am more than happy to answer any questions you have if you were to take on the dev for this.

Cheers

Robert

Robert Lyon (robertl-9)
Changed in mahara:
milestone: 17.10.0 → 18.04.0
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 18.04.0 → 18.10.0
Changed in mahara:
importance: Medium → Wishlist
milestone: 18.10.0 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.