Skip to content

Commit 34c6704

Browse files
committed
docs(scheduled): update schedule management & testing for the new Tasks UI
1 parent b64b54c commit 34c6704

5 files changed

Lines changed: 36 additions & 14 deletions

File tree

‎docs/images/schedules-blank.png‎

90.8 KB
Loading

‎docs/images/schedules-create.png‎

197 KB
Loading
101 KB
Loading

‎docs/images/schedules-test.png‎

198 KB
Loading

‎docs/tasks/scheduled.mdx‎

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ export const secondScheduledTask = schedules.task({
127127
});
128128
```
129129

130-
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.
130+
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.
131131

132132
### Imperative schedules
133133

134-
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.
134+
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.
135135

136136
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.
137137

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

167167
## Attaching schedules in the dashboard
168168

169-
You need to attach a schedule to a task before it will run on a schedule. You can attach static schedules in the dashboard:
169+
You need to attach a schedule to a task before it will run on a schedule. You can attach imperative schedules in the dashboard:
170+
171+
<Note>
172+
**The Schedules page has moved.** There is no longer a standalone "Schedules" page in the
173+
sidebar. Schedules now live on the Tasks page: open a scheduled task to create, view, edit,
174+
enable/disable, and delete its schedules. The old `/schedules` URL redirects to the Tasks page.
175+
176+
The scheduled task must already exist first — define it in your code with `schedules.task()` and
177+
sync it to the environment by running the [dev](/cli-dev-commands) or
178+
[deploy](/cli-deploy-commands) command so it appears on the Tasks page. A project with no tasks
179+
yet will only show the deploy onboarding.
180+
</Note>
170181

171182
<Steps>
172183

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

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

183194
These are the options when creating a schedule:
184195

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

196207
</Steps>
197208

209+
## Managing schedules in the dashboard
210+
211+
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.
212+
213+
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.
214+
198215
## Attaching schedules with the SDK
199216

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

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

322+
<Note>
323+
There is no longer a standalone "Test" page in the sidebar. You test a task from the task itself —
324+
open it on the Tasks page and press the "Test schedule" button.
325+
</Note>
326+
305327
<Steps>
306328

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

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

0 commit comments

Comments
 (0)