← Back to team overview

mahara-contributors team mailing list archive

[Bug 1680633] Re: Cron job metadata

 

** Changed in: mahara
    Milestone: 18.04.0 => 18.10.0

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1680633

Title:
  Cron job metadata

Status in Mahara:
  Confirmed

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1680633/+subscriptions


References