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

Expose an index of the adhoc tasks and their logs

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.7.5, 3.8.2
    • Fix Version/s: None
    • Component/s: Tasks
    • Labels:
      None
    • Affected Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE

      Description

      Background

      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:

      https://your.moodle.site/admin/tasklogs.php?filter=tool_crawler%5Ctask%5Cadhoc_crawl_task&result=-1

       

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

       

      Proposal

      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

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              aspark Alistair Spark
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: