85a543d8ec
* Starting to measure wall time and cpu time in the workers, and reporting that via otel and to completed task run attempts * Move usage tracking outside of the executor * WIP prod usage tracking * WIP * WIP custom fetch to openmeter * Create a usage client * WIP * WIP * Implement new machine preset stuff and send usage reports to OpenMeter from webapp * WIP * Expose usage info to the client * Add usage and cost to TaskEvent * Add ability to globally configure the task machine preset * Report start run usage * Change the machine docs to use presets * setExpirationTime to 24h * Removed logs * Update machines.mdx * Removed console.logs * Handle revalidating JWT tokens * Couple tweaks --------- Co-authored-by: Matt Aitken <matt@mattaitken.com>
42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
---
|
|
title: "Machines"
|
|
description: "Configure the number of vCPUs and GBs of RAM you want the task to use."
|
|
---
|
|
|
|
The `machine` configuration is optional. Using higher spec machines will increase the cost of running the task but can also improve the performance of the task if it is CPU or memory bound.
|
|
|
|
```ts /trigger/heavy-task.ts
|
|
export const heavyTask = task({
|
|
id: "heavy-task",
|
|
machine: {
|
|
preset: "large-1x",
|
|
},
|
|
run: async ({ payload, ctx }) => {
|
|
//...
|
|
},
|
|
});
|
|
```
|
|
|
|
The default machine is `small-1x` which has 0.5 vCPU and 0.5 GB of RAM. You can change the default machine in your `trigger.config.ts` file:
|
|
|
|
```ts trigger.config.ts
|
|
import type { TriggerConfig } from "@trigger.dev/sdk/v3";
|
|
|
|
export const config: TriggerConfig = {
|
|
machine: "small-2x",
|
|
// ... other config
|
|
};
|
|
```
|
|
|
|
## Machine configurations
|
|
|
|
| Preset | vCPU | Memory |
|
|
| --------- | ---- | ------ |
|
|
| micro | 0.25 | 0.25 |
|
|
| small-1x | 0.5 | 0.5 |
|
|
| small-2x | 1 | 1 |
|
|
| medium-1x | 1 | 2 |
|
|
| medium-2x | 2 | 4 |
|
|
| large-1x | 4 | 8 |
|
|
| large-2x | 8 | 16 |
|