Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pnpm exec trigger dev --log-level debug

6. Navigate to the `hello-world` project in your local dashboard at localhost:3030 and you should see the list of tasks.

7. Go to the "Test" page in the sidebar and select a task. Then enter a payload and click "Run test". You can tell what the payloads should be by looking at the relevant task file inside the reference project's `src/trigger` folder. Many of them accept an empty payload.
7. On the Tasks page, open a task and press the "Test" button to open its test page. Then enter a payload and click "Run test". You can tell what the payloads should be by looking at the relevant task file inside the reference project's `src/trigger` folder. Many of them accept an empty payload.

8. Feel free to add additional files in the reference project's `src/trigger` dir to test out specific aspects of the system, or add in edge cases.

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/examples/sentry-error-tracking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ After creating the task, deploy your project.

</CodeGroup>

Once deployed, navigate to the `test` page in the sidebar of your [Trigger.dev dashboard](https://cloud.trigger.dev), click on your `prod` environment, and select the `sentryErrorTest` task.
Once deployed, open the `sentry-error-test` task in your [Trigger.dev dashboard](https://cloud.trigger.dev) (make sure you're in your `prod` environment) and press the "Test" button to open the test page for it.

Run a test task with an empty payload by clicking the `Run test` button.

Expand Down
Binary file modified docs/images/schedules-blank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/schedules-create.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/schedules-test-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/schedules-test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/test-dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 12 additions & 11 deletions docs/run-tests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ title: "Run tests"
description: "You can use the dashboard to run a test of your tasks."
---

From the "Test" page in the side menu of the dashboard you can run a test for any of your tasks from any environment.
You can run a test for any of your tasks, in any environment, from the dashboard.

![Select an environment](/images/test-dashboard.png)
<Note>
There is no longer a "Test" page in the sidebar. You test a task from the task itself: on the
Tasks page open a task (or use the "Test" action next to a task in the Runs list) and press the
"Test" button to open its test page.
</Note>
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.

<Icon icon="circle-1" iconType="solid" color="#FF2D6B" size="20" /> Select a task to test
On a task's test page you can:

<Icon icon="circle-2" iconType="solid" color="#FF2D6B" size="20" /> Include a payload or metadata
- Enter the run's input — a JSON **payload** and optional **metadata**. Scheduled tasks show timestamp fields instead of a payload.
- Configure run **options** like the machine size, version, queue, tags, retries, max duration, or a delay.
- Pre-populate the form from a previous run with **Recent runs**, or save and reuse a configuration with **Templates**.
- Press **Run test** to trigger the run.

<Icon icon="circle-3" iconType="solid" color="#FF2D6B" size="20" /> Configure any additional options like the machine size, queue or delay

<Icon icon="circle-4" iconType="solid" color="#FF2D6B" size="20" /> Select from previous test runs

<Icon icon="circle-5" iconType="solid" color="#FF2D6B" size="20" /> Save the current test configuration as a template for later

<Icon icon="circle-6" iconType="solid" color="#FF2D6B" size="20" /> Run the test
![Test page](/images/test-dashboard.png)
8 changes: 3 additions & 5 deletions docs/snippets/step-run-test.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<Step title="Perform a test run using the dashboard">

The CLI `dev` command spits out various useful URLs. Right now we want to visit the Test page.
The CLI `dev` command spits out various useful URLs, including a link to the dashboard. Open it, find your Example task on the Tasks page, and press the "Test" button to open its test page.

You should see our Example task in the list <Icon icon="circle-1" iconType="solid" size={20} color="F43F47" />, select it. Most tasks have a "payload" which you enter in the JSON editor <Icon icon="circle-2" iconType="solid" size={20} color="F43F47" />, but our example task doesn't need any input.
Most tasks have a "payload" which you enter in the JSON editor, but our example task doesn't need any input. You can also configure run options, pre-populate the form from recent runs, and save run templates.

You can configure options on the run <Icon icon="circle-3" iconType="solid" size={20} color="F43F47" />, view recent payloads <Icon icon="circle-4" iconType="solid" size={20} color="F43F47" />, and create run templates <Icon icon="circle-5" iconType="solid" size={20} color="F43F47" />.

Press the "Run test" button <Icon icon="circle-6" iconType="solid" size={20} color="F43F47" />.
Press the "Run test" button.

![Test page](/images/test-dashboard.png)

Expand Down
50 changes: 36 additions & 14 deletions docs/tasks/scheduled.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ export const secondScheduledTask = schedules.task({
});
```

When you run the [dev](/cli-dev-commands) or [deploy](/cli-deploy-commands) commands, declarative schedules will be synced. If you add, delete or edit the `cron` property it will be updated when you run these commands. You can view your schedules on the Schedules page in the dashboard.
When you run the [dev](/cli-dev-commands) or [deploy](/cli-deploy-commands) commands, declarative schedules will be synced. If you add, delete or edit the `cron` property it will be updated when you run these commands. You can view your synced schedules in the dashboard: open the task on the Tasks page and check its "Schedules" tab.

### Imperative schedules

Alternatively you can explicitly attach schedules to a `schedules.task`. You can do this in the Schedules page in the dashboard by just pressing the "New schedule" button, or you can use the SDK to create schedules.
Alternatively you can explicitly attach schedules to a `schedules.task`. You can do this in the dashboard from the scheduled task's page by pressing the "Create schedule" button, or you can use the SDK to create schedules.

The advantage of imperative schedules is that they can be created dynamically, for example, you could create a schedule for each user in your database. They can also be activated, disabled, edited, and deleted without deploying new code by using the SDK or dashboard.

Expand Down Expand Up @@ -166,26 +166,37 @@ There are two situations when a scheduled task won't trigger:

## Attaching schedules in the dashboard

You need to attach a schedule to a task before it will run on a schedule. You can attach static schedules in the dashboard:
You need to attach a schedule to a task before it will run on a schedule. You can attach imperative schedules in the dashboard:

<Note>
**The Schedules page has moved.** There is no longer a standalone "Schedules" page in the
sidebar. Schedules now live on the Tasks page: open a scheduled task to create, view, edit,
enable/disable, and delete its schedules. The old `/schedules` URL redirects to the Tasks page.

The scheduled task must already exist first — define it in your code with `schedules.task()` and
sync it to the environment by running the [dev](/cli-dev-commands) or
[deploy](/cli-deploy-commands) command so it appears on the Tasks page. A project with no tasks
yet will only show the deploy onboarding.
</Note>

<Steps>

<Step title="Go to the Schedules page">
In the sidebar select the "Schedules" page, then press the "New schedule" button. Or you can
follow the onboarding and press the create in dashboard button. ![Blank schedules
page](/images/schedules-blank.png)
<Step title="Open the scheduled task">
In the sidebar select the "Tasks" page, then select the scheduled task you want to attach a
schedule to (scheduled tasks have a clock icon, and you can filter the list to Scheduled).
![Scheduled task page](/images/schedules-blank.png)
</Step>

<Step title="Create your schedule">
Fill in the form and press "Create schedule" when you're done. ![Environment variables
page](/images/schedules-create.png)
Press the "Create schedule" button, fill in the form, and press "Create schedule" when you're
done. ![Create schedule form](/images/schedules-create.png)

These are the options when creating a schedule:

| Name | Description |
| ----------------- | --------------------------------------------------------------------------------------------- |
| Task | The id of the task you want to attach to. |
| Cron pattern | The schedule in cron format. |
| Cron pattern | The schedule in cron format. You can also describe it in natural language and press "Generate" to fill this in. |
| Timezone | The timezone the schedule will run in. Defaults to "UTC" |
| External id | An optional external id, usually you'd use a userId. |
| Deduplication key | An optional deduplication key. If you pass the same value, it will update rather than create. Scoped per project, not per environment. |
Expand All @@ -195,6 +206,12 @@ These are the options when creating a schedule:

</Steps>

## Managing schedules in the dashboard

Open the scheduled task and switch to the "Schedules" tab to see every schedule attached to it — both declarative and imperative — with its type, cron pattern, external id, next and last run, and status.

Click a schedule to open the inspector, where you can **enable/disable**, **edit**, or **delete** imperative schedules without deploying new code. Declarative schedules are managed in your code, so they can't be edited or deleted from here.

## Attaching schedules with the SDK

You call `schedules.create()` to create a schedule from your code. Here's the simplest possible example:
Expand Down Expand Up @@ -302,14 +319,19 @@ You can also retrieve, list, delete, deactivate and re-activate schedules using

You can test a scheduled task in the dashboard. Note that the `scheduleId` will always come through as `sched_1234` to the run.

<Note>
There is no longer a standalone "Test" page in the sidebar. You test a task from the task itself —
open it on the Tasks page and press the "Test schedule" button.
</Note>

<Steps>

<Step title="Go to the Test page">
In the sidebar select the "Test" page, then select a scheduled task from the list (they have a
clock icon on them) ![Test page](/images/schedules-test.png)
<Step title="Open the test page for your task">
On the "Tasks" page, open your scheduled task and press the "Test schedule" button.
![Scheduled task page](/images/schedules-test.png)
</Step>

<Step title="Create your schedule">
<Step title="Run the test">
Fill in the form [1]. You can select from a recent run [2] to pre-populate the fields. Press "Run
test" when you're ready ![Schedule test form](/images/schedules-test-form.png)
</Step>
Expand Down
Loading