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

    • MOODLE_310_STABLE
    • MOODLE_310_STABLE
    • MDL-68714-task-top-process-name
    • 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

      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

        1. image-2020-05-14-20-49-28-558.png
          49 kB
          Brendan Heywood
        2. image-2020-07-02-10-27-24-010.png
          107 kB
          Janelle Barcega
        3. image-2020-07-02-11-48-18-449.png
          72 kB
          Janelle Barcega

            brendanheywood Brendan Heywood
            brendanheywood Brendan Heywood
            Peter Burnett Peter Burnett
            Andrew Lyons Andrew Lyons
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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