-
Improvement
-
Resolution: Duplicate
-
Minor
-
None
-
3.3
In the 2.7+ schedule task api we can disable a task from running, but we cannot stop the whole cron system from running. You can of course disable this at the crontab or cron system level but depending on how your env's are setup this can be awkward. eg a bunch of dockers / auto scaled front ends and cron is running concurrently everywhere. You don't want to have to do this at the infrastructure level, it should be an application level concern.
There are a couple reasons why you'd want this, but the main one driving it is continuous deployments. We want them to be as quick as possible, and minimize the actual downtime. So we want to disable cron and let the current running processes finish and only then do a deployment and upgrade. But we do NOT want to enable maintenance mode until the last minute to minimize the downtime. There are other use cases like just turning off cron when diagnosing a production issue.
So I'd just want a very simple flag which can be set and unset from a cli. It would be good to expose it in the gui on the schedule task page as well. A very important feature is that the task system would also check for this flag between every task, so when it is set it kills cron as soon as possible. Some behemoth potentially long running tasks could optionally also periodically check this flag and decide to exit early as well. This is all in the interests of minimizing the total overall time to deploy.
Ideally aditional cli which has these options:
admin/cli/cron.php -h
cron.php --isrunning # test if cron is running on anywhere on any box
|
cron.php --disable # disables cron, tells other running crons to stop early
|
cron.php --enable # enables cron again
|
cron.php --disable-wait # disables cron, and waits until all other crons have finished
|
cron.php --verbose # Print verbose task information when coupled with disable-wait and is-running
|
- blocks
-
MDL-59594 Allow graceful fast exit of cron.php / adhoc_task.php via SIGTERM or SIGINT
- Closed
- has a non-specific relationship to
-
MDL-47934 locktimeout exception in scheduled tasks is not very informative/exceptional
- Closed
-
MDL-50719 Long-running scheduled task slows down all cron processing / task contention and re-proccessing bugs
- Closed
-
MDL-57952 Create acceptance test framework for any moodle cli scripts
- Closed
- has been marked as being related by
-
MDL-67211 Tasks: Show information about running tasks, allow tasks to be disabled
- Closed
- is blocked by
-
MDL-67211 Tasks: Show information about running tasks, allow tasks to be disabled
- Closed
- will be (partly) resolved by
-
MDL-65229 Allow cron cli option to remotely stop all crons
- Closed