File tree Expand file tree Collapse file tree 2 files changed +32
-39
lines changed Expand file tree Collapse file tree 2 files changed +32
-39
lines changed Original file line number Diff line number Diff line change 1
- import type { Schema as AISchema } from "ai" ;
2
- import { z } from "zod" ;
3
1
import { SerializableJson } from "../../schemas/json.js" ;
4
2
import { TriggerApiRequestOptions } from "../apiClient/index.js" ;
5
3
import { RunTags } from "../schemas/api.js" ;
@@ -221,41 +219,36 @@ type CommonTaskOptions<
221
219
});
222
220
* ```
223
221
*/
224
- machine ?: {
225
- /** vCPUs. The default is 0.5.
226
- *
227
- * Possible values:
228
- * - 0.25
229
- * - 0.5
230
- * - 1
231
- * - 2
232
- * - 4
233
- * @deprecated use preset instead
234
- */
235
- cpu ?: MachineCpu ;
236
- /** In GBs of RAM. The default is 1.
237
- *
238
- * Possible values:
239
- * - 0.25
240
- * - 0.5
241
- * - 1
242
- * - 2
243
- * - 4
244
- * - 8
245
- * * @deprecated use preset instead
246
- */
247
- memory ?: MachineMemory ;
248
-
249
- /** Preset to use for the machine. Defaults to small-1x */
250
- preset ?:
251
- | "micro"
252
- | "small-1x"
253
- | "small-2x"
254
- | "medium-1x"
255
- | "medium-2x"
256
- | "large-1x"
257
- | "large-2x" ;
258
- } ;
222
+ machine ?:
223
+ | {
224
+ /** vCPUs. The default is 0.5.
225
+ *
226
+ * Possible values:
227
+ * - 0.25
228
+ * - 0.5
229
+ * - 1
230
+ * - 2
231
+ * - 4
232
+ * @deprecated use preset instead
233
+ */
234
+ cpu ?: MachineCpu ;
235
+ /** In GBs of RAM. The default is 1.
236
+ *
237
+ * Possible values:
238
+ * - 0.25
239
+ * - 0.5
240
+ * - 1
241
+ * - 2
242
+ * - 4
243
+ * - 8
244
+ * * @deprecated use preset instead
245
+ */
246
+ memory ?: MachineMemory ;
247
+
248
+ /** Preset to use for the machine. Defaults to small-1x */
249
+ preset ?: MachinePresetName ;
250
+ }
251
+ | MachinePresetName ;
259
252
260
253
/**
261
254
* The maximum duration in compute-time seconds that a task run is allowed to run. If the task run exceeds this duration, it will be stopped.
Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ export function createTask<
204
204
description : params . description ,
205
205
queue : params . queue ,
206
206
retry : params . retry ? { ...defaultRetryOptions , ...params . retry } : undefined ,
207
- machine : params . machine ,
207
+ machine : typeof params . machine === "string" ? { preset : params . machine } : params . machine ,
208
208
maxDuration : params . maxDuration ,
209
209
fns : {
210
210
run : params . run ,
@@ -350,7 +350,7 @@ export function createSchemaTask<
350
350
description : params . description ,
351
351
queue : params . queue ,
352
352
retry : params . retry ? { ...defaultRetryOptions , ...params . retry } : undefined ,
353
- machine : params . machine ,
353
+ machine : typeof params . machine === "string" ? { preset : params . machine } : params . machine ,
354
354
maxDuration : params . maxDuration ,
355
355
fns : {
356
356
run : params . run ,
You can’t perform that action at this time.
0 commit comments