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

Add a var for path to python

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.4
    • Component/s: Analytics
    • Labels:
    • Testing Instructions:
      Hide
      Test 1
      1. Visit 'Site administration' > 'Server' > 'System paths'.
      2. Confirm there is a setting to specify the path to Python.
      3. Confirm the description is informative.
      4. Check that you can set this value as expected.
      Test 2
      1. Clear the Python path and save the changes.
      2. Add the following code to test.php in your wwwroot.

        <?php
         
        require_once('config.php');
         
        $predictionsprocessor = \core_analytics\manager::get_predictions_processor('\mlbackend_python\processor', false);
        print_object($predictionsprocessor->is_ready());
        

      3. Visit <yoursite>/test.php and confirm you get a meaningful message about the path not being defined.
      4. Check the URL in the message is correct.
      Test 3
      1. Install pip if it isn't already installed (Python package manager).
      2. Run sudo pip install moodlemlbackend.
      3. Edit the file admin/settings/server.php and change the default for pathtopython to the valid Python path.
      4. Re-initialise PHPUnit for the new default setting to take effect.
      5. Run the unit tests analytics/tests/prediction_test.php.
        1. Ignore the warnings that say 'but these are available on your machine ...' (see https://github.com/tensorflow/tensorflow/issues/7778#issuecomment-281678077).
        2. Ignore any random failures (we are just testing that the Python bin was found, and https://github.com/moodlehq/moodle-mlbackend-python/issues/2 has been created to address failures related to timing issues).
      6. Edit the file admin/server/settings.php and change the default for pathtopython to asdas2 (invalid path).
      7. Re-initialise PHPUnit for the new default setting to take effect.
      8. Run the unit tests again.
      9. Ensure all passes and ensure there are no warnings (because Python ML backend will be skipped).
      Show
      Test 1 Visit 'Site administration' > 'Server' > 'System paths'. Confirm there is a setting to specify the path to Python. Confirm the description is informative. Check that you can set this value as expected. Test 2 Clear the Python path and save the changes. Add the following code to test.php in your wwwroot. <?php   require_once('config.php');   $predictionsprocessor = \core_analytics\manager::get_predictions_processor('\mlbackend_python\processor', false); print_object($predictionsprocessor->is_ready()); Visit <yoursite>/test.php and confirm you get a meaningful message about the path not being defined. Check the URL in the message is correct. Test 3 Install pip if it isn't already installed (Python package manager). Run sudo pip install moodlemlbackend . Edit the file admin/settings/server.php and change the default for pathtopython to the valid Python path. Re-initialise PHPUnit for the new default setting to take effect. Run the unit tests analytics/tests/prediction_test.php . Ignore the warnings that say 'but these are available on your machine ...' (see https://github.com/tensorflow/tensorflow/issues/7778#issuecomment-281678077 ). Ignore any random failures (we are just testing that the Python bin was found, and https://github.com/moodlehq/moodle-mlbackend-python/issues/2 has been created to address failures related to timing issues). Edit the file admin/server/settings.php and change the default for pathtopython to asdas2 (invalid path). Re-initialise PHPUnit for the new default setting to take effect. Run the unit tests again. Ensure all passes and ensure there are no warnings (because Python ML backend will be skipped).
    • Affected Branches:
      MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-59995_master

      Description

      mlbackend_python uses python from command line, we should allow people to configure the path to the executable.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              markn Mark Nelson
              Reporter:
              dmonllao David Monllaó
              Peer reviewer:
              David Monllaó
              Integrator:
              Jun Pataleta
              Tester:
              Adrian Greeve
              Participants:
              Component watchers:
              Elizabeth Dalton, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Nov/17