Skip to content

Budget

Source: src/AWS/Deadline/Budget.ts

An AWS Deadline Cloud budget — tracks a queue’s approximate render spend over a fixed window and stops scheduling when thresholds are crossed.

Queue Budget with Hard Stop

import * as AWS from "alchemy/AWS";
const budget = yield* AWS.Deadline.Budget("MonthlyBudget", {
farmId: farm.farmId,
queueId: queue.queueId,
approximateDollarLimit: 100,
actions: [
{ type: "STOP_SCHEDULING_AND_COMPLETE_TASKS", thresholdPercentage: 100 },
],
schedule: {
fixed: {
startTime: "2026-01-01T00:00:00Z",
endTime: "2027-01-01T00:00:00Z",
},
},
});

Graduated Thresholds

// Let in-flight tasks finish at 90%, cancel everything at 100%.
const budget = yield* AWS.Deadline.Budget("QueueBudget", {
farmId: farm.farmId,
queueId: queue.queueId,
approximateDollarLimit: 500,
actions: [
{ type: "STOP_SCHEDULING_AND_COMPLETE_TASKS", thresholdPercentage: 90 },
{ type: "STOP_SCHEDULING_AND_CANCEL_TASKS", thresholdPercentage: 100 },
],
schedule: {
fixed: {
startTime: "2026-01-01T00:00:00Z",
endTime: "2026-02-01T00:00:00Z",
},
},
});