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" ;
31import { SerializableJson } from "../../schemas/json.js" ;
42import { TriggerApiRequestOptions } from "../apiClient/index.js" ;
53import { RunTags } from "../schemas/api.js" ;
@@ -221,41 +219,36 @@ type CommonTaskOptions<
221219 });
222220 * ```
223221 */
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 ;
259252
260253 /**
261254 * 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<
204204 description : params . description ,
205205 queue : params . queue ,
206206 retry : params . retry ? { ...defaultRetryOptions , ...params . retry } : undefined ,
207- machine : params . machine ,
207+ machine : typeof params . machine === "string" ? { preset : params . machine } : params . machine ,
208208 maxDuration : params . maxDuration ,
209209 fns : {
210210 run : params . run ,
@@ -350,7 +350,7 @@ export function createSchemaTask<
350350 description : params . description ,
351351 queue : params . queue ,
352352 retry : params . retry ? { ...defaultRetryOptions , ...params . retry } : undefined ,
353- machine : params . machine ,
353+ machine : typeof params . machine === "string" ? { preset : params . machine } : params . machine ,
354354 maxDuration : params . maxDuration ,
355355 fns : {
356356 run : params . run ,
You can’t perform that action at this time.
0 commit comments