Parallelization::fetchItems()now requiresOutputInterfaceas a second parameter- A lot more type-safety and validation has been added with a comprehensive message upon failure.
- When no number of process is given (via
-p|--processes), the command is no longer executed in the main process. Instead, the number of processes is guessed based on the maximum number of cores detected. Note that the execution within the main process instead of spawning child processes can be guaranteed by passing--main-process. - Child processes will always be spawned regardless of the number of items
(known or not), the number of processes defined (or not defined). Instead,
the processing will occur only if the
--main-processoption is passed. ParallelizationInputshould be created from the new factory::fromInput()ContainerAwareCommandhas been removed.Parallelizationinstead provides a::getContainer()method which by defaults returns the Symfony Application Kernel's container when available.- The
Parallelization#logErrorproperty has been deprecated. Override the new::createErrorHandler()method instead. - Rename
ParallelizationInput::configureParallelization()to::configureCommand() - The
Parallelization::configureParallelization()method has been deprecated. UseParallelizationInput::configureCommand()directly instead. - Most of the execution of the
Parallelizationtrait has been moved to theParallelExecutor. Certain pieces are no longer overridable, but each key element should remain configurable. Since creating theParallelExecutoris quite complex, aParallelExecutorFactoryhas been introduced allowing to create an executor whilst overriding only the necessary bits. All the following methods have been deprecated in favour of overriding::getParallelExecutableFactory()to configure the factory instead:::getProgressSymbol()::detectPhpExecutable()::getWorkingDirectory()::getEnvironmentVariables()::getSegmentSize()::getBatchSize()::getConsolePath()
- The following methods have been removed from
Parallelizationand have no replacement (the existing and new extension points should be enough to cover those):::executeMasterProcess()::executeChildProcess()::processChildOutput()::runTolerantSingleCommand()::serializeInputOptions()::quoteOptionValue()::isValueRequiresQuoting()
::fetchItems()can now return aniterableinstead ofarray::getItemName()can now takenullfor an unknown number of items- Ensures that if an item is given, then the processing is done in the main process. An item also cannot be passed to a child process (via the argument).
- A
ErrorHandlerinterface has been introduced which offers an extension point on how to handle an error that occurred when processing an item. TheParallelizationtrait offers a::createErrorHandler()method which by default logs the error and resets the Container (when resettable) in order to avoid issues such as a broken Doctrine UnitOfWork. - The logging has been consolidated into a
Loggerinterface which can be overridden by::createLogger()provided in theParallelizationtrait - The logging has been consolidated into a
Loggerinterface which can be overridden by::createLogger()provided in theParallelizationtrait - The process launching strategy and details has been moved to the
ProcessLauncherandProcessLauncherFactoryinterfaces. To change the process launching implementation used, you can configure it viaParallelExecutorFactory::withProcessLauncherFactory().
Notable "internal" BC breaks:
ItemBatchIterablehas been renamed toChunkedItemsIteratorParallelizationInputis now only validated when creating it via the new factory::fromInput()- Most of the execution of the
Parallelizationtrait has been moved to theParallelExecutor. Certain pieces are no longer overridable, but each key element should remain configurable. ProcessLauncherhas been renamed toSymfonyProcessLauncherand moved under theProcessnamespace.- A few parameters have been added to
SymfonyProcessLauncher