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

Update admin/tool/task/cli/adhoc_task.php to respect task_adhoc_concurrency_limit

    XMLWordPrintable

Details

    • MOODLE_39_STABLE
    • MOODLE_39_STABLE
    • master_MDL-67433
    • Hide

      Installation

      1. Install this to make the testing easier:

      https://github.com/catalyst/moodle-tool_testtasks

      2. Clear adhoc task queue:

      php admin/tool/testtasks/cli/clear_adhoc_task_queue.php

      3. Generate 20 tasks:

      php admin/tool/testtasks/cli/queue_adhoc_tasks.php -d=1 -n=20

       

      Limit by task_adhoc_concurrency_limit

      1. Set task_adhoc_concurrency_limit to 0:

      php admin/cli/cfg.php --name=task_adhoc_concurrency_limit --set=0

      2. Set task_adhoc_max_runtime to 10:

      php admin/cli/cfg.php --name=task_adhoc_max_runtime --set=10

      3. Execute adhoc_task.php:

      php admin/tool/task/cli/adhoc_task.php --execute

      4. Confirm, that "Skipping processing of adhoc tasks. Concurrency limit reached." message is displayed.

      Limit by task_adhoc_max_runtime

      1. Set task_adhoc_concurrency_limit to 3:

      php admin/cli/cfg.php --name=task_adhoc_concurrency_limit --set=3

      2. Set task_adhoc_max_runtime to 0:

      php admin/cli/cfg.php --name=task_adhoc_max_runtime --set=0

      3. Execute adhoc_task.php:

      php admin/tool/task/cli/adhoc_task.php --execute

      4. Confirm, that "Stopping processing of adhoc tasks as time limit has been reached." is displayed.

      Unlimited run

      1. Set task_adhoc_concurrency_limit to 0:

      php admin/cli/cfg.php --name=task_adhoc_concurrency_limit --set=0

      2. Set task_adhoc_max_runtime to 0:

      php admin/cli/cfg.php --name=task_adhoc_max_runtime --set=0

      3. Execute adhoc_task.php without limits:

      php admin/tool/task/cli/adhoc_task.php --execute --ignorelimits

      4. Confirm, that all remaining 20 tasks were executed:

      Ran 20 adhoc tasks found at <date and time>

      Limit by task_adhoc_max_runtime with keep-alive mode

      1. Set task_adhoc_concurrency_limit to 3:

      php admin/cli/cfg.php --name=task_adhoc_concurrency_limit --set=3

      2. Set task_adhoc_max_runtime to 5:

      php admin/cli/cfg.php --name=task_adhoc_max_runtime --set=5

      3. Execute adhoc_task.php:

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

      4. Confirm, that it sits there waiting and drawing dots every second:

      Waiting for more adhoc tasks to be queued ....

      5. Confirm, that after 5 seconds it exits and the following message is displayed:

      Stopping processing of adhoc tasks as time limit has been reached.

      Unlimited run with keep-alive mode

      1. Set task_adhoc_concurrency_limit to 3:

      php admin/cli/cfg.php --name=task_adhoc_concurrency_limit --set=3

      2. Set task_adhoc_max_runtime to 5:

      php admin/cli/cfg.php --name=task_adhoc_max_runtime --set=5

      3. Execute adhoc_task.php:

      php admin/tool/task/cli/adhoc_task.php -e -i -k=10

      4. Confirm, that it sits there waiting and drawing dots every second:

      Waiting for more adhoc tasks to be queued ....

      5. Confirm, that after 10 seconds it exits.

      Show
      Installation 1. Install this to make the testing easier: https: //github.com/catalyst/moodle-tool_testtasks 2. Clear adhoc task queue: php admin/tool/testtasks/cli/clear_adhoc_task_queue.php 3. Generate 20 tasks: php admin/tool/testtasks/cli/queue_adhoc_tasks.php -d= 1 -n= 20   Limit by task_adhoc_concurrency_limit 1. Set task_adhoc_concurrency_limit to 0: php admin/cli/cfg.php --name=task_adhoc_concurrency_limit --set= 0 2. Set task_adhoc_max_runtime to 10: php admin/cli/cfg.php --name=task_adhoc_max_runtime --set= 10 3. Execute adhoc_task.php: php admin/tool/task/cli/adhoc_task.php --execute 4. Confirm , that "Skipping processing of adhoc tasks. Concurrency limit reached." message is displayed. Limit by task_adhoc_max_runtime 1. Set task_adhoc_concurrency_limit to 3: php admin/cli/cfg.php --name=task_adhoc_concurrency_limit --set= 3 2. Set task_adhoc_max_runtime to 0: php admin/cli/cfg.php --name=task_adhoc_max_runtime --set= 0 3. Execute adhoc_task.php: php admin/tool/task/cli/adhoc_task.php --execute 4. Confirm , that "Stopping processing of adhoc tasks as time limit has been reached." is displayed. Unlimited run 1. Set task_adhoc_concurrency_limit to 0: php admin/cli/cfg.php --name=task_adhoc_concurrency_limit --set= 0 2. Set task_adhoc_max_runtime to 0: php admin/cli/cfg.php --name=task_adhoc_max_runtime --set= 0 3. Execute adhoc_task.php without limits: php admin/tool/task/cli/adhoc_task.php --execute --ignorelimits 4. Confirm , that all remaining 20 tasks were executed: Ran 20 adhoc tasks found at <date and time> Limit by task_adhoc_max_runtime with keep-alive mode 1. Set task_adhoc_concurrency_limit to 3: php admin/cli/cfg.php --name=task_adhoc_concurrency_limit --set= 3 2. Set task_adhoc_max_runtime to 5: php admin/cli/cfg.php --name=task_adhoc_max_runtime --set= 5 3. Execute adhoc_task.php: php admin/tool/task/cli/adhoc_task.php -e -k= 10 4. Confirm , that it sits there waiting and drawing dots every second: Waiting for more adhoc tasks to be queued .... 5. Confirm , that after 5 seconds it exits and the following message is displayed: Stopping processing of adhoc tasks as time limit has been reached. Unlimited run with keep-alive mode 1. Set task_adhoc_concurrency_limit to 3: php admin/cli/cfg.php --name=task_adhoc_concurrency_limit --set= 3 2. Set task_adhoc_max_runtime to 5: php admin/cli/cfg.php --name=task_adhoc_max_runtime --set= 5 3. Execute adhoc_task.php: php admin/tool/task/cli/adhoc_task.php -e -i -k= 10 4. Confirm , that it sits there waiting and drawing dots every second: Waiting for more adhoc tasks to be queued .... 5. Confirm , that after 10 seconds it exits.

    Description

      It seems like if you use admin/tool/task/cli/adhoc_task.php to run your adhoc tasks,  you can bypass task_adhoc_concurrency_limit 

      I'd expect task_adhoc_concurrency_limit be a global setting that will stop any new task being executed over this limit.

      Attachments

        Issue Links

          Activity

            People

              mikhailgolenkov Misha Golenkov
              dmitriim Dmitrii Metelkin
              Brendan Heywood Brendan Heywood
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Janelle Barcega Janelle Barcega
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/Jun/20

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 25 minutes
                  1h 25m