@@ -350,38 +350,40 @@ export class JobExecutable {
350
350
private config : JobExecutableConfig ;
351
351
352
352
private constructor ( config : JobExecutableConfig ) {
353
- if ( JobType . PYTHON_SHELL === config . type ) {
353
+ const glueVersion = config . glueVersion . name ;
354
+ const type = config . type . name ;
355
+ if ( JobType . PYTHON_SHELL . name === type ) {
354
356
if ( config . language !== JobLanguage . PYTHON ) {
355
357
throw new Error ( 'Python shell requires the language to be set to Python' ) ;
356
358
}
357
- if ( [ GlueVersion . V0_9 , GlueVersion . V3_0 , GlueVersion . V4_0 ] . includes ( config . glueVersion ) ) {
358
- throw new Error ( `Specified GlueVersion ${ config . glueVersion . name } does not support Python Shell` ) ;
359
+ if ( [ GlueVersion . V0_9 . name , GlueVersion . V4_0 . name ] . includes ( glueVersion ) ) {
360
+ throw new Error ( `Specified GlueVersion ${ glueVersion } does not support Python Shell` ) ;
359
361
}
360
362
}
361
- if ( JobType . RAY === config . type ) {
363
+ if ( JobType . RAY . name === type ) {
362
364
if ( config . language !== JobLanguage . PYTHON ) {
363
365
throw new Error ( 'Ray requires the language to be set to Python' ) ;
364
366
}
365
- if ( [ GlueVersion . V0_9 , GlueVersion . V1_0 , GlueVersion . V2_0 , GlueVersion . V3_0 ] . includes ( config . glueVersion ) ) {
366
- throw new Error ( `Specified GlueVersion ${ config . glueVersion . name } does not support Ray` ) ;
367
+ if ( [ GlueVersion . V0_9 . name , GlueVersion . V1_0 . name , GlueVersion . V2_0 . name , GlueVersion . V3_0 . name ] . includes ( glueVersion ) ) {
368
+ throw new Error ( `Specified GlueVersion ${ glueVersion } does not support Ray` ) ;
367
369
}
368
370
}
369
- if ( config . extraJarsFirst && [ GlueVersion . V0_9 , GlueVersion . V1_0 ] . includes ( config . glueVersion ) ) {
370
- throw new Error ( `Specified GlueVersion ${ config . glueVersion . name } does not support extraJarsFirst` ) ;
371
+ if ( config . extraJarsFirst && [ GlueVersion . V0_9 . name , GlueVersion . V1_0 . name ] . includes ( glueVersion ) ) {
372
+ throw new Error ( `Specified GlueVersion ${ glueVersion } does not support extraJarsFirst` ) ;
371
373
}
372
- if ( config . pythonVersion === PythonVersion . TWO && ! [ GlueVersion . V0_9 , GlueVersion . V1_0 ] . includes ( config . glueVersion ) ) {
373
- throw new Error ( `Specified GlueVersion ${ config . glueVersion . name } does not support PythonVersion ${ config . pythonVersion } ` ) ;
374
+ if ( config . pythonVersion === PythonVersion . TWO && ! [ GlueVersion . V0_9 . name , GlueVersion . V1_0 . name ] . includes ( glueVersion ) ) {
375
+ throw new Error ( `Specified GlueVersion ${ glueVersion } does not support PythonVersion ${ config . pythonVersion } ` ) ;
374
376
}
375
377
if ( JobLanguage . PYTHON !== config . language && config . extraPythonFiles ) {
376
378
throw new Error ( 'extraPythonFiles is not supported for languages other than JobLanguage.PYTHON' ) ;
377
379
}
378
- if ( config . pythonVersion === PythonVersion . THREE_NINE && config . type !== JobType . PYTHON_SHELL && config . type !== JobType . RAY ) {
380
+ if ( config . pythonVersion === PythonVersion . THREE_NINE && type !== JobType . PYTHON_SHELL . name && type !== JobType . RAY . name ) {
379
381
throw new Error ( 'Specified PythonVersion PythonVersion.THREE_NINE is only supported for JobType Python Shell and Ray' ) ;
380
382
}
381
- if ( config . pythonVersion === PythonVersion . THREE && config . type === JobType . RAY ) {
383
+ if ( config . pythonVersion === PythonVersion . THREE && type === JobType . RAY . name ) {
382
384
throw new Error ( 'Specified PythonVersion PythonVersion.THREE is not supported for Ray' ) ;
383
385
}
384
- if ( config . runtime === undefined && config . type === JobType . RAY ) {
386
+ if ( config . runtime === undefined && type === JobType . RAY . name ) {
385
387
throw new Error ( 'Runtime is required for Ray jobs.' ) ;
386
388
}
387
389
this . config = config ;
0 commit comments