I have a huge amount of data that I want to process quickly and get most of my server. So, I created one parent artisan team and one team for the children's craft .
Parent Wizard Team . Gets the value from the database, performs all the calculations, splits the data into pieces, and executes multiple instances of the child artisan command using the following code.
foreach($arrayOfData as $chunk){
$this->call('process:data',[
'data' => $chunk
]);
$this->info('Chunk Processed');
}
But he expects one instance to stop execution, which means that he does not immediately execute multiple instances of the children's artisan commands that I want! I know that calling this method will wait until one instance of the child artisan command stops execution. Is there a way I can execute multiple instances child artisan command
without waiting for one instance to stop execution?
I already looked for different ways to do this, I can execute child artisan commands using exec()
similar functions, but it will also return an exit code for which my code will wait.
Performing only two instances at a time, I can divide the time for data processing by 2. And I want to execute three instances at once! Is there any way to do this?
Additional Information
Child artisan: . , .