Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(glue): adds timeout and workerType validation for Ray jobs #29613

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/@aws-cdk/aws-glue-alpha/lib/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,14 @@ export class Job extends JobBase {
throw new Error('Both workerType and workerCount must be set');
}

if (executable.type === JobType.RAY && props.timeout) {
throw new Error('Ray jobs do not support timeout');
}

if (executable.type === JobType.RAY && (props.workerType !== WorkerType.Z_2X)) {
throw new Error('Ray jobs must specify workerType, which may only be Z_2X');
}

const jobResource = new CfnJob(this, 'Resource', {
name: props.jobName,
description: props.description,
Expand Down
38 changes: 38 additions & 0 deletions packages/@aws-cdk/aws-glue-alpha/test/job.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,44 @@ describe('Job', () => {
workerCount: 2,
})).toThrow('Runtime is required for Ray jobs');
});

test('with timeout should throw', () => {
expect(() => new glue.Job(stack, 'Job', {
executable: glue.JobExecutable.pythonRay({
glueVersion: glue.GlueVersion.V4_0,
pythonVersion: glue.PythonVersion.THREE_NINE,
runtime: glue.Runtime.RAY_TWO_FOUR,
script,
}),
workerType: glue.WorkerType.Z_2X,
workerCount: 2,
timeout: cdk.Duration.minutes(5),
})).toThrow('Ray jobs do not support timeout');
});

test('without worker type should throw', () => {
expect(() => new glue.Job(stack, 'Job', {
executable: glue.JobExecutable.pythonRay({
glueVersion: glue.GlueVersion.V4_0,
pythonVersion: glue.PythonVersion.THREE_NINE,
runtime: glue.Runtime.RAY_TWO_FOUR,
script,
}),
})).toThrow('Ray jobs must specify workerType, which may only be Z_2X');
});

test('with unsupported worker type should throw', () => {
expect(() => new glue.Job(stack, 'Job', {
executable: glue.JobExecutable.pythonRay({
glueVersion: glue.GlueVersion.V4_0,
pythonVersion: glue.PythonVersion.THREE_NINE,
runtime: glue.Runtime.RAY_TWO_FOUR,
script,
}),
workerType: glue.WorkerType.G_1X,
workerCount: 2,
})).toThrow('Ray jobs must specify workerType, which may only be Z_2X');
});
});

test('etl job with all props should synthesize correctly', () => {
Expand Down
Loading