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

convert_submissions task with asynchronous document conversion cannot be completed by cron

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Prerequisites

      1. A course with an assignment module
      2. At least one user enrolled in the course from 1.

      Testing

      1. Install and enable the attached fileconverter plugin (it would be prudent to do this on a fresh install):
        1. Extract the contents of the zip to files/convert
        2. Browse to "Site administration > Plugins > Document converters > Manage document converters" and open the eye on the "Dummy" converter - ensure all other converters are disabled
      2. Navigate to the assignment and press "View all submissions"
      3. On one of the students, press the "Edit" dropdown and select "Edit submission"
      4. Upload a png (or anything really) as the student's submission then press the "Save changes" button
      5. Run the convert submissions task:

        php admin/tool/task/cli/schedule_task.php --execute="\assignfeedback_editpdf\task\convert_submissions"
        

        1. Verify you see "Hello from start_document_conversion" in the output
      6. Run the task again and verify you see either "Hello from poll_conversion_status. The conversion is complete!" or "Hello from poll_onversion_status. The conversion is still ongoing." (it has a 1 in 5 chance of succeeding)
      7. If the output from the previous step showed the conversion was complete, verify that this run does not produce any output from the converter. If the previous run said the conversion was ongoing, verify that this run either completes it, or reports again that it is ongoing.
      8. Repeat the previous step until either: The converter reports it completed or more than 3($CFG->conversionattemptlimit) runs are required (at this point assign is supposed to give up on the conversion)
      9. Edit the students submission again and repeat the process from before until you can verify that conversions both complete, and get given up on after 3 tries (you can lower this number by setting $CFG->conversionattemptlimit if it's becoming tedious)
      10. After a run with a successful conversion
        1. Browse back to the assignment and press "View all submissions"
        2. Press the "Grade" button for the student
        3. Verify you see a handsome lad
      Show
      Prerequisites A course with an assignment module At least one user enrolled in the course from 1. Testing Install and enable the attached fileconverter plugin (it would be prudent to do this on a fresh install): Extract the contents of the zip to files/convert Browse to "Site administration > Plugins > Document converters > Manage document converters" and open the eye on the "Dummy" converter - ensure all other converters are disabled Navigate to the assignment and press "View all submissions" On one of the students, press the "Edit" dropdown and select "Edit submission" Upload a png (or anything really) as the student's submission then press the "Save changes" button Run the convert submissions task: php admin/tool/task/cli/schedule_task.php --execute="\assignfeedback_editpdf\task\convert_submissions" Verify you see "Hello from start_document_conversion" in the output Run the task again and verify you see either "Hello from poll_conversion_status. The conversion is complete!" or "Hello from poll_onversion_status. The conversion is still ongoing." (it has a 1 in 5 chance of succeeding) If the output from the previous step showed the conversion was complete, verify that this run does not produce any output from the converter. If the previous run said the conversion was ongoing, verify that this run either completes it, or reports again that it is ongoing. Repeat the previous step until either: The converter reports it completed or more than 3( $CFG->conversionattemptlimit ) runs are required (at this point assign is supposed to give up on the conversion) Edit the students submission again and repeat the process from before until you can verify that conversions both complete, and get given up on after 3 tries (you can lower this number by setting $CFG->conversionattemptlimit if it's becoming tedious) After a run with a successful conversion Browse back to the assignment and press "View all submissions" Press the "Grade" button for the student Verify you see a handsome lad
    • Affected Branches:
      MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE, MOODLE_39_STABLE
    • Pull from Repository:
       git@git.in.moodle.com:cameron/moodle.git
    • Pull 3.8 Branch:
    • Pull 3.9 Branch:
    • Pull Master Branch:
      MDL-69106-master

      Description

      In Moodle 3.5 and earlier, the convert_submissions task was able to start and complete a document conversion. However this was only due to a bug. The conversion would be started and polled on the same cron run.

      MDL-63422 fixed the bug, and now conversions are started on a cron run, but not polled. However they are never polled again on subsequent cron runs. This is because the convert_submissions task uses the assignfeedback_editpdf_queue table to know which files to convert, and it removes rows from that table as soon as the task runs - regardless of if the conversion is still in progress.

      This isn't a problem in many cases, as when the assignment is viewed through the assignment grader interface it causes the document converter to poll and the conversion can finish. However with a service like https://cloudconvert.com the URLs to poll only last for 24 hours. So if more than 24 hours have elapsed since the initial cron run, it is no longer possible for the assignment grader interface to poll the URL and complete the conversion.

      Ideally the initial cron run should start the conversion, and subsequent runs should poll the URL and complete the conversion.

        Attachments

        1. dummy.zip
          31 kB
        2. MDL-69106.jpg
          MDL-69106.jpg
          94 kB

          Activity

            People

            Assignee:
            cameron1729 cameron1729
            Reporter:
            cameron1729 cameron1729
            Peer reviewer:
            Peter Dias
            Integrator:
            Andrew Nicols
            Tester:
            Anna Carissa Sadia
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              13/Jul/20

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours, 11 minutes
                6h 11m