@@ -95,12 +95,12 @@ export enum PythonVersion {
95
95
*/
96
96
export class JobType {
97
97
/**
98
- * Command for running a Glue ETL job.
98
+ * Command for running a Glue Spark job.
99
99
*/
100
100
public static readonly ETL = new JobType ( 'glueetl' ) ;
101
101
102
102
/**
103
- * Command for running a Glue streaming job.
103
+ * Command for running a Glue Spark streaming job.
104
104
*/
105
105
public static readonly STREAMING = new JobType ( 'gluestreaming' ) ;
106
106
@@ -109,6 +109,11 @@ export class JobType {
109
109
*/
110
110
public static readonly PYTHON_SHELL = new JobType ( 'pythonshell' ) ;
111
111
112
+ /**
113
+ * Command for running a Glue Ray job.
114
+ */
115
+ public static readonly RAY = new JobType ( 'glueray' ) ;
116
+
112
117
/**
113
118
* Custom type name
114
119
* @param name type name
@@ -211,6 +216,11 @@ export interface PythonSparkJobExecutableProps extends SharedSparkJobExecutableP
211
216
*/
212
217
export interface PythonShellExecutableProps extends SharedJobExecutableProps , PythonExecutableProps { }
213
218
219
+ /**
220
+ * Props for creating a Python Ray job executable
221
+ */
222
+ export interface PythonRayExecutableProps extends SharedJobExecutableProps , PythonExecutableProps { }
223
+
214
224
/**
215
225
* The executable properties related to the Glue job's GlueVersion, JobType and code
216
226
*/
@@ -281,6 +291,19 @@ export class JobExecutable {
281
291
} ) ;
282
292
}
283
293
294
+ /**
295
+ * Create Python executable props for Ray jobs.
296
+ *
297
+ * @param props Ray Job props.
298
+ */
299
+ public static pythonRay ( props : PythonRayExecutableProps ) : JobExecutable {
300
+ return new JobExecutable ( {
301
+ ...props ,
302
+ type : JobType . RAY ,
303
+ language : JobLanguage . PYTHON ,
304
+ } ) ;
305
+ }
306
+
284
307
/**
285
308
* Create a custom JobExecutable.
286
309
*
@@ -297,10 +320,18 @@ export class JobExecutable {
297
320
if ( config . language !== JobLanguage . PYTHON ) {
298
321
throw new Error ( 'Python shell requires the language to be set to Python' ) ;
299
322
}
300
- if ( [ GlueVersion . V0_9 , GlueVersion . V2_0 , GlueVersion . V3_0 , GlueVersion . V4_0 ] . includes ( config . glueVersion ) ) {
323
+ if ( [ GlueVersion . V0_9 , GlueVersion . V3_0 , GlueVersion . V4_0 ] . includes ( config . glueVersion ) ) {
301
324
throw new Error ( `Specified GlueVersion ${ config . glueVersion . name } does not support Python Shell` ) ;
302
325
}
303
326
}
327
+ if ( JobType . RAY === config . type ) {
328
+ if ( config . language !== JobLanguage . PYTHON ) {
329
+ throw new Error ( 'Ray requires the language to be set to Python' ) ;
330
+ }
331
+ if ( [ GlueVersion . V0_9 , GlueVersion . V1_0 , GlueVersion . V2_0 , GlueVersion . V3_0 ] . includes ( config . glueVersion ) ) {
332
+ throw new Error ( `Specified GlueVersion ${ config . glueVersion . name } does not support Ray` ) ;
333
+ }
334
+ }
304
335
if ( config . extraJarsFirst && [ GlueVersion . V0_9 , GlueVersion . V1_0 ] . includes ( config . glueVersion ) ) {
305
336
throw new Error ( `Specified GlueVersion ${ config . glueVersion . name } does not support extraJarsFirst` ) ;
306
337
}
@@ -310,8 +341,11 @@ export class JobExecutable {
310
341
if ( JobLanguage . PYTHON !== config . language && config . extraPythonFiles ) {
311
342
throw new Error ( 'extraPythonFiles is not supported for languages other than JobLanguage.PYTHON' ) ;
312
343
}
313
- if ( config . pythonVersion === PythonVersion . THREE_NINE && config . type !== JobType . PYTHON_SHELL ) {
314
- throw new Error ( 'Specified PythonVersion PythonVersion.THREE_NINE is only supported for JobType Python Shell' ) ;
344
+ if ( config . pythonVersion === PythonVersion . THREE_NINE && config . type !== JobType . PYTHON_SHELL && config . type !== JobType . RAY ) {
345
+ throw new Error ( 'Specified PythonVersion PythonVersion.THREE_NINE is only supported for JobType Python Shell and Ray' ) ;
346
+ }
347
+ if ( config . pythonVersion === PythonVersion . THREE && config . type === JobType . RAY ) {
348
+ throw new Error ( 'Specified PythonVersion PythonVersion.THREE is not supported for Ray' ) ;
315
349
}
316
350
this . config = config ;
317
351
}
0 commit comments