Preparation install this plugin to help make some test tasks:
https://github.com/catalyst/moodle-tool_testtasks
1) Ensure you start with a clean slate:
php admin/tool/testtasks/cli/clear_adhoc_task_queue.php
|
2) Visit /admin/tool/task/runningtasks.php
3) Confirm the page is empty
4) Queue up an adhoc task
php admin/tool/testtasks/cli/queue_adhoc_tasks.php -d=100000
|
5) Start running this task running but then hard Control-C twice kill the process so it's metadata will be left behind
php admin/cli/adhoc_task.php -e
6) Confirm timed_adhoc_task appears in the runningstasks.php table without any warnings or errors
7) Do the same to queue up a scheduled task and then hard kill it:
php admin/cli/scheduled_task.php --execute='\tool_testtasks\task\slow_task'
|
8) Confirm slow_task appears in the runningstasks.php table without any warnings or errors
9) Visit status report: /report/status/index.php?detail=tool_task_longrunningtasks in a new tab
10) Confirm that the check is OK and green
11) Add $CFG->taskruntimewarn = 10; to config.php
12) Confirm the status report now shows a warning for the slow tasks
13) Confirm the runningstasks table also shows the same warnings for the slow tasks
14) Add $CFG->taskruntimeerror = 20; to config.php
15) Confirm the status report now shows an error for the slow tasks
16) Confirm the runningstasks table also shows the same error for the slow tasks