Uploaded image for project: 'Moodle QA'
  1. Moodle QA
  2. MDLQA-16759 Moodle 4.1 QA
  3. MDLQA-17192

CLONE - Admins can change analytics settings and setup different machine learning backends




      Testing environment:

      1. This test requires a system with Python installed and the option to run phpunit tests.
      2. Create a user and assign the system role manager. You will need to login as this user in some steps.
      3. Add this line to the config.php to be able to execute long phpunit tests:
      4. Make sure you use correct python version (if you install mlbackend locally) - its should be python3.7. If you use docker environment the version is already taken care of

      Other info:

      1. Uninstall moodlemlbackend python package if you have it installed


      1. Log in as an admin
      2. Go to 'Site administration > Server > System paths' and ensure 'pathtopython' is not set
      3. Go to 'Analytics settings' in the Site administration and enable 'Analytics processes execution via command line only'.
      4. Log in as a manager and go to 'Analytics models' in the Site administration.
      5. Verify that a message is displayed stating that Models evaluations via the web interface is disabled.
      6. Verify that 'Execute scheduled analysis' and 'Evaluate' are not available for any model in the 'Actions' menu.
      7. Log in as admin again and go to 'Analytics settings' and disable 'Analytics processes execution via command line only'.
      8. Set 'Time splitting methods' to Tenths and 'Tenths accumulative' ("Default analysis intervals for model's evaluation" to "Last tenth" and "All previous tenths").
      9. Log in as a manager again and go to 'Analytics models'.
      10. Verify that a message is displayed stating that evaluating models and generating predictions may involve heavy processing and it is recommended to run these actions via command line interface.
      11. Verify that 'Execute scheduled analysis' is available in "Courses at risk of not starting" model action menu and 'Evaluate' is available in the 'Students at risk of dropping out' Actions menu.
      12. For 'Students at risk of dropping out' select 'Edit' in the 'Actions' column.
      13. Verify that the "10% after start" and  and 'All previous tenth' appears in 'Analysis interval' options (can be more options)
      14. Log in as admin again and go to 'Analytics settings' and reset 'Time splitting methods' to its default value: "Last quarter", "All previous quarters" and "From start to end". and save.
      15. Set "Default predictions processor" to 'Python machine learning backend' and save again.
      16. Verify that an error message is displayed saying that Python binary path is not defined.
      17. Go to 'System paths' and set pathtopython to your path. (You can just set it to 'python' if the binary directory is in your $PATH.)
      18. Return to 'Analytics settings' and verify that 'PHP machine learning backend' is still be the selected option. (The system shouldn't allow you to change it until all Python's ml backend requirements are satisfied).
      19. Change it again to 'Python machine learning backend'.
      20. Verify that a message saying that moodlemlbackend python package is not installed is displayed.
      21. Install moodlemlbackend python package (pip install moodlemlbackend; for more info, see below).
      22. Return to 'Analytics settings', save changes again and verify that the changes are saved correctly.
      23. Run all phpunit tests for analytics:

        vendor/bin/phpunit --testsuite core_analytics_testsuite

        Note that you will need to set $CFG->pathtopython in your config.php.

      1. Verify all tests for analytics pass and none are skipped.

      Installing mlbabackend:


      1. run

        sudo python3.7 -m pip install moodlemlbackend

        if it complains about missing packages (like tensorflow install those too). For example

        sudo python3.7 -m pip install tensorflow==VERSION

      2. in config.php put

        define('PHPUNIT_LONGTEST', true);

      Docker install

      1. Put this in config.php

        define('TEST_MLBACKEND_PYTHON_HOST', 'localhost');
        define('TEST_MLBACKEND_PYTHON_PORT', 5000);
        define('TEST_MLBACKEND_PYTHON_USERNAME', 'default');
        define('TEST_MLBACKEND_PYTHON_PASSWORD', 'sshhhh');
        define('PHPUNIT_LONGTEST', true);


        1. MDL-76268_testing.png
          100 kB
        2. MDLQA-17192_1.png
          135 kB
        3. MDLQA-17192_2.png
          128 kB
        4. MDLQA-17192_3.png
          74 kB
        5. MDLQA-17192_4.png
          152 kB
        6. MDLQA-17192_5.png
          93 kB
        7. MDLQA-17192_6.png
          149 kB
        8. MDLQA-17192_7.png
          94 kB
        9. MDLQA-17192_testing.png
          43 kB
        10. Screenshot from 2022-10-31 11-56-52.png
          Screenshot from 2022-10-31 11-56-52.png
          368 kB
        11. Screenshot from 2022-10-31 11-57-22.png
          Screenshot from 2022-10-31 11-57-22.png
          380 kB
        12. Screenshot from 2022-10-31 12-00-47.png
          Screenshot from 2022-10-31 12-00-47.png
          489 kB



            andelacruz Angelia Dela Cruz
            0 Vote for this issue
            2 Start watching this issue




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