Skip to content

Commit c14f827

Browse files
authored
docs(serverless_jobs): add documentation (#405)
1 parent d75adef commit c14f827

File tree

4 files changed

+280
-0
lines changed

4 files changed

+280
-0
lines changed

scaleway-async/scaleway_async/jobs/v1alpha1/api.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ async def create_job_definition(
5454
job_timeout: Optional[str] = None,
5555
) -> JobDefinition:
5656
"""
57+
Create a new job definition in a specified Project.
58+
:param region: Region to target. If none is passed will use default region from the config.
59+
:param name: Name of the job definition.
60+
:param cpu_limit: CPU limit of the job.
61+
:param memory_limit: Memory limit of the job.
62+
:param image_uri: Image to use for the job.
63+
:param command: Startup command.
64+
:param project_id: UUID of the Scaleway Project containing the job.
65+
:param environment_variables: Environment variables of the job.
66+
:param description: Description of the job.
67+
:param job_timeout: Timeout of the job in seconds.
68+
:return: :class:`JobDefinition <JobDefinition>`
5769
5870
Usage:
5971
::
@@ -101,6 +113,10 @@ async def get_job_definition(
101113
region: Optional[Region] = None,
102114
) -> JobDefinition:
103115
"""
116+
Get a job definition by its unique identifier.
117+
:param region: Region to target. If none is passed will use default region from the config.
118+
:param job_definition_id: UUID of the job definition to get.
119+
:return: :class:`JobDefinition <JobDefinition>`
104120
105121
Usage:
106122
::
@@ -133,6 +149,13 @@ async def list_job_definitions(
133149
project_id: Optional[str] = None,
134150
) -> ListJobDefinitionsResponse:
135151
"""
152+
List all your job definitions with filters.
153+
:param region: Region to target. If none is passed will use default region from the config.
154+
:param page:
155+
:param page_size:
156+
:param order_by:
157+
:param project_id:
158+
:return: :class:`ListJobDefinitionsResponse <ListJobDefinitionsResponse>`
136159
137160
Usage:
138161
::
@@ -168,6 +191,12 @@ async def list_job_definitions_all(
168191
project_id: Optional[str] = None,
169192
) -> List[JobDefinition]:
170193
"""
194+
List all your job definitions with filters.
195+
:param region: Region to target. If none is passed will use default region from the config.
196+
:param page:
197+
:param page_size:
198+
:param order_by:
199+
:param project_id:
171200
:return: :class:`List[ListJobDefinitionsResponse] <List[ListJobDefinitionsResponse]>`
172201
173202
Usage:
@@ -204,6 +233,18 @@ async def update_job_definition(
204233
job_timeout: Optional[str] = None,
205234
) -> JobDefinition:
206235
"""
236+
Update an existing job definition associated with the specified unique identifier.
237+
:param region: Region to target. If none is passed will use default region from the config.
238+
:param job_definition_id: UUID of the job definition to update.
239+
:param name: Name of the job definition.
240+
:param cpu_limit: CPU limit of the job.
241+
:param memory_limit: Memory limit of the job.
242+
:param image_uri: Image to use for the job.
243+
:param command: Startup command.
244+
:param environment_variables: Environment variables of the job.
245+
:param description: Description of the job.
246+
:param job_timeout: Timeout of the job in seconds.
247+
:return: :class:`JobDefinition <JobDefinition>`
207248
208249
Usage:
209250
::
@@ -248,6 +289,9 @@ async def delete_job_definition(
248289
region: Optional[Region] = None,
249290
) -> Optional[None]:
250291
"""
292+
Delete an exsisting job definition by its unique identifier.
293+
:param region: Region to target. If none is passed will use default region from the config.
294+
:param job_definition_id: UUID of the job definition to delete.
251295
252296
Usage:
253297
::
@@ -277,6 +321,10 @@ async def start_job_definition(
277321
region: Optional[Region] = None,
278322
) -> JobRun:
279323
"""
324+
Run an existing job definition by its unique identifier. This will create a new job run.
325+
:param region: Region to target. If none is passed will use default region from the config.
326+
:param job_definition_id: UUID of the job definition to start.
327+
:return: :class:`JobRun <JobRun>`
280328
281329
Usage:
282330
::
@@ -306,6 +354,10 @@ async def get_job_run(
306354
region: Optional[Region] = None,
307355
) -> JobRun:
308356
"""
357+
Get a job run by its unique identifier.
358+
:param region: Region to target. If none is passed will use default region from the config.
359+
:param job_run_id: UUID of the job run to get.
360+
:return: :class:`JobRun <JobRun>`
309361
310362
Usage:
311363
::
@@ -333,6 +385,10 @@ async def stop_job_run(
333385
region: Optional[Region] = None,
334386
) -> JobRun:
335387
"""
388+
Stop a job run by its unique identifier.
389+
:param region: Region to target. If none is passed will use default region from the config.
390+
:param job_run_id: UUID of the job run to stop.
391+
:return: :class:`JobRun <JobRun>`
336392
337393
Usage:
338394
::
@@ -364,6 +420,14 @@ async def list_job_runs(
364420
project_id: Optional[str] = None,
365421
) -> ListJobRunsResponse:
366422
"""
423+
List all job runs with filters.
424+
:param region: Region to target. If none is passed will use default region from the config.
425+
:param page:
426+
:param page_size:
427+
:param order_by:
428+
:param job_definition_id:
429+
:param project_id:
430+
:return: :class:`ListJobRunsResponse <ListJobRunsResponse>`
367431
368432
Usage:
369433
::
@@ -401,6 +465,13 @@ async def list_job_runs_all(
401465
project_id: Optional[str] = None,
402466
) -> List[JobRun]:
403467
"""
468+
List all job runs with filters.
469+
:param region: Region to target. If none is passed will use default region from the config.
470+
:param page:
471+
:param page_size:
472+
:param order_by:
473+
:param job_definition_id:
474+
:param project_id:
404475
:return: :class:`List[ListJobRunsResponse] <List[ListJobRunsResponse]>`
405476
406477
Usage:

scaleway-async/scaleway_async/jobs/v1alpha1/types.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,49 @@ class CreateJobDefinitionRequest:
122122
"""
123123

124124
name: Optional[str]
125+
"""
126+
Name of the job definition.
127+
"""
125128

126129
cpu_limit: int
130+
"""
131+
CPU limit of the job.
132+
"""
127133

128134
memory_limit: int
135+
"""
136+
Memory limit of the job.
137+
"""
129138

130139
image_uri: str
140+
"""
141+
Image to use for the job.
142+
"""
131143

132144
command: str
145+
"""
146+
Startup command.
147+
"""
133148

134149
project_id: Optional[str]
150+
"""
151+
UUID of the Scaleway Project containing the job.
152+
"""
135153

136154
environment_variables: Optional[Dict[str, str]]
155+
"""
156+
Environment variables of the job.
157+
"""
137158

138159
description: str
160+
"""
161+
Description of the job.
162+
"""
139163

140164
job_timeout: Optional[str]
165+
"""
166+
Timeout of the job in seconds.
167+
"""
141168

142169

143170
@dataclass
@@ -148,6 +175,9 @@ class GetJobDefinitionRequest:
148175
"""
149176

150177
job_definition_id: str
178+
"""
179+
UUID of the job definition to get.
180+
"""
151181

152182

153183
@dataclass
@@ -174,22 +204,49 @@ class UpdateJobDefinitionRequest:
174204
"""
175205

176206
job_definition_id: str
207+
"""
208+
UUID of the job definition to update.
209+
"""
177210

178211
name: Optional[str]
212+
"""
213+
Name of the job definition.
214+
"""
179215

180216
cpu_limit: Optional[int]
217+
"""
218+
CPU limit of the job.
219+
"""
181220

182221
memory_limit: Optional[int]
222+
"""
223+
Memory limit of the job.
224+
"""
183225

184226
image_uri: Optional[str]
227+
"""
228+
Image to use for the job.
229+
"""
185230

186231
command: Optional[str]
232+
"""
233+
Startup command.
234+
"""
187235

188236
environment_variables: Optional[Dict[str, str]]
237+
"""
238+
Environment variables of the job.
239+
"""
189240

190241
description: Optional[str]
242+
"""
243+
Description of the job.
244+
"""
191245

192246
job_timeout: Optional[str]
247+
"""
248+
Timeout of the job in seconds.
249+
"""
193250

194251

195252
@dataclass
@@ -200,6 +257,9 @@ class DeleteJobDefinitionRequest:
200257
"""
201258

202259
job_definition_id: str
260+
"""
261+
UUID of the job definition to delete.
262+
"""
203263

204264

205265
@dataclass
@@ -210,6 +270,9 @@ class StartJobDefinitionRequest:
210270
"""
211271

212272
job_definition_id: str
273+
"""
274+
UUID of the job definition to start.
275+
"""
213276

214277

215278
@dataclass
@@ -220,6 +283,9 @@ class GetJobRunRequest:
220283
"""
221284

222285
job_run_id: str
286+
"""
287+
UUID of the job run to get.
288+
"""
223289

224290

225291
@dataclass
@@ -230,6 +296,9 @@ class StopJobRunRequest:
230296
"""
231297

232298
job_run_id: str
299+
"""
300+
UUID of the job run to stop.
301+
"""
233302

234303

235304
@dataclass

0 commit comments

Comments
 (0)