Commit Graph

251 Commits

Author SHA1 Message Date
30bae49637 MDL-81689 tests: Check task DB record for nextruntime 2024-07-26 10:36:29 +02:00
6f1df841f7 MDL-67667 core: Deprecate and removal task blocking
There are inherent issues with task blocking which mean that it has
never worked properly. It is also very buggy and can lead to massive
performance issues with task processing.

It is almost impossible to deprecate this in a staged fashion because
various APIs use the methods and it is not possible to determine which
are API uses and which are other valid uses.

In reality there has been little-to-no uptake on the use of this feature
and it should just be removed.
2024-04-12 12:34:20 +08:00
a1b0fe9b9c MDL-67667 core: Deprecate task blocking 2024-04-12 12:15:44 +08:00
5488908538 MDL-79131 core: Hook listener callback for failed_task_max_delay 2024-04-03 09:08:50 +02:00
10ecfa731d MDL-79131 core: Dispatch the new Hook 2024-04-03 09:08:50 +02:00
8698a9a229 MDL-81000 core: Update "attemptsavailable" value and remove "MAX_RETRY" 2024-03-27 14:00:52 +01:00
3278ce7aba Merge branch 'MDL-65292' of https://github.com/stronk7/moodle 2024-03-08 08:00:41 +08:00
c068b01a1a MDL-80749 adhoc_task: Update failed ad-hoc tasks cleanup
Update the task to use firststartingtime instead of timestarted
2024-03-04 10:17:14 +07:00
17c01d9d74 MDL-80749 adhoc_task: Log the first starting time of the task 2024-03-04 10:17:09 +07:00
29a541724f MDL-65292 style: Fix all the function declaration ordering
This has been generated running the following Sniff,
part of the Moodle's CodeSniffer standard:
- PSR2.Methods.MethodDeclaration

It just ensures all the function declarations have
the correct order for:
- abstract and final.
- visibility (public, protected, private).
- static.

So, all the lines modified by this commit are function declarations
and the only changes are in the positions of those keywords.
2024-02-28 23:47:47 +01:00
ba1f804ffa MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing

All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.

Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
2024-02-28 23:33:26 +01:00
a6b2aa021a Merge branch 'mdl-80917-main' of https://github.com/Fragonite/moodle 2024-02-28 16:44:13 +01:00
3451175f22 Merge branch 'MDL-80684-master-fail_running_tasks_on_shutdown' of https://github.com/praxisdigital/moodle 2024-02-28 14:16:13 +08:00
8ebd9f08e4 MDL-80862 core: Tidy up state vars in task manager 2024-02-20 12:44:58 +08:00
becd11a84a MDL-80862 testing: Reset task manager between behat tests 2024-02-20 10:54:12 +08:00
ab517483a0 MDL-80684 core: Fail running tasks on shutdown
When you kill a process which is executing a task, it now marks it as failed.
2024-02-19 12:07:56 +01:00
34492bec74 MDL-80917 core_backup: Clear restored course cache 2024-02-15 09:06:57 +08:00
b156b34552 Merge branch 'MDL-80667' of https://github.com/paulholden/moodle 2024-02-08 15:32:28 +08:00
67a94c49c4 Merge branch 'MDL-80267-main' of https://github.com/HuongNV13/moodle 2024-02-01 11:52:36 +08:00
24fde0ce87 MDL-80267 Backup: Make sure to mark the task as failed in such cases
Adding a try-catch around the restore process to make sure that
the task will be marked as failed state if the process throws any
exceptions
2024-02-01 09:37:14 +07:00
42d76fd293 MDL-80267 task_course_restore: Prevent failed course restore 2024-02-01 09:31:08 +07:00
379e48c1fd MDL-74775 adhoc_task: Do not clear the timecreated of failed tasks 2024-01-29 09:57:33 +07:00
6239519eb8 Merge branch 'MDL-80323' of https://github.com/paulholden/moodle 2024-01-22 16:26:14 +08:00
31af1ac7e2 MDL-80667 task: preserve environment when running tasks from web.
For sites that rely on environment variables to set configuration,
ensure they are also present when executing task process.

Co-authored-by: Olivier Wenger <olivier.wenger@liip.ch>
2024-01-18 16:47:44 +00:00
12203eea69 Merge branch 'MDL-79130-master' of https://github.com/stevandoMoodle/moodle 2024-01-16 16:26:48 +08:00
75c58549e3 Merge branch 'MDL-69615-main' of https://github.com/HuongNV13/moodle 2024-01-16 10:56:27 +08:00
028c0384a2 MDL-69615 core_backup: Send backup report email once the tasks are done 2024-01-16 09:32:19 +07:00
fd8c759323 Merge branch 'MDL-79091' of https://github.com/jay-oswald/moodle 2024-01-15 12:31:35 +01:00
50c134a1ad MDL-69615 core_task: Add a task trait 2024-01-15 11:18:36 +07:00
2425e07db3 MDL-79130 task_adhoc: Defined max retry constant 2024-01-10 10:17:42 +08:00
b5cba37893 MDL-80323 h5p: fail content type retrieval task on errors.
It's better for the task to fail gracefully rather than silently
swallow any errors, so that the task API can schedule re-tries.

If the endpoint is temporarily down and/or misbehaving, this will
allow admins to have clearer failures.
2024-01-08 10:06:29 +00:00
bd3af64741 MDL-79128 adhoc_task: Added 'Never' status for ad-hoc task Next run
Co-authored-by: Stevani Andolo <stevani.andolo@moodle.com>
2023-12-20 13:55:13 +07:00
f13392d230 MDL-79128 adhoc_task: Implement failed ad-hoc task cleanup
Co-authored-by: Stevani Andolo <stevani.andolo@moodle.com>
2023-12-20 13:55:13 +07:00
6c047c40b7 MDL-79128 adhoc_task: Only rerun the allowed task
Co-authored-by: Stevani Andolo <stevani.andolo@moodle.com>
2023-12-20 13:55:13 +07:00
a44f14c79e MDL-79128 adhoc_task: Implement no-retry task
Co-authored-by: Stevani Andolo <stevani.andolo@moodle.com>

Including in this commit:
 - Added a new counter called attemptsavailable for ad-hoc task
 - PHPUnit test for the new feature
2023-12-20 13:55:13 +07:00
76c940134c MDL-80309 tasks: Clean up mtrace logs 2023-12-07 12:08:29 +08:00
248f7e91f2 MDL-79091 core_badges: refactor bades cron task
MDL-79091 core_badges: refactor bades cron task
2023-12-01 10:57:36 +11:00
5b5e0aab8c MDL-79091 core_badges: use adhoc tasks 2023-12-01 10:57:23 +11:00
ed46ee3dc7 MDL-79966 core_task: NEVER_RUN_TIME did not fit in 10 digits 2023-11-23 16:22:27 +00:00
1c4d433d5f MDL-79966 core_task: Scheduled task timing (crontab fields) is wrong 2023-11-20 17:13:21 +00:00
75c36558b6 MDL-79186 task: fix evaluation of 'X/Y' cron field format.
The above syntax is defined as supported by the class, for example the
format '5/10' means:

"At every 10th <unit> from 5 through <max>."

It is analogous to '5-<max>/10'.
2023-09-11 09:22:17 +01:00
a890f6f07a Merge branch 'MDL-79090-master' of https://github.com/mackensen/moodle 2023-09-08 22:14:35 +08:00
1af1cd3b49 MDL-79090 task: add enable and disable cli commands 2023-08-28 10:33:25 -04:00
7ff4626871 MDL-61165 core: Final deprecation and removal of legacy cron.
Following MDL-52846 this now finally deprecates and removes the
following classes:
- \core\task\legacy_plugin_cron_task.
- \mod_quiz\task\legacy_quiz_reports_cron
- \mod_quiz\task\legacy_quiz_accessrules_cron
- \mod_workshop\task\legacy_workshop_allocation_cron

Please, use the Task API instead:
https://moodledev.io/docs/apis/subsystems/task

This also removes the corresponding and specific to legacy cron strings
from mod_quiz and mod_workshop.

Following MDL-52846 this now finally deprecates and removes the
functions:
  - cron_execute_plugin_type()
  - cron_bc_hack_plugin_functions()

Please, use the Task API instead:
https://moodledev.io/docs/apis/subsystems/task

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2023-08-23 15:52:52 +08:00
ff46626da9 MDL-48762 core: Add scheduled tasks to set course visibility
Two new scheduled tasks, show_started_courses_task and
hide_ended_courses_task have been added, to automatically change
the course visibility when the start/end course date match the
current one.
They are disabled by default, to keep the current behaviour.
When admins enable any of them, they are executed once per
day by default (around midnight).

These scheduled tasks are based on the "CUL Course Visibility Update"
third-party plugin created by Tim Gagen and refactored and currently
maintained by Amanda Doughty:
https://moodle.org/plugins/local_culcourse_visibility

Thanks!! :-)
2023-07-04 07:27:03 +02:00
3c25ccdcd1 MDL-78552 core: tidy up MDL_PERF constants
* all constans usable in ABORT_AFTER_CONFIG should be always defined
* MDL_PERFDB and $PERF->logwrites not used after legacy log removal
* MDL_PERF_TEST should be documented in codebase
* deprecated warnings in shutdowb manager
2023-06-25 08:39:09 +02:00
60dbaa0065 MDL-75576 quiz/question statistics: don't expire by time
Previously, a set of calculated quiz statistics would only 'last' for
15 minutes. Then they would be considered invalid and not used.

Now, computed statistics are kept indefinitely. Instead, when a new
batch of values are computed for a particular set of settings, older numbers
for the same settings are deleted first. Therefore,
question_stats_cleanup_task is no more.
2023-05-15 10:01:27 +01:00
9ce4fb65fd Merge branch 'MDL-77164-master' of https://github.com/marinaglancy/moodle 2023-04-13 14:00:18 +02:00
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
85323070e7 MDL-70975 task: adhoctasks.php - queued ad hoc tasks report
Similar to scheduled tasks report

core\task\manager::adhoc_task_from_record() now raises moodle_exception
2023-04-05 11:29:46 +10:00