akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
954 stars 516 forks source link

Job "data_quality_insights_evaluations" not found 5.0.16 #14185

Open michster opened 3 years ago

michster commented 3 years ago

Hello, I'm facing the following issues, while upgrading from 4.0 to 5.0.

The cronjobs are throwing these errors when executing the jobs:

pim:data-quality-insights:evaluations Job "data_quality_insights_evaluations" not found

pim:data-quality-insights:schedule-periodic-tasks Job "data_quality_insights_periodic_tasks" does not exist.

If you need more details, please let me know.

Thanks :)

wucherpfennig commented 3 years ago

I assume we are facing the same issue as data quality does not get calculated automatically and only on product save (NOT on model)...

Version: Fresh installation

// edit

updated to 5.0.14

I was able to at least launch the process by calling

php bin/console pim:data-quality-insights:evaluations

// edit

I did forget the cron jobs... 🥳

Thijzer commented 3 years ago

This should help Please Akeneo : if you accept this fix, keep the filename, so I don't have collisions later.

<?php declare(strict_types=1);

namespace Pim\Upgrade\Schema;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
 * Class Version_5_0_20210426151505_add_dqi_jobs
 * @package Pim\Upgrade\Schema
 */
final class Version_5_0_20210426151505_add_dqi_jobs extends AbstractMigration
{
    public function up(Schema $schema) : void
    {
        $this->createJobInstance('data_quality_insights_evaluations');
        $this->createJobInstance('data_quality_insights_periodic_tasks');
    }

    private function createJobInstance(string $jobName)
    {
        $query = <<<SQL
INSERT INTO `akeneo_batch_job_instance` (`code`, `label`, `job_name`, `status`, `connector`, `raw_parameters`, `type`)
VALUES (
    :job_name,
    :job_name,
    :job_name,
    :status,
    :raw,
    :connector,
    :job_type
);
SQL;
        $this->addSql($query, [
            'job_name' => $jobName,
            'connector' => 'Data Quality Insights Connector',
            'status' => 0,
            'raw' => 'a:0:{}',
            'job_type' => 'data_quality_insights',
        ]);
    }

    public function down(Schema $schema) : void
    {
        $this->throwIrreversibleMigrationException();
    }
}
michster commented 3 years ago

Hey @Thijzer, thanks for your fix.

After running the migration, I got another error while running the data quality evaluation job. The createJobInstance function writes some values in the wrong place. I've just made some improvements based on the latest migration job from akeneo.

In my case, the following code works great:

<?php 

declare(strict_types=1);

namespace Pim\Upgrade\Schema;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version_5_0_20210426151505_add_dqi_jobs extends AbstractMigration
{
    public function up(Schema $schema) : void
    {
        $this->createJobInstance('data_quality_insights_evaluations', 'Launch the evaluations of products and structure.');
        $this->createJobInstance('data_quality_insights_periodic_tasks', 'Schedule the periodic tasks of Data-Quality-Insights.');
    }

    private function createJobInstance(string $jobName, string $label)
    {
        $sql = <<<SQL
INSERT INTO akeneo_batch_job_instance (code, label, job_name, status, connector, raw_parameters, type)
VALUES (:code, :label, :job_name, :status, :connector, :raw_parameters, :type);
SQL;
        $this->addSql($sql, [
            'code'           => $jobName,
            'label'          => $label,
            'job_name'       => $jobName,
            'connector' => 'Data Quality Insights Connector',
            'status' => 0,
            'raw_parameters' => 'a:0:{}',
            'type' => 'data_quality_insights',
        ]);
    }

    public function down(Schema $schema) : void
    {
        $this->throwIrreversibleMigrationException();
    }
}
Philippe-M commented 2 years ago

Hello, i've the same problem after migrate 4.x to 5.0.96 and I don't understand how to fix it :(

danielbeardsley commented 1 year ago

Can confirm, I had this same problem and this migration addressed it, thanks!