1515use Keboola \StorageApiBranch \ClientWrapper ;
1616use Keboola \StorageApiBranch \Factory \ClientOptions ;
1717use Keboola \StorageApiBranch \Factory \StorageClientPlainFactory ;
18+ use Keboola \StorageApiBranch \StorageApiToken ;
1819use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
1920
2021/**
@@ -27,6 +28,7 @@ class JobRuntimeResolver
2728 ];
2829
2930 private const PAY_AS_YOU_GO_FEATURE = 'pay-as-you-go ' ;
31+ private const NO_DIND_FEATURE = 'job-queue-no-dind ' ;
3032
3133 private ClientWrapper $ clientWrapper ;
3234 private Components $ componentsApiClient ;
@@ -39,7 +41,7 @@ public function __construct(
3941 ) {
4042 }
4143
42- public function resolveJobData (array $ jobData , array $ tokenInfo ): array
44+ public function resolveJobData (array $ jobData , StorageApiToken $ token ): array
4345 {
4446 $ this ->configuration = null ;
4547 $ this ->jobData = $ jobData ;
@@ -56,14 +58,14 @@ public function resolveJobData(array $jobData, array $tokenInfo): array
5658 $ jobData ['tag ' ] = $ this ->resolveTag ($ jobData );
5759 $ variableValues = $ this ->resolveVariables ();
5860 $ jobData ['parallelism ' ] = $ this ->resolveParallelism ($ jobData );
59- $ jobData ['executor ' ] = $ this ->resolveExecutor ($ jobData )->value ;
61+ $ jobData ['executor ' ] = $ this ->resolveExecutor ($ jobData, $ token )->value ;
6062 $ jobData = $ this ->resolveBranchType ($ jobData );
6163
6264 // set type after resolving parallelism
6365 $ jobData ['type ' ] = $ this ->resolveJobType ($ jobData )->value ;
6466
6567 // set backend after resolving type
66- $ jobData ['backend ' ] = $ this ->resolveBackend ($ jobData , $ tokenInfo )->toDataArray ();
68+ $ jobData ['backend ' ] = $ this ->resolveBackend ($ jobData , $ token )->toDataArray ();
6769
6870 foreach ($ variableValues ->asDataArray () as $ key => $ value ) {
6971 $ jobData [$ key ] = $ value ;
@@ -170,7 +172,7 @@ private function getBackend(array $jobData): Backend
170172 return $ this ->mergeBackendsData ($ backend , $ overrideByBackend );
171173 }
172174
173- private function resolveBackend (array $ jobData , array $ tokenInfo ): Backend
175+ private function resolveBackend (array $ jobData , StorageApiToken $ token ): Backend
174176 {
175177 $ tempBackend = $ this ->getBackend ($ jobData );
176178
@@ -196,7 +198,7 @@ private function resolveBackend(array $jobData, array $tokenInfo): Backend
196198 We also ignore backend settings for other workspace types, as they do not make any sense at the moment.
197199 */
198200 if (in_array ($ stagingStorage , ['local ' , 's3 ' , 'abs ' , 'none ' ]) &&
199- !in_array (self ::PAY_AS_YOU_GO_FEATURE , $ tokenInfo [ ' owner ' ][ ' features ' ] ?? [] )
201+ !$ token -> hasFeature (self ::PAY_AS_YOU_GO_FEATURE )
200202 ) {
201203 return new Backend (null , $ tempBackend ->getType (), $ backendContext );
202204 }
@@ -288,11 +290,12 @@ private function resolveJobType(array $jobData): JobType
288290 return JobType::STANDARD ;
289291 }
290292
291- private function resolveExecutor (array $ jobData ): Executor
293+ private function resolveExecutor (array $ jobData, StorageApiToken $ token ): Executor
292294 {
293295 $ value = $ jobData ['executor ' ] ??
294296 $ this ->getConfigData ()['runtime ' ]['executor ' ] ??
295297 $ this ->getConfiguration ()['runtime ' ]['executor ' ] ??
298+ ($ token ->hasFeature (self ::NO_DIND_FEATURE ) ? Executor::K8S_CONTAINERS ->value : null ) ??
296299 Executor::getDefault ()->value
297300 ;
298301
0 commit comments