Skip to content

Commit 0b9251b

Browse files
committed
keboola.flow is orchestration container job type
1 parent 195745a commit 0b9251b

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

src/JobFactory.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
abstract class JobFactory
1313
{
1414
public const ORCHESTRATOR_COMPONENT = 'keboola.orchestrator';
15+
16+
public const FLOW_COMPONENT = 'keboola.flow';
17+
1518
public const PROTECTED_DEFAULT_BRANCH_FEATURE = 'protected-default-branch';
1619

1720
/**

src/JobFactory/JobRuntimeResolver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ private function resolveJobType(array $jobData): JobType
275275
if ((intval($jobData['parallelism']) > 0) || $jobData['parallelism'] === JobInterface::PARALLELISM_INFINITY) {
276276
return JobType::ROW_CONTAINER;
277277
} else {
278-
if ($jobData['componentId'] === JobFactory::ORCHESTRATOR_COMPONENT) {
278+
if ($jobData['componentId'] === JobFactory::FLOW_COMPONENT) {
279+
return JobType::ORCHESTRATION_CONTAINER;
280+
} elseif ($jobData['componentId'] === JobFactory::ORCHESTRATOR_COMPONENT) {
279281
if (isset($jobData['configData']['phaseId']) && (string) ($jobData['configData']['phaseId']) !== '') {
280282
return JobType::PHASE_CONTAINER;
281283
} else {

src/Orchestration/OrchestrationJobMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private function validateInputs(JobInterface $job, array $configuration): void
9292
/* since the matcher accepts a jobId, we need to check that it is a sort of sensible input -
9393
the main use case is root orchestration job, but it seems that a phaseContainer might be
9494
equally valid input. */
95-
if ($job->getComponentId() !== JobFactory::ORCHESTRATOR_COMPONENT) {
95+
if (!in_array($job->getComponentId(), [JobFactory::ORCHESTRATOR_COMPONENT, JobFactory::FLOW_COMPONENT], true)) {
9696
throw new OrchestrationJobMatcherValidationException(sprintf(
9797
'Job "%s" is not an orchestration job.',
9898
$job->getId(),

tests/JobFactory/JobRuntimeResolverTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ public function resolveDefaultBackendContextData(): Generator
6969
JobType::ORCHESTRATION_CONTAINER,
7070
null,
7171
];
72+
yield 'flow job' => [
73+
JobFactory::FLOW_COMPONENT,
74+
[],
75+
JobType::ORCHESTRATION_CONTAINER,
76+
null,
77+
];
7278
}
7379

7480
/**

0 commit comments

Comments
 (0)