Commit 3485d53
authored
fix(batch): undeprecate useOptimalInstanceClasses property (#36353)
### Issue # (if applicable)
Closes #36291.
### Reason for this change
The `useOptimalInstanceClasses` property was deprecated in v2.220 in favor of `defaultInstanceClasses`, but there is no way to exclude the `optimal` instance type using `defaultInstanceClasses` alone. Users who want to specify only custom instance types (e.g., R4 only) without `optimal` being automatically added have no non-deprecated path forward.
Setting `defaultInstanceClasses: []` (empty array) does not prevent `optimal` from being added because the current logic treats an empty array the same as `undefined`.
### Description of changes
- Removed `@deprecated` annotation from `useOptimalInstanceClasses` property
- Updated README to remove the deprecation warning and reorganized the "Choosing Your Instance Types" section with:
- Clear subsections for each use case (Default Instance Classes, Specific Instance Types Only, Optimal Instance Classes)
- A configuration reference table for quick lookup
- Example showing how to use `useOptimalInstanceClasses: false` to exclude `optimal`
#### Alternatives considered
Three options were discussed in #36291:
1. **Remove deprecation** (this PR) - Restores `useOptimalInstanceClasses` as a non-deprecated property
2. **Treat empty `defaultInstanceClasses: []` as "exclude all defaults"** - Would introduces implicit behavior
3. **Change default behavior** - Breaking change, not acceptable
Option 1 was chosen because:
- Minimal code change (documentation only)
- No risk of breaking existing users
- `useOptimalInstanceClasses` provides explicit, clear control that `defaultInstanceClasses` cannot fully replace
### Describe any new or updated permissions being added
N/A
### Description of how you validated changes
Existing tests
### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*1 parent 2d5c210 commit 3485d53
File tree
2 files changed
+55
-37
lines changed- packages/aws-cdk-lib/aws-batch
- lib
2 files changed
+55
-37
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
70 | 74 | | |
71 | 75 | | |
72 | | - | |
| 76 | + | |
73 | 77 | | |
74 | | - | |
| 78 | + | |
| 79 | + | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | 83 | | |
85 | | - | |
| 84 | + | |
| 85 | + | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
92 | 96 | | |
93 | 97 | | |
94 | | - | |
| 98 | + | |
95 | 99 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 100 | + | |
| 101 | + | |
100 | 102 | | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
103 | 113 | | |
104 | 114 | | |
105 | | - | |
106 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
107 | 120 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 121 | + | |
114 | 122 | | |
115 | 123 | | |
116 | 124 | | |
117 | 125 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 126 | + | |
121 | 127 | | |
| 128 | + | |
| 129 | + | |
122 | 130 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 131 | + | |
128 | 132 | | |
129 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
130 | 150 | | |
131 | 151 | | |
132 | 152 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
521 | | - | |
522 | 521 | | |
523 | 522 | | |
524 | 523 | | |
| |||
942 | 941 | | |
943 | 942 | | |
944 | 943 | | |
945 | | - | |
946 | 944 | | |
947 | 945 | | |
948 | 946 | | |
| |||
1073 | 1071 | | |
1074 | 1072 | | |
1075 | 1073 | | |
1076 | | - | |
| 1074 | + | |
1077 | 1075 | | |
1078 | 1076 | | |
1079 | 1077 | | |
| |||
0 commit comments