Details

    • Testing Instructions:
      Hide

      Upgrade a site to the new cron system. Set cron to run every minute and verify that the tasks in the admin scheduled tasks page are running only when scheduled. Change some schedules for some tasks and verify they obey the new schedule. Reset them to their default schedule and verify they obey the default schedule again. Run all the unit tests. Verify that forum posts are still getting mailed. Verify that students still get mailed about assignment feedback.

      Check the web server logs for errors messages coming from any scheduled task.

      Show
      Upgrade a site to the new cron system. Set cron to run every minute and verify that the tasks in the admin scheduled tasks page are running only when scheduled. Change some schedules for some tasks and verify they obey the new schedule. Reset them to their default schedule and verify they obey the default schedule again. Run all the unit tests. Verify that forum posts are still getting mailed. Verify that students still get mailed about assignment feedback. Check the web server logs for errors messages coming from any scheduled task.
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-25505-master

      Description

      we will need some mock ups for creating the ui for the management interface.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Damyon Wiese added a comment -

            Work in progress screenshot.

            Show
            Damyon Wiese added a comment - Work in progress screenshot.
            Hide
            Damyon Wiese added a comment -

            This is ready for review. It contains MDL-25500 as the first commit (which has already had lots of reviews) - but the rest of the commits have not been reviewed.

            Show
            Damyon Wiese added a comment - This is ready for review. It contains MDL-25500 as the first commit (which has already had lots of reviews) - but the rest of the commits have not been reviewed.
            Hide
            Petr Skoda added a comment -

            what a tiny patch...

            Show
            Petr Skoda added a comment - what a tiny patch...
            Hide
            CiBoT added a comment -

            Results for MDL-25505

            • Remote repository: git://github.com/damyon/moodle.git
            Show
            CiBoT added a comment - Results for MDL-25505 Remote repository: git://github.com/damyon/moodle.git Remote branch MDL-25505 -master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/938 Error: The MDL-25505 -master branch at git://github.com/damyon/moodle.git exceeds the maximum number of commits ( 50 > 15)
            Hide
            Petr Skoda added a comment - - edited

            1/ Hmm, the new /admin/task is wrong, all new things should go to /admin/tool/task/, could you please move it? This will allow you to put the form ui into UI /admin/tool/task/classes/form.php
            2/ the new table names seem wrong, why not start all new tables with task_*, we did it for most other things.
            3/ the try {} catch around individual tasks needs to deal with DB transactions and DBM errors, it cannot just continue because we need to manually rollback if we skip default handler
            4/ admin/task/scheduledtasks.php does not have license docs block
            5/ this is going to collide with our "new logging" branch, but that will be resolved when necessary

            Show
            Petr Skoda added a comment - - edited 1/ Hmm, the new /admin/task is wrong, all new things should go to /admin/tool/task/, could you please move it? This will allow you to put the form ui into UI /admin/tool/task/classes/form.php 2/ the new table names seem wrong, why not start all new tables with task_*, we did it for most other things. 3/ the try {} catch around individual tasks needs to deal with DB transactions and DBM errors, it cannot just continue because we need to manually rollback if we skip default handler 4/ admin/task/scheduledtasks.php does not have license docs block 5/ this is going to collide with our "new logging" branch, but that will be resolved when necessary
            Hide
            Petr Skoda added a comment -

            apart from those issues above I think it is ready for integration

            Show
            Petr Skoda added a comment - apart from those issues above I think it is ready for integration
            Hide
            Damyon Wiese added a comment -

            This branch contains all the issues listed with blocker links.

            Show
            Damyon Wiese added a comment - This branch contains all the issues listed with blocker links.
            Hide
            Damyon Wiese added a comment -

            I have fixed all the points raised by Petr above.

            Sending for integration. Toes crossed.

            Show
            Damyon Wiese added a comment - I have fixed all the points raised by Petr above. Sending for integration. Toes crossed.
            Hide
            Damyon Wiese added a comment -

            I just added a commit to un-deprecate the cron function cron_execute_plugin_type - this is being used by quiz and workshop to add cron support to subplugins.

            Note: Scheduled tasks are better than legacy cron - but I'm not in favour of rewriting all the legacy cron functions all at once.

            Why are scheduled tasks better than legacy cron and why should I refactory my plugin to use them? Because the legacy cron functions execute serially by a single cron process, a slow running cron will still hold up the queue and a failure will still fail the remaining legacy crons.

            Show
            Damyon Wiese added a comment - I just added a commit to un-deprecate the cron function cron_execute_plugin_type - this is being used by quiz and workshop to add cron support to subplugins. Note: Scheduled tasks are better than legacy cron - but I'm not in favour of rewriting all the legacy cron functions all at once. Why are scheduled tasks better than legacy cron and why should I refactory my plugin to use them? Because the legacy cron functions execute serially by a single cron process, a slow running cron will still hold up the queue and a failure will still fail the remaining legacy crons.
            Hide
            Tim Hunt added a comment -

            -1 for integration yet.

            1. Why are we adding a whole new API without

            2. Dayon's last comments. With this change, it seems that cron_execute_plugin_type should be deprecated. So, deprecate it properly, and fix all callers. Don't just leave legacy code around.

            Show
            Tim Hunt added a comment - -1 for integration yet. 1. Why are we adding a whole new API without A proposal in the wiki post in the forums to ask for comments and feedback (Yes, I know this was discussed some years ago, but that was years ago. Give people a chance to discuss specifics now.) http://docs.moodle.org/dev/Process#New_feature_development 2. Dayon's last comments. With this change, it seems that cron_execute_plugin_type should be deprecated. So, deprecate it properly, and fix all callers. Don't just leave legacy code around.
            Hide
            Petr Skoda added a comment - - edited

            What is the point of converting everything if there is full backwards compatibility? My +1 to get the new API in asap, I am personally volunteering to convert/cleanup both auth and enrol (once we get over the logging deadlock).

            BTW the proposal is up for discussion in wiki for ages http://docs.moodle.org/dev/Task_API (there is a docs link at the top) and from there leads a link to https://moodle.org/mod/forum/discuss.php?d=229139

            Show
            Petr Skoda added a comment - - edited What is the point of converting everything if there is full backwards compatibility? My +1 to get the new API in asap, I am personally volunteering to convert/cleanup both auth and enrol (once we get over the logging deadlock). BTW the proposal is up for discussion in wiki for ages http://docs.moodle.org/dev/Task_API (there is a docs link at the top) and from there leads a link to https://moodle.org/mod/forum/discuss.php?d=229139
            Hide
            Eloy Lafuente (stronk7) added a comment -

            The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

            TIA and ciao

            Show
            Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
            Hide
            Damyon Wiese added a comment -

            Hi Tim

            I have posted that I started working on it based on the original spec - kept the dev docs up to date, (http://docs.moodle.org/dev/Scheduled_Tasks_Proposal), posted when it was ready, written new API dev docs, gotten many peer reviews (thanks Fred and Petr), mentioned it in weekly meetings many times. This whole thing had already been discussed and agreed before I even started looking at it and nothing has really changed between then and when I started work on it.

            Re: Deprecation - in this case I favour encouraging new plugins to use this API - but in most cases the old way is good enough and the effort it changing plugins would not have any real benefits (in the case when the cron task is simple/quick anyway and the code is already written). This would affect a high percentage of community plugins and IMO forcing everyone to change their plugins is pointless. Specifically - cron_execute_plugin_type is used by plugins adding cron support for their own sub-plugins. Even if I deprecate it, we could not stop calling it until moodle 2.9 and so cron would be full of deprecation notices.

            Show
            Damyon Wiese added a comment - Hi Tim I have posted that I started working on it based on the original spec - kept the dev docs up to date, ( http://docs.moodle.org/dev/Scheduled_Tasks_Proposal ), posted when it was ready, written new API dev docs, gotten many peer reviews (thanks Fred and Petr), mentioned it in weekly meetings many times. This whole thing had already been discussed and agreed before I even started looking at it and nothing has really changed between then and when I started work on it. Re: Deprecation - in this case I favour encouraging new plugins to use this API - but in most cases the old way is good enough and the effort it changing plugins would not have any real benefits (in the case when the cron task is simple/quick anyway and the code is already written). This would affect a high percentage of community plugins and IMO forcing everyone to change their plugins is pointless. Specifically - cron_execute_plugin_type is used by plugins adding cron support for their own sub-plugins. Even if I deprecate it, we could not stop calling it until moodle 2.9 and so cron would be full of deprecation notices.
            Hide
            CiBoT added a comment -

            Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!

            Show
            CiBoT added a comment - Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!
            Hide
            Dan Poltawski added a comment -

            Hi Damyon,

            Can you look at this branch - it has conflict markers and looks abit messy

            Show
            Dan Poltawski added a comment - Hi Damyon, Can you look at this branch - it has conflict markers and looks abit messy
            Hide
            Damyon Wiese added a comment -

            Sorry - bad rebase.

            I rebased again and squashed the commits (and fixed the conflict).

            Show
            Damyon Wiese added a comment - Sorry - bad rebase. I rebased again and squashed the commits (and fixed the conflict).
            Hide
            Martin Dougiamas added a comment -

            Assuming this is implementing the spec then +1 for it.

            +1 for proper deprecation process too.

            The UI looks a little awkward but is fine for now.

            Show
            Martin Dougiamas added a comment - Assuming this is implementing the spec then +1 for it. +1 for proper deprecation process too. The UI looks a little awkward but is fine for now.
            Hide
            Dan Poltawski added a comment -

            Hi Damyon,

            1. Hmm, looking at the code - I wonder if there is scope for a pre-execute hook. There are so many places where we are doing conditional checks before executing. At the least, it would be nice to clean some of them up so that they are done once at the start of execute (e.g. lib/classes/task/blog_cron_task.php). Also, should we be doing some automatic checks for plugins (check a plugin is enabled before running its tasks)

            2.In admin/tool/task/scheduledtasks.php you are using PARAM_TEXT for error and success. Unless we are expecting multilang there then PARAM_TEXT is wrong.

            3. In multiple places you are escaping global functions, which I thought we'd agreed was a no-nose \portfolio_cron(); \set_user_preference();
            trigger_error etc.

            Show
            Dan Poltawski added a comment - Hi Damyon, 1. Hmm, looking at the code - I wonder if there is scope for a pre-execute hook. There are so many places where we are doing conditional checks before executing. At the least, it would be nice to clean some of them up so that they are done once at the start of execute (e.g. lib/classes/task/blog_cron_task.php). Also, should we be doing some automatic checks for plugins (check a plugin is enabled before running its tasks) 2.In admin/tool/task/scheduledtasks.php you are using PARAM_TEXT for error and success. Unless we are expecting multilang there then PARAM_TEXT is wrong. 3. In multiple places you are escaping global functions, which I thought we'd agreed was a no-nose \portfolio_cron(); \set_user_preference(); trigger_error etc.
            Hide
            Damyon Wiese added a comment -

            Thanks Dan,

            I added a commit for each of 2 & 3.

            Re: your suggestion for a "is_enabled" type function.

            Pros:

            • a bit more organisation in the tasks
            • maybe the admin interface could differentiate between tasks that were skipped and those that ran

            Cons:

            • Plugins can do that now by adding their own "is_enabled" function and calling it from execute
            • At least for now - if we restrain ourselves from refactoring them it is easier to verify there are no real code differences for the cron sections that have been moved to tasks. I tried to keep them as similar as possible so that this would be easier to review/verify. We can add incremental improvements to these tasks later - and really we should - but for now I tried to keep the number of changes as low as possible.

            Later on it would be good for example, to change the tasks that are calling out to a cron_xxx function by moving the cron_xxx function contents into the task (and moving the task class into the namespace for the api). E.g. \core\portfolio\task\export.php

            Show
            Damyon Wiese added a comment - Thanks Dan, I added a commit for each of 2 & 3. Re: your suggestion for a "is_enabled" type function. Pros: a bit more organisation in the tasks maybe the admin interface could differentiate between tasks that were skipped and those that ran Cons: Plugins can do that now by adding their own "is_enabled" function and calling it from execute At least for now - if we restrain ourselves from refactoring them it is easier to verify there are no real code differences for the cron sections that have been moved to tasks. I tried to keep them as similar as possible so that this would be easier to review/verify. We can add incremental improvements to these tasks later - and really we should - but for now I tried to keep the number of changes as low as possible. Later on it would be good for example, to change the tasks that are calling out to a cron_xxx function by moving the cron_xxx function contents into the task (and moving the task class into the namespace for the api). E.g. \core\portfolio\task\export.php
            Hide
            Damyon Wiese added a comment -

            Dan commented on the messy output from cron - so I have added a commit to make sure for each task the start time/memory is logged and the final db queries/time used.

            I rebased and added the commit to the end of MDL-25505-master - I also created a squashed branch MDL-25505-master-squashed with just one commit.

            Show
            Damyon Wiese added a comment - Dan commented on the messy output from cron - so I have added a commit to make sure for each task the start time/memory is logged and the final db queries/time used. I rebased and added the commit to the end of MDL-25505 -master - I also created a squashed branch MDL-25505 -master-squashed with just one commit.
            Hide
            Damyon Wiese added a comment -

            Sample cron output:

            Server Time: Wed, 26 Feb 2014 04:01:21 +0000
             
             
            Execute scheduled task: Cleanup old sessions
            ... started 04:01:21. Current memory use 4.1MB.
            ... used 7 dbqueries
            ... used 0.0045299530029297 seconds
            Scheduled task complete: Cleanup old sessions
            Execute scheduled task: Delete unconfirmed users
            ... started 04:01:21. Current memory use 4.6MB.
            ... used 1 dbqueries
            ... used 0.00089716911315918 seconds
            Scheduled task complete: Delete unconfirmed users
            Execute scheduled task: Send new user passwords
            ... started 04:01:21. Current memory use 4.6MB.
            ... used 1 dbqueries
            ... used 0.00087809562683105 seconds
            Scheduled task complete: Send new user passwords
            Execute scheduled task: Send failed login notifications
            ... started 04:01:21. Current memory use 4.7MB.
            ... used 0 dbqueries
            ... used 2.8848648071289E-5 seconds
            Scheduled task complete: Send failed login notifications
            Execute scheduled task: Create missing contexts
            ... started 04:01:21. Current memory use 4.7MB.
             Created missing context instances
            ... used 11 dbqueries
            ... used 0.0059921741485596 seconds
            Scheduled task complete: Create missing contexts
            Execute scheduled task: Award badges
            ... started 04:01:21. Current memory use 4.7MB.
            Started reviewing available badges.
            Badges were issued 0 time(s).
            Sending scheduled badge notifications.
            ... used 2 dbqueries
            ... used 0.002086877822876 seconds
            Scheduled task complete: Award badges
            Execute scheduled task: Check for updates
            ... started 04:01:21. Current memory use 4.8MB.
            Recently fetched info about available updates is still fresh enough, skipping.
            ... used 0 dbqueries
            ... used 0.00038886070251465 seconds
            Scheduled task complete: Check for updates
            Execute scheduled task: Background processing for statistics
            ... started 04:01:21. Current memory use 4.8MB.
            ... used 0 dbqueries
            ... used 3.0040740966797E-5 seconds
            Scheduled task complete: Background processing for statistics
            Execute scheduled task: Legacy cron processing for plugins
            ... started 04:01:22. Current memory use 4.8MB.
            Running auth crons if required...
            Running enrol crons if required...
            Starting activity modules
            Processing module function assign_cron ...
            ... used 1 dbqueries
            ... used 0.004601001739502 seconds
            done.
            Processing module function forum_cron ...
            Starting digest processing...
            Cleaned old digest records
            ... used 4 dbqueries
            ... used 0.019551038742065 seconds
            done.
            Processing module function quiz_cron ...
             
              Looking for quiz overdue quiz attempts...
              Considered 0 attempts in 0 quizzes.
            Starting quiz reports
            Finished quiz reports
            ... used 2 dbqueries
            ... used 0.021285057067871 seconds
            done.
            Processing module function workshop_cron ...
             processing workshop subplugins ...
            Starting workshop allocation methods
            Processing cron function for workshopallocation_scheduled...
            ... started 04:01:22. Current memory use 8.2MB.
            ... no workshops awaiting scheduled allocation. done. (1 dbqueries, 0 seconds)
            Finished workshop allocation methods
            ... used 6 dbqueries
            ... used 0.032335042953491 seconds
            done.
            Finished activity modules
            Starting blocks
            Finished blocks
            Starting admin reports
            Finished admin reports
            Starting course reports
            Finished course reports
            Starting gradebook plugins
            Finished gradebook plugins
            Starting repository plugins
            Processing cron function for repository_dropbox...
            ... started 04:01:22. Current memory use 10.1MB.
            done. (1 dbqueries, 0 seconds)
            Processing cron function for repository_filesystem...
            ... started 04:01:22. Current memory use 10.1MB.
            done. (3 dbqueries, 0 seconds)
            Finished repository plugins
            ... used 25 dbqueries
            ... used 0.12276101112366 seconds
            Scheduled task complete: Legacy cron processing for plugins
            Execute scheduled task: Background processing for gradebook
            ... started 04:01:22. Current memory use 10.1MB.
            ... used 2 dbqueries
            ... used 0.0021741390228271 seconds
            Scheduled task complete: Background processing for gradebook
            Execute scheduled task: Background processing for events
            ... started 04:01:22. Current memory use 10.2MB.
            ... used 2 dbqueries
            ... used 0.001011848449707 seconds
            Scheduled task complete: Background processing for events
            Execute scheduled task: Calculate completion data
            ... started 04:01:22. Current memory use 10.2MB.
            ... used 0 dbqueries
            ... used 3.0040740966797E-5 seconds
            Scheduled task complete: Calculate completion data
            Execute scheduled task: Background processing for portfolio plugins
            ... started 04:01:22. Current memory use 10.2MB.
            ... used 0 dbqueries
            ... used 2.6941299438477E-5 seconds
            Scheduled task complete: Background processing for portfolio plugins
            Execute scheduled task: Background processing for plagiarism plugins
            ... started 04:01:22. Current memory use 10.2MB.
            ... used 0 dbqueries
            ... used 6.3896179199219E-5 seconds
            Scheduled task complete: Background processing for plagiarism plugins
            Execute scheduled task: Send calendar notifications
            ... started 04:01:22. Current memory use 10.2MB.
            Updating calendar subscriptions:
            ... started 04:01:22. Current memory use 10.6MB.
            Finished updating calendar subscriptions.
            ... used 1 dbqueries
            ... used 0.0015418529510498 seconds
            Scheduled task complete: Send calendar notifications
            Execute scheduled task: Sync external blogs
            ... started 04:01:22. Current memory use 10.6MB.
            ... used 2 dbqueries
            ... used 0.0015120506286621 seconds
            Scheduled task complete: Sync external blogs
            Execute scheduled task: Background processing for question engine
            ... started 04:01:22. Current memory use 10.7MB.
             
              Cleaning up old question previews...done.
             
              Cleaning up old question statistics cache records...done.
            ... used 7 dbqueries
            ... used 0.0062289237976074 seconds
            Scheduled task complete: Background processing for question engine
            Cron script completed correctly
            Cron completed at 04:01:22. Memory used 10.7MB.
            Execution took 0.508246 seconds
            

            Show
            Damyon Wiese added a comment - Sample cron output: Server Time: Wed, 26 Feb 2014 04:01:21 +0000     Execute scheduled task: Cleanup old sessions ... started 04:01:21. Current memory use 4.1MB. ... used 7 dbqueries ... used 0.0045299530029297 seconds Scheduled task complete: Cleanup old sessions Execute scheduled task: Delete unconfirmed users ... started 04:01:21. Current memory use 4.6MB. ... used 1 dbqueries ... used 0.00089716911315918 seconds Scheduled task complete: Delete unconfirmed users Execute scheduled task: Send new user passwords ... started 04:01:21. Current memory use 4.6MB. ... used 1 dbqueries ... used 0.00087809562683105 seconds Scheduled task complete: Send new user passwords Execute scheduled task: Send failed login notifications ... started 04:01:21. Current memory use 4.7MB. ... used 0 dbqueries ... used 2.8848648071289E-5 seconds Scheduled task complete: Send failed login notifications Execute scheduled task: Create missing contexts ... started 04:01:21. Current memory use 4.7MB. Created missing context instances ... used 11 dbqueries ... used 0.0059921741485596 seconds Scheduled task complete: Create missing contexts Execute scheduled task: Award badges ... started 04:01:21. Current memory use 4.7MB. Started reviewing available badges. Badges were issued 0 time(s). Sending scheduled badge notifications. ... used 2 dbqueries ... used 0.002086877822876 seconds Scheduled task complete: Award badges Execute scheduled task: Check for updates ... started 04:01:21. Current memory use 4.8MB. Recently fetched info about available updates is still fresh enough, skipping. ... used 0 dbqueries ... used 0.00038886070251465 seconds Scheduled task complete: Check for updates Execute scheduled task: Background processing for statistics ... started 04:01:21. Current memory use 4.8MB. ... used 0 dbqueries ... used 3.0040740966797E-5 seconds Scheduled task complete: Background processing for statistics Execute scheduled task: Legacy cron processing for plugins ... started 04:01:22. Current memory use 4.8MB. Running auth crons if required... Running enrol crons if required... Starting activity modules Processing module function assign_cron ... ... used 1 dbqueries ... used 0.004601001739502 seconds done. Processing module function forum_cron ... Starting digest processing... Cleaned old digest records ... used 4 dbqueries ... used 0.019551038742065 seconds done. Processing module function quiz_cron ...   Looking for quiz overdue quiz attempts... Considered 0 attempts in 0 quizzes. Starting quiz reports Finished quiz reports ... used 2 dbqueries ... used 0.021285057067871 seconds done. Processing module function workshop_cron ... processing workshop subplugins ... Starting workshop allocation methods Processing cron function for workshopallocation_scheduled... ... started 04:01:22. Current memory use 8.2MB. ... no workshops awaiting scheduled allocation. done. (1 dbqueries, 0 seconds) Finished workshop allocation methods ... used 6 dbqueries ... used 0.032335042953491 seconds done. Finished activity modules Starting blocks Finished blocks Starting admin reports Finished admin reports Starting course reports Finished course reports Starting gradebook plugins Finished gradebook plugins Starting repository plugins Processing cron function for repository_dropbox... ... started 04:01:22. Current memory use 10.1MB. done. (1 dbqueries, 0 seconds) Processing cron function for repository_filesystem... ... started 04:01:22. Current memory use 10.1MB. done. (3 dbqueries, 0 seconds) Finished repository plugins ... used 25 dbqueries ... used 0.12276101112366 seconds Scheduled task complete: Legacy cron processing for plugins Execute scheduled task: Background processing for gradebook ... started 04:01:22. Current memory use 10.1MB. ... used 2 dbqueries ... used 0.0021741390228271 seconds Scheduled task complete: Background processing for gradebook Execute scheduled task: Background processing for events ... started 04:01:22. Current memory use 10.2MB. ... used 2 dbqueries ... used 0.001011848449707 seconds Scheduled task complete: Background processing for events Execute scheduled task: Calculate completion data ... started 04:01:22. Current memory use 10.2MB. ... used 0 dbqueries ... used 3.0040740966797E-5 seconds Scheduled task complete: Calculate completion data Execute scheduled task: Background processing for portfolio plugins ... started 04:01:22. Current memory use 10.2MB. ... used 0 dbqueries ... used 2.6941299438477E-5 seconds Scheduled task complete: Background processing for portfolio plugins Execute scheduled task: Background processing for plagiarism plugins ... started 04:01:22. Current memory use 10.2MB. ... used 0 dbqueries ... used 6.3896179199219E-5 seconds Scheduled task complete: Background processing for plagiarism plugins Execute scheduled task: Send calendar notifications ... started 04:01:22. Current memory use 10.2MB. Updating calendar subscriptions: ... started 04:01:22. Current memory use 10.6MB. Finished updating calendar subscriptions. ... used 1 dbqueries ... used 0.0015418529510498 seconds Scheduled task complete: Send calendar notifications Execute scheduled task: Sync external blogs ... started 04:01:22. Current memory use 10.6MB. ... used 2 dbqueries ... used 0.0015120506286621 seconds Scheduled task complete: Sync external blogs Execute scheduled task: Background processing for question engine ... started 04:01:22. Current memory use 10.7MB.   Cleaning up old question previews...done.   Cleaning up old question statistics cache records...done. ... used 7 dbqueries ... used 0.0062289237976074 seconds Scheduled task complete: Background processing for question engine Cron script completed correctly Cron completed at 04:01:22. Memory used 10.7MB. Execution took 0.508246 seconds
            Hide
            Dan Poltawski added a comment -

            Thanks Damyon,

            I've integrated this to master

            Show
            Dan Poltawski added a comment - Thanks Damyon, I've integrated this to master
            Hide
            Damyon Wiese added a comment -

            fingers crossed I've rebased it for the last time!

            Show
            Damyon Wiese added a comment - fingers crossed I've rebased it for the last time!
            Hide
            Dan Poltawski added a comment -

            I've tested all the bits now on postgres. I'm just trying on the more exotic databases now to look for problems.

            Doing this kind of testing I agree that the UI is a bit clunky and could use some improvement. In particular bulk resetting.

            Show
            Dan Poltawski added a comment - I've tested all the bits now on postgres. I'm just trying on the more exotic databases now to look for problems. Doing this kind of testing I agree that the UI is a bit clunky and could use some improvement. In particular bulk resetting.
            Hide
            Dan Poltawski added a comment -

            Thanks Damyon - passing

            Show
            Dan Poltawski added a comment - Thanks Damyon - passing
            Hide
            David Monllaó added a comment - - edited

            Failing as it is breaking behat-master, there is a test that is running cron twice in a row, after MDL-25505 the next scheduled cron run can not be in the same minute than the last one.

            Patch on top of integration:
            git pull git://github.com/dmonllao/moodle.git MDL-25505_master-behat-add-cron-delay

            Show
            David Monllaó added a comment - - edited Failing as it is breaking behat-master, there is a test that is running cron twice in a row, after MDL-25505 the next scheduled cron run can not be in the same minute than the last one. Patch on top of integration: git pull git://github.com/dmonllao/moodle.git MDL-25505 _master-behat-add-cron-delay
            Hide
            David Monllaó added a comment - - edited

            Another option we have as Damyon proposed is to update the database to make the cron runs scheduler think that it never run before so it will run immediately. IMO we shouldn't be cheating here as in future we don't know what changes can be introduced to the way cron tasks runs and how plugins will work with it so we may not detect issues because of cheating here; if there would be a constant or a $CFG var that we could set (overriding the default one) when running behat to avoid that 1 minute delay would be perfect, otherwise (IMO) we should wait the 61 seconds because is what users do, we are already cheating a bit allowing the cron to run when there is no link in the Moodle UI to it.

            I leave it to integrator decision, here is the branch updating the database rather than waiting, both solutions have been tested and work:

            • git pull git://github.com/dmonllao/moodle.git MDL-25505_master-behat-add-cron-delay-cheating-yes-dear-integrator-we-cheat-here-come-on-choose-the-patch-above-smiley-face
            Show
            David Monllaó added a comment - - edited Another option we have as Damyon proposed is to update the database to make the cron runs scheduler think that it never run before so it will run immediately. IMO we shouldn't be cheating here as in future we don't know what changes can be introduced to the way cron tasks runs and how plugins will work with it so we may not detect issues because of cheating here; if there would be a constant or a $CFG var that we could set (overriding the default one) when running behat to avoid that 1 minute delay would be perfect, otherwise (IMO) we should wait the 61 seconds because is what users do, we are already cheating a bit allowing the cron to run when there is no link in the Moodle UI to it. I leave it to integrator decision, here is the branch updating the database rather than waiting, both solutions have been tested and work: git pull git://github.com/dmonllao/moodle.git MDL-25505 _master-behat-add-cron-delay-cheating-yes-dear-integrator-we-cheat-here-come-on-choose-the-patch-above-smiley-face
            Hide
            Dan Poltawski added a comment -

            As much as I wanted to integrate the second branch name, i've gone for the first. There is a general question of whether we should be doing any cron stuff in behat.. But I think this i the most 'natural' solution

            Show
            Dan Poltawski added a comment - As much as I wanted to integrate the second branch name, i've gone for the first. There is a general question of whether we should be doing any cron stuff in behat.. But I think this i the most 'natural' solution
            Hide
            Rajesh Taneja added a comment -

            Thanks for fixing this Damyon,

            Works great, only thing I found is with invalid data is processed and throw notice. eg. passing "/2" gives Notice: Undefined offset: -1 in /home/rajesht/moodles/im/moodle/lib/classes/task/scheduled_task.php on line 207

            Seems this can be dealt in another issue. Passing...

            Show
            Rajesh Taneja added a comment - Thanks for fixing this Damyon, Works great, only thing I found is with invalid data is processed and throw notice. eg. passing "/2" gives Notice: Undefined offset: -1 in /home/rajesht/moodles/im/moodle/lib/classes/task/scheduled_task.php on line 207 Seems this can be dealt in another issue. Passing...
            Hide
            Damyon Wiese added a comment -

            Today this is failing unit tests because it's the last day of the month.

            Fix here: git pull git@github.com:damyon/moodle.git MDL-25505-master-fix1

            Can you pull this fix please Dan?

            Thanks

            Show
            Damyon Wiese added a comment - Today this is failing unit tests because it's the last day of the month. Fix here: git pull git@github.com:damyon/moodle.git MDL-25505 -master-fix1 Can you pull this fix please Dan? Thanks
            Hide
            Damyon Wiese added a comment -

            (Dan checked the commit over my shoulder and I just pushed it)

            Show
            Damyon Wiese added a comment - (Dan checked the commit over my shoulder and I just pushed it)
            Hide
            Dan Poltawski added a comment -

            I did - I was going out, Damyon did not break the rules

            Show
            Dan Poltawski added a comment - I did - I was going out, Damyon did not break the rules
            Hide
            Damyon Wiese added a comment -

            Parallel programmParallel programming is harding is hard

            Thanks for reporting/fixing/testing/improving Moodle. This issue has now been released.

            Show
            Damyon Wiese added a comment - Parallel programmParallel programming is harding is hard Thanks for reporting/fixing/testing/improving Moodle. This issue has now been released.
            Hide
            Mary Cooch added a comment -

            (Housekeeping) Removing docs_required label as I think this is documented in http://docs.moodle.org/27/en/Scheduled_tasks but please all feel free to improve the docs.

            Show
            Mary Cooch added a comment - (Housekeeping) Removing docs_required label as I think this is documented in http://docs.moodle.org/27/en/Scheduled_tasks but please all feel free to improve the docs.

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: