Follow up for #1848490-67: Import translations automatically during installation and #74

Problem/Motivation

Progress of Import translations automatically during installation goes to warp speed at the end after 60%
It's confusing that there is a percent on the left, and a different percent on the right, and that the task appears to finish with the progress bar partially done.

Proposed resolution

Remove the "administrative" batch steps and only keep the "core" processing steps. The core process is checking status, downloading and importing.

This is what happens in #1998056: Automatically update interface translations using cron.

Remaining tasks

TBD. (reviews needed, tests to be written or run, documentation to be written, etc.)

User interface changes

Yes, just to fix this strangeness.

API changes

No API changes expected.

Comments

Gábor Hojtsy’s picture

Status: Active » Postponed

That patch is not yet committed.

Sutharsan’s picture

I'll give some background on what happens in the bath in an attempt to explain the progress bar behaviour. It may, or may not be possible to eliminate the behaviour completely.

The progress bar displays the progress of batch steps used to download and import a translation file. This batch process contains of 4 steps:

  • Step 1: Prepare
  • Step 2: Download
  • Step 3: Import
  • Step 4: Clean up and calculate results
  • Step 5: Save results

Drupal's batch process feedback reserves an equal amount of space for each batch step. With 4 steps, the progress bar moves 20% during each step. After step 3 the percentage indicator on the right of the bar is at 60%. But steps 1, 4 and 5 take very little time and step 3 takes a lot of time. In the case of the installer, Step 2 is skipped because the translation file was downloaded before. After spending 10 seconds initialising, 0.01 seconds step 1 and 2, 60 seconds on step 3. Now the remaining two steps only take 0.01 seconds, but after the slow import they feel like 0.00000000000000001 second.

That said, what can we do about it. Step 1 can not be removed, it is required for step 2 and 3 to do the work. Step 2 could be removed by defining a new batch the installation process only. But eliminating step 4 and 5 is a lot more work and may result in more complex code. For this to happen, steps 4 and 5 must be included in batch step 3. Only this will give the desired visual effect. This should be postponed for or combined with #1842380: Convert $source object to a TranslatableProject class. This issue will be a rewrite of the download/import code. Making the change before this issue will be a waste of effort.
An other approach to better visual presentation of the progress is to add an option in which each batch step can give an estimated amount of time compared to the total execution time.

webchick’s picture

Status: Postponed » Active

Yeah, I admit the only thing that immediately pops to mind is something hacky like a sleep() or introducing some more bogus steps just to space it out a bit more. Maybe we'll see if anyone else complains about it before we act. I'm comfortable with a "minor" priority on this.

#1848490: Import translations automatically during installation was just committed. YEAH! :D Marking active.

Gábor Hojtsy’s picture

Ideally batch API would allow us to put in estimated percentages to each step, so it would divide the overall progress based on that. I don't think this is of immediate importance. Also batch API might have an existing issue for this.

andypost’s picture

We have a testing module kind of batch when each step is displayed under batch

Sutharsan’s picture

Status: Active » Postponed

While preparing for queue execution, #1998056: Automatically update interface translations using cron simplifies the batch steps and reduces their number. This knocks out steps 3 and 4 in the description at #2. This change will fix this issue.

Changing status to Postponed awaiting the above mentioned issue to be completed before marking this one as fixed.

Sutharsan’s picture

Status: Postponed » Fixed

With #1998056: Automatically update interface translations using cron being committed to core, the problem is now fixed. A video of the import process during installation can be found here: http://www.youtube.com/watch?v=7rW8p32grAs

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.