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

When running cron or adhoc tasks cli's update the process name to see status on the fly

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Install testtasks https://github.com/catalyst/moodle-tool_testtasks
      2. In terminal 1 run: 

        watch -n 1 'ps aux | grep php'
        

        Note: htop grab the current process title when it starts, but doesn't dynamically refresh the titles each second so you won't see anything change.

      3. In terminal 2 run the adhoc runner with keepalive = 10 but with no tasks:

        php admin/cli/adhoc_task.php -k=10 -e
        

      4. Confirm you can see 'Waiting 10s for next adhoc task' in terminal 1 and it counts down then exits

        brendan 17856 09:02 0:00 php admin/cli/adhoc_task.php -k=10 -e (May 17, 09:02:49 Waiting 9s for next adhoc task)
        

      5. In terminal 2 queue up some adhoc tasks

        php admin/tool/testtasks/cli/queue_adhoc_tasks.php -n=100
        

      6. In terminal 2 run: 

        php admin/cli/cron.php
        

      7. In terminal 3 run:

        php admin/cli/adhoc_task.php -e
        

      8. Confirm you can see in the live process list for both cron and the adhoc tasks, the start time, task class, and for ad hoc tasks the task id :

        brendan  17927   09:04   0:00 php admin/cli/adhoc_task.php -e (May 17, 09:04:23 Adhoc task: 58786 tool_testtasks\task\timed_adhoc_task)
        brendan  17888   09:03   0:00 php admin/cli/cron.php (May 17, 09:03:49 Scheduled task: core\task\automated_backup_task)

         # Confirm that the tasks both have a section in brackets describing the current task, for example:

        May 17, 09:04:23 Adhoc task: 58786 tool_testtasks\task\timed_adhoc_task
        May 17, 09:03:49 Scheduled task: core\task\automated_backup_task
        

      Show
      Install testtasks https://github.com/catalyst/moodle-tool_testtasks In terminal 1 run:  watch -n 1 'ps aux | grep php' Note: htop grab the current process title when it starts, but doesn't dynamically refresh the titles each second so you won't see anything change. In terminal 2 run the adhoc runner with keepalive = 10 but with no tasks: php admin/cli/adhoc_task.php -k= 10 -e Confirm you can see 'Waiting 10s for next adhoc task' in terminal 1 and it counts down then exits brendan 17856 09:02 0:00 php admin/cli/adhoc_task.php -k=10 -e (May 17, 09:02:49 Waiting 9s for next adhoc task) In terminal 2 queue up some adhoc tasks php admin/tool/testtasks/cli/queue_adhoc_tasks.php -n= 100 In terminal 2 run:  php admin/cli/cron.php In terminal 3 run: php admin/cli/adhoc_task.php -e Confirm you can see in the live process list for both cron and the adhoc tasks, the start time, task class, and for ad hoc tasks the task id : brendan 17927 09:04 0:00 php admin/cli/adhoc_task.php -e (May 17, 09:04:23 Adhoc task: 58786 tool_testtasks\task\timed_adhoc_task) brendan 17888 09:03 0:00 php admin/cli/cron.php (May 17, 09:03:49 Scheduled task: core\task\automated_backup_task)  # Confirm that the tasks both have a section in brackets describing the current task, for example : May 17, 09:04:23 Adhoc task: 58786 tool_testtasks\task\timed_adhoc_task May 17, 09:03:49 Scheduled task: core\task\automated_backup_task
    • Affected Branches:
      MOODLE_310_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE
    • Pull Master Branch:
      MDL-68714-task-top-process-name

      Description

      This solves a similar problem as MDL-67211 but from a different angle and makes it much easy for a sysadmin to see what a process is doing right now using top

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              brendanheywood Brendan Heywood
              Reporter:
              brendanheywood Brendan Heywood
              Peer reviewer:
              Peter Burnett
              Integrator:
              Andrew Nicols
              Tester:
              CiBoT
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Nov/20

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours, 53 minutes
                  4h 53m