Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd failure: "Process died. Last State: initializing" #167

Open
NiklasBr opened this issue Feb 16, 2023 · 1 comment
Open

Odd failure: "Process died. Last State: initializing" #167

NiklasBr opened this issue Feb 16, 2023 · 1 comment

Comments

@NiklasBr
Copy link
Contributor

Trying to implement in a custom command, by taking inspiration from ProcessManagerSampleCommandSimple.php, what would cause this execute() method to fail like this?

   use ExecutionTrait;
   protected function execute(InputInterface $input, OutputInterface $output): int
   {
        $monitoringItem = self::initProcessManager(
            implode('|', $input->getOption(self::ARGUMENT_TYPES)),
            ['autoCreate' => true]
        );
        $monitoringItem->setStatus(MonitoringItem::STATUS_INITIALIZING);

        $types = $input->getOption(self::ARGUMENT_TYPES);

        $monitoringItem->setTotalSteps(1 + count($types))->setMessage('Starting process')->save();
        $step = 0;

        if (in_array(Category::classId(), $types, true)) {
            $monitoringItem->setMessage('Indexing categories')->setCurrentStep(++$step)->save();
            $this->output->writeln('Indexing categories');
            $categories = new Category\Listing();
            $categories->setObjectTypes([AbstractObject::OBJECT_TYPE_OBJECT, AbstractObject::OBJECT_TYPE_VARIANT]);
            $total = $categories->getTotalCount();
            for ($i = 0; $i < (ceil($total / $this->paginationCount)); $i++) {
                $categories->setLimit($this->paginationCount);
                $categories->setOffset($i * $this->paginationCount);
                $monitoringItem->setMessage("Indexing categories (offset {$categories->getOffset()} of {$total})")->setCurrentStep(++$step)->save();
                foreach ($categories->getObjects() as $category) {
                    $this->output->writeln("Indexing {$category->getFullPath()}");
                    $this->bus->dispatch(new IndexMessage($category->getId(), $category::class));
                }
                $monitoringItem->setStatus(MonitoringItem::STATUS_RUNNING);
            }
        }

        if (in_array(Product::classId(), $types, true)) {
            $monitoringItem->setMessage('Indexing products')->setCurrentStep(++$step)->save();
            $this->output->writeln('Indexing products');
            $products = new Product\Listing();
            $products->setObjectTypes([AbstractObject::OBJECT_TYPE_OBJECT, AbstractObject::OBJECT_TYPE_VARIANT]);
            $total = $products->getTotalCount();
            for ($i = 0; $i < (ceil($total / $this->paginationCount)); $i++) {
                $products->setLimit($this->paginationCount);
                $products->setOffset($i * $this->paginationCount);
                $monitoringItem->setMessage("Indexing products (offset {$products->getOffset()} of {$total})")->setCurrentStep(++$step)->save();
                foreach ($products->getObjects() as $product) {
                    $this->output->writeln("Indexing {$product->getFullPath()}");
                    $this->bus->dispatch(new IndexMessage($product->getId(), $product::class));
                }
                $monitoringItem->setStatus(MonitoringItem::STATUS_RUNNING);
            }
        }

        $monitoringItem->setMessage('Job finished')->setCompleted();

        return self::SUCCESS;
    }

Screenshot 2023-02-16 at 13 58 16

@RickardAhlstedt
Copy link

I'm having a similiar issue, where the process first reports as "Finished with errors" (expected in this case), but after 10-15 minutes it switches to "Failed" along with a message of "Process died. Error occurred, file has not been imported Last State: finished_with_errors".

@ctippler Could you point both of us in the right direction regarding this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants