You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Managing jobs in your codebase and the dashboard"
3
+
description: "Managing Jobs in your codebase and the dashboard"
4
4
---
5
5
6
-
## Disabling jobs
6
+
## Disabling Jobs
7
7
8
-
To prevent a job from processing new runs, you can disable it by setting the `enabled` option:
8
+
To prevent a Job from processing new Runs, you can disable it by setting the `enabled` option:
9
9
10
10
```ts
11
11
client.defineJob({
@@ -15,29 +15,29 @@ client.defineJob({
15
15
trigger: eventTrigger({ name: "example.event" }),
16
16
enabled: false,
17
17
run: async (payload, io, ctx) => {
18
-
// your job code here
18
+
// your Job code here
19
19
},
20
20
});
21
21
```
22
22
23
23
If you omit the `enabled` option, it will default to `true`.
24
24
25
-
The job will only be disabled in environments that have seen the `enabled = false` value. So the job will remain enabled in production until the code with the `enabled = false` is deployed to production.
25
+
The Job will only be disabled in environments that have seen the `enabled = false` value. So the Job will remain enabled in production until the code with the `enabled = false` is deployed to production.
26
26
27
27
<Note>
28
-
Currently this is the only way to disable a job. If you'd like to disable a job in the Dashboard,
28
+
Currently this is the only way to disable a Job. If you'd like to disable a Job in the Dashboard,
29
29
please reach out to us on [Discord](https://discord.gg/kA47vcd8P6) and let us know 👋
30
30
</Note>
31
31
32
-
Once a job is disabled no **new**runs will be created for that job, and it will still be visible in the Dashboard as disabled:
32
+
Once a Job is disabled no **new**Runs will be created for that Job, and it will still be visible in the Dashboard as disabled:
33
33
34
34

35
35
36
-
### In-progress runs
36
+
### In-progress Runs
37
37
38
-
In-progress runs will be allowed to finish, even runs that are currently delayed from a call to `io.wait`. If you'd like to completely stop in-progress runs, you have two options:
38
+
In-progress Runs will be allowed to finish, even Runs that are currently delayed from a call to `io.wait`. If you'd like to completely stop in-progress Runs, you have two options:
39
39
40
-
- Set the `enabled` option to false and then `throw` an error at the top of your job`run` function.
40
+
- Set the `enabled` option to false and then `throw` an error at the top of your Job`run` function.
41
41
42
42
```ts
43
43
client.defineJob({
@@ -52,11 +52,11 @@ client.defineJob({
52
52
});
53
53
```
54
54
55
-
- Delete the job from your codebase. This will disable the job as well but also stop in progress runs.
55
+
- Delete the Job from your codebase. This will disable the Job as well but also stop in progress Runs.
56
56
57
57
### Disabling in production with env vars
58
58
59
-
You can easily disable jobs in production using env vars so you don't have to deploy new code to disable a job.
59
+
You can easily disable Jobs in production using env vars so you don't have to deploy new code to disable a Job.
Then you can disable the job in production by setting the `TRIGGER_JOBS_DISABLED` env var to `"true"`. And removing the env var will re-enable the job.
74
+
Then you can disable the Job in production by setting the `TRIGGER_JOBS_DISABLED` env var to `"true"`. And removing the env var will re-enable the Job.
75
75
76
-
## Deleting jobs
76
+
## Deleting Jobs
77
77
78
-
Once you have disabled a job in all environments, you can delete it from the dashboard by navigating to the Job list page and clicking the "triple-dot" menu next to the job you want to delete:
78
+
Once you have disabled a Job in all environments, you can delete it from the dashboard by navigating to the Job list page and clicking the "triple-dot" menu next to the Job you want to delete:
79
79
80
80

81
81
82
-
This will bring up a dialog confirming that you want to delete the job and all of its history:
82
+
This will bring up a dialog confirming that you want to delete the Job and all of its history:
0 commit comments