Add a non blocking batch runner

Created on 11 July 2024, 9 months ago

Problem/Motivation

When a batch is submitted, the batch runner completely takes over the user interface, preventing any other operations. An example of this is when you install Umami via the installer UI, and the config translation sync runs after submitting the site information form, taking an extra 15-30 seconds to get the site installed.

Instead, if we have the information required already, we could add a batch runner to the site information form page itself, then config translations would download while you're filling out the form. It might still need to block submitting the form until this completes, but it would probably be done by the time you get to the end anyway.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component
BatchΒ  β†’

Last updated 23 days ago

Created by

πŸ‡¬πŸ‡§United Kingdom catch

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @catch
  • πŸ‡¬πŸ‡§United Kingdom catch
  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

    IMHO this sounds fantastic. For its use in the installer, but also in other cases, I think its important that it actually runs through, which is what may be hard to ensure. I guess you can already leave the page when a batch is running but now that it would be less evidently running, people may leave the page even more. That said, it would be fantastic if we would not block the user doing something just because we also need Drupal to do a lot of things in the background.

  • πŸ‡¬πŸ‡§United Kingdom catch

    I guess you can already leave the page when a batch is running but now that it would be less evidently running, people may leave the page even more. That said, it would be fantastic if we would not block the user doing something just because we also need Drupal to do a lot of things in the background.

    Yes this is going to be one of the harder pieces. We can probably cover a lot if we keep track in the user's session that they started a batch (probably the batch ID), check the session on every page request to see if we need to show the batch element, and then the element resumes where it left off if there's a batch still running. Then finishing a batch needs to clear $_SESSION['active_batches'] or similar.

  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

    Also the tricky part about this may be that the installer language import updates default config en masse so we nee to be careful what other config saves we allow at the same time as they may go over each other :)

  • πŸ‡¬πŸ‡§United Kingdom catch

    A possible approach would be that when the batch is running, something like installing a new module via project browser would have to add a new item to the end of the batch instead of doing it immediately. Or a less complex implementation we could disable form submits while the batch is running (but not filling out form fields or clicking around the project browser UI for example).

    I also think that, separately from this issue, we could add some parallelism to the language import batch via Fibers and guzzle async requests - like fire off 5 or 10 translation requests at a time per batch iteration. That could probably be done self-contained in its own issue, would make the current blocking batch a lot quicker, and mean much shorter windows for things to potentially go wrong or form submits to be prevented for this issue.

  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

    Yeah downloading the translation files could be very well parallelized, if d.o file server can handle the load :) Importing them I'm not sure can be parallelized since importing a .po file can have far reaching effects on dozens of config files at once. Then the importing next .po file is has effects on another dozen files, some overlap with the previous, etc.

  • πŸ‡¬πŸ‡§United Kingdom catch

    Importing them I'm not sure can be parallelized since importing a .po file can have far reaching effects on dozens of config files at once. Then the importing next .po file is has effects on another dozen files, some overlap with the previous, etc.

    Yeah importing we can't really do async with other imports, but we can do it once we've downloaded one file and are waiting for other ones to finish.

    So instead of:

    ABABABABABAB
    

    It's more like:


    ABBBBBB
    AAA
    A
    A

    Opened πŸ“Œ Parallelize config translation import Active .

Production build 0.71.5 2024