Pipeline condition

The base of the pipeline conditions get located in the Process Pipelines component.

The Import Pipeline component provides standardized pipeline conditions

HasImportBunches

The PipelineCondition checks import files for executability, togetherness, and whether the import files are to get imported.

  • In the condition, the ImportBunchResolver is used to check

    • whether files belong together based on file names and identifiers

    • whether OK files are available for Bunch Import files

Implementation isReady vendor/techdivision/pacemaker-import-base/Model/Condition/Pipeline/HasImportBunches.php
<?php
public function isReady(array $pipelineConfiguration): bool
{
    $bunches = $this->importBunchResolver->get();
    if (!empty($bunches)) {
        $this->arguments = ['bunches' => $this->resolveBunchesArgument($bunches)];
        return true;
    }
    return false;
}

IsPipelineEnabled

Generic pipeline condition that can be designed specifically to a configuration through DI modifications.

  • It is checked whether a configuration flag of a configuration path, which can get changed through DI, for example, is set to YES or NO

    • For each pipeline there are configuration settings for this purpose

    • The information is set through the ImportFilesDateFetcher, which configuration takes effect for which pipeline

Implementation isActive vendor/techdivision/pacemaker-import-base/Model/ImportFilesDataFetcher.php
<?php
private function isActive(array $config): bool
{
    $path = $config['enable_config_path'] ?? null;
    if ($path === null) {
        return true;
    }
    return (bool)$this->scopeConfig->getValue($path);
}
Declaration ImportFilesDataFetcher vendor/techdivision/pacemaker-import-catalog/etc/di.xml
<type name="TechDivision\PacemakerImportBase\Model\ImportFilesDataFetcher">
    <arguments>
        <argument name="resolverConfig" xsi:type="array">
            <item name="pacemaker.import.catalog" xsi:type="array">
                <item name="resolver" xsi:type="object">
                    TechDivision\PacemakerImportCatalog\Virtual\ImportBunchResolver
                </item>
                <item name="validator" xsi:type="object">
                    TechDivision\PacemakerImportBase\Api\ImportBunchValidatorInterface
                </item>
                <item name="pipeline_name" xsi:type="string">
                    pacemaker_import_catalog
                </item>
                <item name="enable_config_path" xsi:type="string">
                    techdivision_pacemaker_import/catalog/enabled
                </item>
            </item>
            . . .
        </argument>
    </arguments>
</type>

NoSiblingInProcess

The pipeline condition NoSiblingInProcess checks whether pipelines with the same name exist and whether they are still in pending or running status.

  • As long as existing pipelines with the same name are pending or running, no new pipeline with the name to be checked is created.

IndexerAutoSpawnCondition

IndexerAutoSpawnCondition is a particular auto-spawn condition.

  • An index pipeline should get executed with every heartbeat

  • The condition checks whether indexer steps of the pipeline have already got created or whether they are still classified

    • If this is the case, no indexer pipeline will get created

The condition is also used directly in the indexer spawn executor

IndexerCronExpression - virtual

IndexerCronExpression is a virtual extension with Magento-DI of Cron-Expression.

  • By default, an indexer pipeline should get created every minute

  • The cron expression * * can get customized with *Magento-Di

Virtualization NoConflictingIndexStepProcess vendor/techdivision/pacemaker-indexer/etc/di.xml
<virtualType name="TechDivision\PacemakerIndexer\Virtual\Condition\Pipeline\IndexerCronExpression"
             type="TechDivision\ProcessPipelines\Helper\Condition\Pipeline\CronExpression">
    <arguments>
        <argument name="data" xsi:type="array">
            <item name="cron_expression" xsi:type="string">* * * *</item>
        </argument>
    </arguments>
</virtualType>