Problem/Motivation
During the migration process, conditions may arise that need communication, and potentially aborting a given row or the entire migration process. Right now it's confusing to developers how to communicate these conditions, and the available means for communication and exceptions differ according to where in the pipeline the condition is detected.
Communication
There are two means of communicating conditions during migration
- The MigrateMessageInterface service, which is intended for messages to be communicated directly to the front-end (drush command/web UI), such as a migration as a whole being skipped or aborted.
- The ID map class saveMessage() method, which is intended for logging conditions specific to a given source row (it logs to a message table keyed by the source ID).
One issue we need is to clearly document these two methods and provide examples of when/where to use each on d.o. Even with that, however, they are not consistently available - for example, process plugins have no clean access to the MigrateExecutable's message service for display to the front end.
Exceptions
Migrate has three exception classes for use during processing- MigrateException, MigrateSkipProcessException, and MigrateSkipRowException. When to use each exception is not clearly documented. More confusing, different exceptions are caught at different points in the pipeline - which exceptions are caught and how they are handled differ according to whether they're thrown from a source plugin (prepareRow), process plugin, or destination plugin). This is confusing, and some valid exception scenarios may not be supported at this time.
Related issues
Issues relating directly to these WTFs:
- #2487568: Process plugins should not be allowed to skip rows
- #2488836: Refactor prepareRow() to add events in addition to hook
- #2361401: Skip the row when we don't recognize the the field type
Other issues related to exceptions/messages:
- #2546004: Add message service to migrate events
- #2549801: Improve source provider missing exception message.
- #2443617: Find a way for SourcePluginBase to get MigrateExecutable
- #2485259: Migration should abort gracefully if db not found
- #2481167: Better error reporting when migration fails getRequirements()
Proposed resolution
TBD
Remaining tasks
- Thoroughly document and understand the whens/wheres of messaging and exceptions as they exist now in the issue summary.
- Discuss possible resolutions.
- Create appropriate child issues.
- Implement the child issues.
User interface changes
N/A
API changes
TBD
Comments
Comment #2
mikeryanComment #3
neclimdulAdditional things discussed in IRC but not found in the related issue list:
1) Exception in process plugins don't seem to be reporting anywhere and don't have a method for displaying messages.
2) neclimdul is confused.
Possible solutions might include some of the following tasks:
1) Making the message interface a display interface.
2) Displaying messages(saveMessage messages) using the display service.
3) Improving documentation on when to call saveMessage.
4) Explaining to me(and documenting) why queueMessage exists.
5) Exposing display functionality through the executable(this could probably replace #2546004: Add message service to migrate events and is inline with things like #2443617: Find a way for SourcePluginBase to get MigrateExecutable
Comment #4
mikeryanMarking as migrate-critical - I think it is critical to do the analysis and clearly identify specific issues and possible solutions, and it's quite likely we'll have at least one migrate-critical patch come out of this.
Comment #5
mikeryanI'm working on the analysis at https://docs.google.com/document/d/17-nH0k8ZxfrUs4mf3pPDFHEHhjeDzyIS4G54....
As a starting point, the biggest WTF (and one I know is hanging up @neclimdul and @lostkangaroo) is #2559571: Handle MigrateException consistently during import. If not migrate-critical, I think it's close...
Comment #6
mikeryanCreated an issue discussing the message table architecture at #2561413: Consider reimplementing message tables using LoggerInterface.
Comment #8
mikeryanThe remaining child/related issues are not Migrate-critical and can stand-alone, so removing the Migrate critical tag and closing this.