Skip to content

Commit 4f03e7e

Browse files
authored
Merge pull request #541 from keboola/miro-AJDA-231
AJDA-231: allow backend size for keboola.legacy-tran…
2 parents 25b1770 + 9969807 commit 4f03e7e

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

src/JobFactory/JobRuntimeResolver.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,19 @@ private function resolveBackend(array $jobData, StorageApiToken $token): Backend
196196
For workspace size, we only consider 'workspace-snowflake' as it is the only backend supporting scaling.
197197
During this we ignore any containerType setting received in $tempBackend, which so far is intentional.
198198
We also ignore backend settings for other workspace types, as they do not make any sense at the moment.
199+
Component "keboola.legacy-transformation" supports dynamic backend, but it doesn't have workspace staging.
199200
*/
201+
if ($jobData['componentId'] === 'keboola.legacy-transformation') {
202+
return new Backend($tempBackend->getType(), null, $backendContext);
203+
}
200204
if (in_array($stagingStorage, ['local', 's3', 'abs', 'none']) &&
201205
!$token->hasFeature(self::PAY_AS_YOU_GO_FEATURE)
202206
) {
203207
return new Backend(null, $tempBackend->getType(), $backendContext);
204208
}
205209
if ($stagingStorage === 'workspace-snowflake') {
206-
// dynamic workspace si hidden behind another feature `workspace-snowflake-dynamic-backend-size`
207-
// that is checked in SAPI, so we don't check it here, yet
210+
// Dynamic workspace si hidden behind another feature `workspace-snowflake-dynamic-backend-size`
211+
// that is checked in SAPI, so we don't check it here.
208212
return new Backend($tempBackend->getType(), null, $backendContext);
209213
}
210214
return new Backend(null, null, $backendContext);

tests/JobFactory/JobRuntimeResolverTest.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,8 +1162,10 @@ public function testResolveBackend(
11621162
?string $expectedContainerType,
11631163
?string $expectedContext,
11641164
array $tokenFeatures,
1165+
string $componentId = 'keboola.ex-db-snowflake',
11651166
): void {
11661167
$jobData = $this::JOB_DATA;
1168+
$jobData['componentId'] = $componentId;
11671169
$jobData['configId'] = null;
11681170
$jobData['tag'] = '1.2.3';
11691171
$jobData['variableValuesData'] = [
@@ -1182,7 +1184,7 @@ public function testResolveBackend(
11821184

11831185
$storageClient = self::createMock(BranchAwareClient::class);
11841186
$storageClient->expects(self::exactly($expectedApiCallCount))->method('apiGet')
1185-
->with('components/keboola.ex-db-snowflake')
1187+
->with(sprintf('components/%s', $componentId))
11861188
->willReturn(
11871189
$this->getTestComponentData($stagingInput),
11881190
);
@@ -1196,7 +1198,7 @@ public function testResolveBackend(
11961198
'id' => '123456456',
11971199
'runId' => '123456456',
11981200
'configId' => null,
1199-
'componentId' => 'keboola.ex-db-snowflake',
1201+
'componentId' => $componentId,
12001202
'mode' => 'run',
12011203
'status' => 'created',
12021204
'desiredStatus' => 'processing',
@@ -1400,6 +1402,28 @@ public function backendProvider(): Generator
14001402
null,
14011403
[],
14021404
];
1405+
yield 'legacy transformation - large' => [
1406+
'large',
1407+
null,
1408+
'none',
1409+
1,
1410+
'large',
1411+
null,
1412+
null,
1413+
[],
1414+
'keboola.legacy-transformation',
1415+
];
1416+
yield 'legacy transformation - default' => [
1417+
null,
1418+
null,
1419+
'none',
1420+
1,
1421+
null,
1422+
null,
1423+
null,
1424+
[],
1425+
'keboola.legacy-transformation',
1426+
];
14031427
}
14041428

14051429
private function getTestComponentData(?string $stagingInput = 'local'): array

0 commit comments

Comments
 (0)