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

Allow cron cli option to remotely stop all crons

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      1) Install this to make testing easier:

      https://github.com/catalyst/moodle-tool_testtasks

      2) Run cronhelp to see new option:

      php admin/cli/cron.php -h

      3) In terminal 1 run cron:

      php admin/cli/cron.php

      4) In terminal 2 after a couple seconds remotely kill all crons:

      php admin/cli/cron.php --stop

      5) Repeat using ad hoc tasks. In terminal 1:

      Queue up some tasks

      php admin/tool/testtasks/cli/queue_adhoc_tasks.php -d=1 -n=20

      Now run them:

      php admin/tool/task/cli/adhoc_task.php --execute 

      6) In terminal 2 wait a few seconds and then kill it remotely:

      php admin/cli/cron.php --stop

       

      Show
      1) Install this to make testing easier: https://github.com/catalyst/moodle-tool_testtasks 2) Run cronhelp to see new option: php admin/cli/cron.php -h 3) In terminal 1 run cron: php admin/cli/cron.php 4) In terminal 2 after a couple seconds remotely kill all crons: php admin/cli/cron.php --stop 5) Repeat using ad hoc tasks. In terminal 1: Queue up some tasks php admin/tool/testtasks/cli/queue_adhoc_tasks.php -d=1 -n=20 Now run them: php admin/tool/task/cli/adhoc_task.php --execute  6) In terminal 2 wait a few seconds and then kill it remotely: php admin/cli/cron.php --stop  
    • Affected Branches:
      MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_39_STABLE
    • Pull Master Branch:
      MDL-65229-stop-cron

      Description

      We now have the ability to throttle cron process run time since MDL-64347.

      These settings are only honored between runs of scheduled tasks in the cronlib, but some heavy tasks can still take many many hours (> 24 hours on big sites). Most of these scheduled tasks are processing some sort of large queue and it should also be able check whether it should continue between queue items.

      The end game here is to eventually allow much fast clean exiting of cron when doing a new release, and this should be much simpler and a less contentious than MDL-57852

      Then exiting gracefully via SIGTERM could be built on top of this MDL-59594 

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                brendanheywood Brendan Heywood
                Reporter:
                brendanheywood Brendan Heywood
                Peer reviewer:
                Matt Porritt
                Integrator:
                Andrew Nicols
                Tester:
                Janelle Barcega
                Participants:
                Component watchers:
                Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/May/20

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 20 minutes
                  1h 20m