There's no indication of progress for any of the migrate commands.

Symfony Console provides a nice progress bar which we could use, since symfony/console is required by Drush.

Patch coming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim created an issue. See original summary.

joachim’s picture

Status: Active » Needs work
FileSize
3.14 KB

Here's how far I got with this:

- progress bar works for import
-- width isn't right -- looking at the Symfony code, it appears this should pick up on the terminal width, but it's not
-- there needs to be a newline after the progress bar, otherwise the next message runs on. Again, you'd think this would be something Symfony would do by itself?
- needs to be implemented for rollback as well

I'm leaving this for now, perhaps someone else can move it along a bit further?

heddn’s picture

Part of the issue with import progress (I think) is that we don't actually return any results from import. We're using a logger to override the default drupal logging during a migration and display results.

joachim’s picture

@heddn sorry, I don't really follow your comment.

The patch here works. It doesn't rely on any return from the import, but uses an event subscriber to update the Symfony progress bar for each migrated row:

+++ b/src/EventSubscriber/MigrationDrushCommandProgress.php
@@ -0,0 +1,66 @@
+    $events[MigrateEvents::POST_ROW_SAVE][] = ['postRowSave'];

All that this patch needs is some formatting tweaks, and an event subscriber added for rollback.

heddn’s picture

I hadn't looked at it so closely as that. But based on what you state in #4, I wonder if https://github.com/consolidation/annotated-command#configuring-output-fo... would help any?

heddn’s picture

Status: Needs work » Needs review
FileSize
4.13 KB
3.91 KB

This is shaping up really nice. Here we add rollback and we clear off the progress bar after completion of the operation so Drush messages can display. Not sure there's any better way of doing it.

heddn’s picture

FileSize
10.69 KB
11.39 KB

  • heddn committed 28b7419 on 8.x-4.x
    Issue #3075131 by heddn, joachim: use Symfony Console's progress bar
    
heddn’s picture

Status: Needs review » Fixed

This is a really great suggestion and improvement. Thanks for your contributions @joachim.

heddn’s picture

Status: Fixed » Needs review
FileSize
5.21 KB

Seems to have introduced a failure on the testbot.

  • heddn committed d0e525d on 8.x-4.x
    Issue #3075131 by heddn, joachim: use Symfony Console's progress bar
    
heddn’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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