This repository was archived by the owner on May 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +33
-2
lines changed Expand file tree Collapse file tree 1 file changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,9 @@ Jobs can be used to read and write to/from all nitric resources, for example the
40
40
Batches are defined similarly to services in a project's ` nitric.yaml ` file. For example:
41
41
42
42
``` yaml
43
- batches :
43
+ batch-services :
44
44
- match : ./batches/*.ts
45
- start : yarn dev:batches $BATCH_PATH
45
+ start : yarn dev:batches $SERVICE_PATH
46
46
` ` `
47
47
48
48
<Note>Batches can contain any number of Job Definitions.</Note>
@@ -83,6 +83,20 @@ async def generate_image(ctx: None):
83
83
Nitric.run()
84
84
```
85
85
86
+ ``` dart
87
+ import 'package:nitric_sdk/nitric.dart';
88
+
89
+ void main() {
90
+ final job = Nitric.job("batch-jobs");
91
+
92
+ job.handler((ctx) async {
93
+ print("New job submitted for ${ctx.req.jobName}: ${ctx.req.message}");
94
+
95
+ return ctx;
96
+ }, opts: JobResourceRequirements(cpus: 1, memory: 1024, gpus: 0));
97
+ }
98
+ ```
99
+
86
100
</CodeGroup >
87
101
88
102
## Submitting Jobs for Execution
@@ -133,4 +147,21 @@ async def submit_job(ctx):
133
147
Nitric.run()
134
148
```
135
149
150
+ ``` dart
151
+ import 'package:nitric_sdk/nitric.dart';
152
+
153
+ void main() {
154
+ final api = Nitric.api("public");
155
+ final analyze = Nitric.job("analyze").allow([JobPermission.submit]);
156
+
157
+ api.get("/submit-job", (ctx) async {
158
+ analyze.submit({
159
+ "someKey": "someValue"
160
+ });
161
+
162
+ return ctx;
163
+ });
164
+ }
165
+ ```
166
+
136
167
</CodeGroup >
You can’t perform that action at this time.
0 commit comments