-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(glue-alpha): pair workerType and numberOfWorkers into a required workerConfiguration #38576
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ import { lit } from 'aws-cdk-lib/core/lib/helpers-internal'; | |
| import { addConstructMetadata } from 'aws-cdk-lib/core/lib/metadata-resource'; | ||
| import type * as constructs from 'constructs'; | ||
| import type { Code } from '../code'; | ||
| import type { WorkerType } from '../constants'; | ||
| import type { JobProps } from './job'; | ||
| import { Job } from './job'; | ||
|
|
||
|
|
@@ -90,10 +91,38 @@ export interface SparkUILoggingLocation { | |
| readonly prefix?: string; | ||
| } | ||
|
|
||
| /** | ||
| * The worker configuration for a Spark job. | ||
| * | ||
| * The worker type and the number of workers are set together: providing this | ||
| * configuration requires both values, so a Spark job can never be given one | ||
| * without the other. | ||
| */ | ||
| export interface WorkerConfiguration { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm always confused when nesting vs flat for me this against guideline, can you explain to me why did you go with this choice and also update the guideline for other to understand?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default, we should prefer flat interfaces, to make it more ergonomic for other jsii languages, such as Java. So, if it's just to organize the fields more nicely, it's not worth it. But here, the nested interface serves another ergonomic purpose: to make sure that invalid states are unrepresentable. In this case, |
||
| /** | ||
| * The type of predefined worker that is allocated when a job runs. | ||
| * | ||
| * Enum options: Standard, G_1X, G_2X, G_025X, G_4X, G_8X, Z_2X | ||
| */ | ||
| readonly workerType: WorkerType; | ||
|
|
||
| /** | ||
| * The number of workers of the given `workerType` that are allocated when a job runs. | ||
| */ | ||
| readonly numberOfWorkers: number; | ||
| } | ||
|
|
||
| /** | ||
| * Common properties for different types of Spark jobs. | ||
| */ | ||
| export interface SparkJobProps extends JobProps { | ||
| /** | ||
| * The worker type and the number of workers allocated when a job runs. | ||
| * | ||
| * @default - the job runs with the G_1X worker type and 10 workers. | ||
| */ | ||
| readonly workerConfiguration?: WorkerConfiguration; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By moving it to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but |
||
|
|
||
| /** | ||
| * Enables the Spark UI debugging and monitoring with the specified props. | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with
WorkerConfiguration.