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

Expose an index of the adhoc tasks and their logs


    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 3.7.5, 3.8.2
    • Tasks


      Doing an in-depth plugin review I encountered my first plugin which made use of ad-hoc tasks to facilitate better parallel processing. It however seemed everything that is useful about scheduled tasks had gone and there was no way to monitor the adhoc task.

      There is currently no "Adhoc Tasks" page so I searched https://your.moodle.site/admin/tool/task/scheduledtasks.php for the adhoc task but it wasn't there (and rightly so)

      After bouncing around through Moodle docs and tracker and not finding anything on subject, and having assumed ad-hoc tasks were not being captured by the task log, I eventually thought to look at https://your.moodle.site/admin/tasklogs.php where I did in fact find the runs for the ad-hoc tasks.


      Now the runs for a particular ad hoc task and mixed in with all of the other tasks scheduled & adhoc one, it's a mess on a site with cron running regularly.

      The search does allow to filter down to see just the logs for a particular task, if you know how:



      My point here is that the experience for a site-admin new to Ad-Hoc tasks isn't great.



      I would suggest that their should be a "Ad-Hoc Tasks" page under Site Administration > Server > Tasks > Ad-Hoc tasks which replicates the layout of the Scheduled Tasks page.

      It would provide:

      • an index of the Ad-Hoc tasks
      • links to the logs of those tasks
      • Bonus points: delete arbitrary tasks

      Obviously "run now" on a per task basis is not relevant here, however it would be useful for site admins without server access to be able to execute all pending adhoc tasks through the web interface (i.e. the web equivalent of running: php admin/tool/task/cli/adhoc_task.php --execute ).


      Had a look through MDL-49399 which implemented the task log in 3.7 and it seems like the ad hoc tasks weren't the focus, there wasn't any reason outlined not to implement this. 


      P.S. Found this example of a scheduled task being converted to leverage adhoc tasks interesting: https://github.com/catalyst/moodle-tool_crawler/pull/95/files

            Unassigned Unassigned
            aspark Alistair Spark
            6 Vote for this issue
            9 Start watching this issue


                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.