Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-22183

Stats keeps running later and later - use scheduled task time only

    XMLWordPrintable

Details

    • MOODLE_19_STABLE, MOODLE_23_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE
    • MOODLE_30_STABLE, MOODLE_31_STABLE
    • wip-MDL-22183-master
    • Moderate
    • Hide

      Before upgrading

      1. Enable statistics [Site administration  ► Advanced features]
      2. Set time to run statistics cron ([Site administration  ► Server  ► Statistics] statsruntimestarthour) to something like 2:15 am.
      3. Upgrade.
      4. Check that the scheduled task now has a setting that is the same as the 'statsruntimestarthour' setting from before.
        1. [Site administration  ► Server  ► Scheduled tasks] Search for 'Background processing for statistics'.
        2. The setting should now look like 15 2 * * * 0 No
        3. The next run time should also be the time of the new setting.
      5. Revert the patch and this time configure the scheduled task [Site administration  ► Server  ► Scheduled tasks] for stats_cron_task to something like 3:12am
      6. Upgrade.
      7. Check that the scheduled task time has not changed.
      8. We are next going to start collecting statistics from the past. This requires alteration of the config table.
      9. Change the timestamp for 'statslastdaily', 'statslastweekly', and 'statslastmonthly' to a couple of months in the past.
      10. Purge the caches.
      11. run

        php admin/tool/task/cli/schedule_task.php --execute=\\core\\task\\stats_cron_task

        from the command line.

      12. The scheduled task should run and process about 30 days (unless you have set it to a different number in the settings).
      13. Keep running the task. Before the patch you would be limited to running the script once a day. Now it should run until it is up-to-date. Once up-to-date it will check to see if there is a full day of stats to run. If so it will process the days stats, if not it will just clean up and exit.

      Run the unit test for this change on master only:

      vendor/bin/phpunit lib/tests/statslib_test.php

      Show
      Before upgrading Enable statistics [Site administration  ► Advanced features] Set time to run statistics cron ( [Site administration  ► Server  ► Statistics] statsruntimestarthour) to something like 2:15 am. Upgrade. Check that the scheduled task now has a setting that is the same as the 'statsruntimestarthour' setting from before. [Site administration  ► Server  ► Scheduled tasks] Search for 'Background processing for statistics'. The setting should now look like 15 2 * * * 0 No The next run time should also be the time of the new setting. Revert the patch and this time configure the scheduled task [Site administration  ► Server  ► Scheduled tasks] for stats_cron_task to something like 3:12am Upgrade. Check that the scheduled task time has not changed. We are next going to start collecting statistics from the past. This requires alteration of the config table. Change the timestamp for 'statslastdaily', 'statslastweekly', and 'statslastmonthly' to a couple of months in the past. Purge the caches. run php admin/tool/task/cli/schedule_task.php --execute=\\core\\task\\stats_cron_task from the command line. The scheduled task should run and process about 30 days (unless you have set it to a different number in the settings). Keep running the task. Before the patch you would be limited to running the script once a day. Now it should run until it is up-to-date. Once up-to-date it will check to see if there is a full day of stats to run. If so it will process the days stats, if not it will just clean up and exit. Run the unit test for this change on master only: vendor/bin/phpunit lib/tests/statslib_test.php
    • 3.2 Sprint 4

    Description

      More information to come.

      Attachments

        Issue Links

          Activity

            People

              abgreeve Adrian Greeve
              bushido Mark Nielsen
              Eric Merrill Eric Merrill
              Dan Poltawski Dan Poltawski
              Jun Pataleta Jun Pataleta
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                12/Sep/16