queueflow 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. queueflow/__init__.py +80 -0
  2. queueflow/api/__init__.py +11 -0
  3. queueflow/api/cron_api.py +1808 -0
  4. queueflow/api/dlq_api.py +996 -0
  5. queueflow/api/health_api.py +527 -0
  6. queueflow/api/jobs_api.py +1830 -0
  7. queueflow/api/system_api.py +523 -0
  8. queueflow/api/worker_api.py +1229 -0
  9. queueflow/api/workflows_api.py +1804 -0
  10. queueflow/api_client.py +797 -0
  11. queueflow/api_response.py +21 -0
  12. queueflow/configuration.py +579 -0
  13. queueflow/exceptions.py +199 -0
  14. queueflow/facade.py +255 -0
  15. queueflow/models/__init__.py +57 -0
  16. queueflow/models/backoff_strategy.py +38 -0
  17. queueflow/models/complete_job_request.py +89 -0
  18. queueflow/models/create_batch_jobs_request.py +95 -0
  19. queueflow/models/create_batch_jobs_response.py +90 -0
  20. queueflow/models/create_cron_request.py +111 -0
  21. queueflow/models/create_cron_response.py +87 -0
  22. queueflow/models/create_job_request.py +108 -0
  23. queueflow/models/create_job_response.py +87 -0
  24. queueflow/models/create_workflow_request.py +101 -0
  25. queueflow/models/create_workflow_response.py +87 -0
  26. queueflow/models/cron_schedule.py +134 -0
  27. queueflow/models/dead_letter.py +136 -0
  28. queueflow/models/error_body.py +90 -0
  29. queueflow/models/fail_job_request.py +91 -0
  30. queueflow/models/health_status.py +92 -0
  31. queueflow/models/heartbeat_request.py +90 -0
  32. queueflow/models/heartbeat_response.py +88 -0
  33. queueflow/models/job.py +172 -0
  34. queueflow/models/job_config.py +106 -0
  35. queueflow/models/job_config_request.py +143 -0
  36. queueflow/models/job_status.py +41 -0
  37. queueflow/models/lease_jobs_request.py +107 -0
  38. queueflow/models/lease_jobs_response.py +95 -0
  39. queueflow/models/leased_job.py +93 -0
  40. queueflow/models/list_crons_response.py +115 -0
  41. queueflow/models/list_dead_letters_response.py +115 -0
  42. queueflow/models/list_jobs_response.py +115 -0
  43. queueflow/models/list_workflows_response.py +115 -0
  44. queueflow/models/on_failure.py +38 -0
  45. queueflow/models/on_success.py +36 -0
  46. queueflow/models/ready_status.py +87 -0
  47. queueflow/models/replay_dead_letter_response.py +87 -0
  48. queueflow/models/stats_snapshot.py +102 -0
  49. queueflow/models/step_status.py +41 -0
  50. queueflow/models/tasks_response.py +87 -0
  51. queueflow/models/workflow.py +130 -0
  52. queueflow/models/workflow_diagram_response.py +89 -0
  53. queueflow/models/workflow_status.py +41 -0
  54. queueflow/models/workflow_step.py +112 -0
  55. queueflow/models/workflow_step_state.py +97 -0
  56. queueflow/models/workflow_step_states_response.py +95 -0
  57. queueflow/py.typed +0 -0
  58. queueflow/rest.py +257 -0
  59. queueflow-0.1.0.dist-info/METADATA +26 -0
  60. queueflow-0.1.0.dist-info/RECORD +62 -0
  61. queueflow-0.1.0.dist-info/WHEEL +5 -0
  62. queueflow-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1229 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ QueueFlow API
5
+
6
+ REST API for QueueFlow, a PostgreSQL-native distributed job queue and workflow engine.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from pydantic import Field, StrictStr
20
+ from typing_extensions import Annotated
21
+ from queueflow.models.complete_job_request import CompleteJobRequest
22
+ from queueflow.models.fail_job_request import FailJobRequest
23
+ from queueflow.models.heartbeat_request import HeartbeatRequest
24
+ from queueflow.models.heartbeat_response import HeartbeatResponse
25
+ from queueflow.models.lease_jobs_request import LeaseJobsRequest
26
+ from queueflow.models.lease_jobs_response import LeaseJobsResponse
27
+
28
+ from queueflow.api_client import ApiClient, RequestSerialized
29
+ from queueflow.api_response import ApiResponse
30
+ from queueflow.rest import RESTResponseType
31
+
32
+
33
+ class WorkerApi:
34
+ """NOTE: This class is auto generated by OpenAPI Generator
35
+ Ref: https://openapi-generator.tech
36
+
37
+ Do not edit the class manually.
38
+ """
39
+
40
+ def __init__(self, api_client=None) -> None:
41
+ if api_client is None:
42
+ api_client = ApiClient.get_default()
43
+ self.api_client = api_client
44
+
45
+
46
+ @validate_call
47
+ def complete_job(
48
+ self,
49
+ id: Annotated[StrictStr, Field(description="Job id")],
50
+ complete_job_request: CompleteJobRequest,
51
+ _request_timeout: Union[
52
+ None,
53
+ Annotated[StrictFloat, Field(gt=0)],
54
+ Tuple[
55
+ Annotated[StrictFloat, Field(gt=0)],
56
+ Annotated[StrictFloat, Field(gt=0)]
57
+ ]
58
+ ] = None,
59
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
60
+ _content_type: Optional[StrictStr] = None,
61
+ _headers: Optional[Dict[StrictStr, Any]] = None,
62
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
63
+ ) -> None:
64
+ """complete_job
65
+
66
+
67
+ :param id: Job id (required)
68
+ :type id: str
69
+ :param complete_job_request: (required)
70
+ :type complete_job_request: CompleteJobRequest
71
+ :param _request_timeout: timeout setting for this request. If one
72
+ number provided, it will be total request
73
+ timeout. It can also be a pair (tuple) of
74
+ (connection, read) timeouts.
75
+ :type _request_timeout: int, tuple(int, int), optional
76
+ :param _request_auth: set to override the auth_settings for an a single
77
+ request; this effectively ignores the
78
+ authentication in the spec for a single request.
79
+ :type _request_auth: dict, optional
80
+ :param _content_type: force content-type for the request.
81
+ :type _content_type: str, Optional
82
+ :param _headers: set to override the headers for a single
83
+ request; this effectively ignores the headers
84
+ in the spec for a single request.
85
+ :type _headers: dict, optional
86
+ :param _host_index: set to override the host_index for a single
87
+ request; this effectively ignores the host_index
88
+ in the spec for a single request.
89
+ :type _host_index: int, optional
90
+ :return: Returns the result object.
91
+ """ # noqa: E501
92
+
93
+ _param = self._complete_job_serialize(
94
+ id=id,
95
+ complete_job_request=complete_job_request,
96
+ _request_auth=_request_auth,
97
+ _content_type=_content_type,
98
+ _headers=_headers,
99
+ _host_index=_host_index
100
+ )
101
+
102
+ _response_types_map: Dict[str, Optional[str]] = {
103
+ '204': None,
104
+ '401': "ErrorBody",
105
+ '403': "ErrorBody",
106
+ '404': "ErrorBody",
107
+ '409': "ErrorBody",
108
+ }
109
+ response_data = self.api_client.call_api(
110
+ *_param,
111
+ _request_timeout=_request_timeout
112
+ )
113
+ response_data.read()
114
+ return self.api_client.response_deserialize(
115
+ response_data=response_data,
116
+ response_types_map=_response_types_map,
117
+ ).data
118
+
119
+
120
+ @validate_call
121
+ def complete_job_with_http_info(
122
+ self,
123
+ id: Annotated[StrictStr, Field(description="Job id")],
124
+ complete_job_request: CompleteJobRequest,
125
+ _request_timeout: Union[
126
+ None,
127
+ Annotated[StrictFloat, Field(gt=0)],
128
+ Tuple[
129
+ Annotated[StrictFloat, Field(gt=0)],
130
+ Annotated[StrictFloat, Field(gt=0)]
131
+ ]
132
+ ] = None,
133
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
134
+ _content_type: Optional[StrictStr] = None,
135
+ _headers: Optional[Dict[StrictStr, Any]] = None,
136
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
137
+ ) -> ApiResponse[None]:
138
+ """complete_job
139
+
140
+
141
+ :param id: Job id (required)
142
+ :type id: str
143
+ :param complete_job_request: (required)
144
+ :type complete_job_request: CompleteJobRequest
145
+ :param _request_timeout: timeout setting for this request. If one
146
+ number provided, it will be total request
147
+ timeout. It can also be a pair (tuple) of
148
+ (connection, read) timeouts.
149
+ :type _request_timeout: int, tuple(int, int), optional
150
+ :param _request_auth: set to override the auth_settings for an a single
151
+ request; this effectively ignores the
152
+ authentication in the spec for a single request.
153
+ :type _request_auth: dict, optional
154
+ :param _content_type: force content-type for the request.
155
+ :type _content_type: str, Optional
156
+ :param _headers: set to override the headers for a single
157
+ request; this effectively ignores the headers
158
+ in the spec for a single request.
159
+ :type _headers: dict, optional
160
+ :param _host_index: set to override the host_index for a single
161
+ request; this effectively ignores the host_index
162
+ in the spec for a single request.
163
+ :type _host_index: int, optional
164
+ :return: Returns the result object.
165
+ """ # noqa: E501
166
+
167
+ _param = self._complete_job_serialize(
168
+ id=id,
169
+ complete_job_request=complete_job_request,
170
+ _request_auth=_request_auth,
171
+ _content_type=_content_type,
172
+ _headers=_headers,
173
+ _host_index=_host_index
174
+ )
175
+
176
+ _response_types_map: Dict[str, Optional[str]] = {
177
+ '204': None,
178
+ '401': "ErrorBody",
179
+ '403': "ErrorBody",
180
+ '404': "ErrorBody",
181
+ '409': "ErrorBody",
182
+ }
183
+ response_data = self.api_client.call_api(
184
+ *_param,
185
+ _request_timeout=_request_timeout
186
+ )
187
+ response_data.read()
188
+ return self.api_client.response_deserialize(
189
+ response_data=response_data,
190
+ response_types_map=_response_types_map,
191
+ )
192
+
193
+
194
+ @validate_call
195
+ def complete_job_without_preload_content(
196
+ self,
197
+ id: Annotated[StrictStr, Field(description="Job id")],
198
+ complete_job_request: CompleteJobRequest,
199
+ _request_timeout: Union[
200
+ None,
201
+ Annotated[StrictFloat, Field(gt=0)],
202
+ Tuple[
203
+ Annotated[StrictFloat, Field(gt=0)],
204
+ Annotated[StrictFloat, Field(gt=0)]
205
+ ]
206
+ ] = None,
207
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
208
+ _content_type: Optional[StrictStr] = None,
209
+ _headers: Optional[Dict[StrictStr, Any]] = None,
210
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
211
+ ) -> RESTResponseType:
212
+ """complete_job
213
+
214
+
215
+ :param id: Job id (required)
216
+ :type id: str
217
+ :param complete_job_request: (required)
218
+ :type complete_job_request: CompleteJobRequest
219
+ :param _request_timeout: timeout setting for this request. If one
220
+ number provided, it will be total request
221
+ timeout. It can also be a pair (tuple) of
222
+ (connection, read) timeouts.
223
+ :type _request_timeout: int, tuple(int, int), optional
224
+ :param _request_auth: set to override the auth_settings for an a single
225
+ request; this effectively ignores the
226
+ authentication in the spec for a single request.
227
+ :type _request_auth: dict, optional
228
+ :param _content_type: force content-type for the request.
229
+ :type _content_type: str, Optional
230
+ :param _headers: set to override the headers for a single
231
+ request; this effectively ignores the headers
232
+ in the spec for a single request.
233
+ :type _headers: dict, optional
234
+ :param _host_index: set to override the host_index for a single
235
+ request; this effectively ignores the host_index
236
+ in the spec for a single request.
237
+ :type _host_index: int, optional
238
+ :return: Returns the result object.
239
+ """ # noqa: E501
240
+
241
+ _param = self._complete_job_serialize(
242
+ id=id,
243
+ complete_job_request=complete_job_request,
244
+ _request_auth=_request_auth,
245
+ _content_type=_content_type,
246
+ _headers=_headers,
247
+ _host_index=_host_index
248
+ )
249
+
250
+ _response_types_map: Dict[str, Optional[str]] = {
251
+ '204': None,
252
+ '401': "ErrorBody",
253
+ '403': "ErrorBody",
254
+ '404': "ErrorBody",
255
+ '409': "ErrorBody",
256
+ }
257
+ response_data = self.api_client.call_api(
258
+ *_param,
259
+ _request_timeout=_request_timeout
260
+ )
261
+ return response_data.response
262
+
263
+
264
+ def _complete_job_serialize(
265
+ self,
266
+ id,
267
+ complete_job_request,
268
+ _request_auth,
269
+ _content_type,
270
+ _headers,
271
+ _host_index,
272
+ ) -> RequestSerialized:
273
+
274
+ _host = None
275
+
276
+ _collection_formats: Dict[str, str] = {
277
+ }
278
+
279
+ _path_params: Dict[str, str] = {}
280
+ _query_params: List[Tuple[str, str]] = []
281
+ _header_params: Dict[str, Optional[str]] = _headers or {}
282
+ _form_params: List[Tuple[str, str]] = []
283
+ _files: Dict[
284
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
285
+ ] = {}
286
+ _body_params: Optional[bytes] = None
287
+
288
+ # process the path parameters
289
+ if id is not None:
290
+ _path_params['id'] = id
291
+ # process the query parameters
292
+ # process the header parameters
293
+ # process the form parameters
294
+ # process the body parameter
295
+ if complete_job_request is not None:
296
+ _body_params = complete_job_request
297
+
298
+
299
+ # set the HTTP header `Accept`
300
+ if 'Accept' not in _header_params:
301
+ _header_params['Accept'] = self.api_client.select_header_accept(
302
+ [
303
+ 'application/json'
304
+ ]
305
+ )
306
+
307
+ # set the HTTP header `Content-Type`
308
+ if _content_type:
309
+ _header_params['Content-Type'] = _content_type
310
+ else:
311
+ _default_content_type = (
312
+ self.api_client.select_header_content_type(
313
+ [
314
+ 'application/json'
315
+ ]
316
+ )
317
+ )
318
+ if _default_content_type is not None:
319
+ _header_params['Content-Type'] = _default_content_type
320
+
321
+ # authentication setting
322
+ _auth_settings: List[str] = [
323
+ 'bearerAuth'
324
+ ]
325
+
326
+ return self.api_client.param_serialize(
327
+ method='POST',
328
+ resource_path='/api/v1/jobs/{id}/complete',
329
+ path_params=_path_params,
330
+ query_params=_query_params,
331
+ header_params=_header_params,
332
+ body=_body_params,
333
+ post_params=_form_params,
334
+ files=_files,
335
+ auth_settings=_auth_settings,
336
+ collection_formats=_collection_formats,
337
+ _host=_host,
338
+ _request_auth=_request_auth
339
+ )
340
+
341
+
342
+
343
+
344
+ @validate_call
345
+ def fail_job(
346
+ self,
347
+ id: Annotated[StrictStr, Field(description="Job id")],
348
+ fail_job_request: FailJobRequest,
349
+ _request_timeout: Union[
350
+ None,
351
+ Annotated[StrictFloat, Field(gt=0)],
352
+ Tuple[
353
+ Annotated[StrictFloat, Field(gt=0)],
354
+ Annotated[StrictFloat, Field(gt=0)]
355
+ ]
356
+ ] = None,
357
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
358
+ _content_type: Optional[StrictStr] = None,
359
+ _headers: Optional[Dict[StrictStr, Any]] = None,
360
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
361
+ ) -> None:
362
+ """fail_job
363
+
364
+
365
+ :param id: Job id (required)
366
+ :type id: str
367
+ :param fail_job_request: (required)
368
+ :type fail_job_request: FailJobRequest
369
+ :param _request_timeout: timeout setting for this request. If one
370
+ number provided, it will be total request
371
+ timeout. It can also be a pair (tuple) of
372
+ (connection, read) timeouts.
373
+ :type _request_timeout: int, tuple(int, int), optional
374
+ :param _request_auth: set to override the auth_settings for an a single
375
+ request; this effectively ignores the
376
+ authentication in the spec for a single request.
377
+ :type _request_auth: dict, optional
378
+ :param _content_type: force content-type for the request.
379
+ :type _content_type: str, Optional
380
+ :param _headers: set to override the headers for a single
381
+ request; this effectively ignores the headers
382
+ in the spec for a single request.
383
+ :type _headers: dict, optional
384
+ :param _host_index: set to override the host_index for a single
385
+ request; this effectively ignores the host_index
386
+ in the spec for a single request.
387
+ :type _host_index: int, optional
388
+ :return: Returns the result object.
389
+ """ # noqa: E501
390
+
391
+ _param = self._fail_job_serialize(
392
+ id=id,
393
+ fail_job_request=fail_job_request,
394
+ _request_auth=_request_auth,
395
+ _content_type=_content_type,
396
+ _headers=_headers,
397
+ _host_index=_host_index
398
+ )
399
+
400
+ _response_types_map: Dict[str, Optional[str]] = {
401
+ '204': None,
402
+ '401': "ErrorBody",
403
+ '403': "ErrorBody",
404
+ '404': "ErrorBody",
405
+ '409': "ErrorBody",
406
+ }
407
+ response_data = self.api_client.call_api(
408
+ *_param,
409
+ _request_timeout=_request_timeout
410
+ )
411
+ response_data.read()
412
+ return self.api_client.response_deserialize(
413
+ response_data=response_data,
414
+ response_types_map=_response_types_map,
415
+ ).data
416
+
417
+
418
+ @validate_call
419
+ def fail_job_with_http_info(
420
+ self,
421
+ id: Annotated[StrictStr, Field(description="Job id")],
422
+ fail_job_request: FailJobRequest,
423
+ _request_timeout: Union[
424
+ None,
425
+ Annotated[StrictFloat, Field(gt=0)],
426
+ Tuple[
427
+ Annotated[StrictFloat, Field(gt=0)],
428
+ Annotated[StrictFloat, Field(gt=0)]
429
+ ]
430
+ ] = None,
431
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
432
+ _content_type: Optional[StrictStr] = None,
433
+ _headers: Optional[Dict[StrictStr, Any]] = None,
434
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
435
+ ) -> ApiResponse[None]:
436
+ """fail_job
437
+
438
+
439
+ :param id: Job id (required)
440
+ :type id: str
441
+ :param fail_job_request: (required)
442
+ :type fail_job_request: FailJobRequest
443
+ :param _request_timeout: timeout setting for this request. If one
444
+ number provided, it will be total request
445
+ timeout. It can also be a pair (tuple) of
446
+ (connection, read) timeouts.
447
+ :type _request_timeout: int, tuple(int, int), optional
448
+ :param _request_auth: set to override the auth_settings for an a single
449
+ request; this effectively ignores the
450
+ authentication in the spec for a single request.
451
+ :type _request_auth: dict, optional
452
+ :param _content_type: force content-type for the request.
453
+ :type _content_type: str, Optional
454
+ :param _headers: set to override the headers for a single
455
+ request; this effectively ignores the headers
456
+ in the spec for a single request.
457
+ :type _headers: dict, optional
458
+ :param _host_index: set to override the host_index for a single
459
+ request; this effectively ignores the host_index
460
+ in the spec for a single request.
461
+ :type _host_index: int, optional
462
+ :return: Returns the result object.
463
+ """ # noqa: E501
464
+
465
+ _param = self._fail_job_serialize(
466
+ id=id,
467
+ fail_job_request=fail_job_request,
468
+ _request_auth=_request_auth,
469
+ _content_type=_content_type,
470
+ _headers=_headers,
471
+ _host_index=_host_index
472
+ )
473
+
474
+ _response_types_map: Dict[str, Optional[str]] = {
475
+ '204': None,
476
+ '401': "ErrorBody",
477
+ '403': "ErrorBody",
478
+ '404': "ErrorBody",
479
+ '409': "ErrorBody",
480
+ }
481
+ response_data = self.api_client.call_api(
482
+ *_param,
483
+ _request_timeout=_request_timeout
484
+ )
485
+ response_data.read()
486
+ return self.api_client.response_deserialize(
487
+ response_data=response_data,
488
+ response_types_map=_response_types_map,
489
+ )
490
+
491
+
492
+ @validate_call
493
+ def fail_job_without_preload_content(
494
+ self,
495
+ id: Annotated[StrictStr, Field(description="Job id")],
496
+ fail_job_request: FailJobRequest,
497
+ _request_timeout: Union[
498
+ None,
499
+ Annotated[StrictFloat, Field(gt=0)],
500
+ Tuple[
501
+ Annotated[StrictFloat, Field(gt=0)],
502
+ Annotated[StrictFloat, Field(gt=0)]
503
+ ]
504
+ ] = None,
505
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
506
+ _content_type: Optional[StrictStr] = None,
507
+ _headers: Optional[Dict[StrictStr, Any]] = None,
508
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
509
+ ) -> RESTResponseType:
510
+ """fail_job
511
+
512
+
513
+ :param id: Job id (required)
514
+ :type id: str
515
+ :param fail_job_request: (required)
516
+ :type fail_job_request: FailJobRequest
517
+ :param _request_timeout: timeout setting for this request. If one
518
+ number provided, it will be total request
519
+ timeout. It can also be a pair (tuple) of
520
+ (connection, read) timeouts.
521
+ :type _request_timeout: int, tuple(int, int), optional
522
+ :param _request_auth: set to override the auth_settings for an a single
523
+ request; this effectively ignores the
524
+ authentication in the spec for a single request.
525
+ :type _request_auth: dict, optional
526
+ :param _content_type: force content-type for the request.
527
+ :type _content_type: str, Optional
528
+ :param _headers: set to override the headers for a single
529
+ request; this effectively ignores the headers
530
+ in the spec for a single request.
531
+ :type _headers: dict, optional
532
+ :param _host_index: set to override the host_index for a single
533
+ request; this effectively ignores the host_index
534
+ in the spec for a single request.
535
+ :type _host_index: int, optional
536
+ :return: Returns the result object.
537
+ """ # noqa: E501
538
+
539
+ _param = self._fail_job_serialize(
540
+ id=id,
541
+ fail_job_request=fail_job_request,
542
+ _request_auth=_request_auth,
543
+ _content_type=_content_type,
544
+ _headers=_headers,
545
+ _host_index=_host_index
546
+ )
547
+
548
+ _response_types_map: Dict[str, Optional[str]] = {
549
+ '204': None,
550
+ '401': "ErrorBody",
551
+ '403': "ErrorBody",
552
+ '404': "ErrorBody",
553
+ '409': "ErrorBody",
554
+ }
555
+ response_data = self.api_client.call_api(
556
+ *_param,
557
+ _request_timeout=_request_timeout
558
+ )
559
+ return response_data.response
560
+
561
+
562
+ def _fail_job_serialize(
563
+ self,
564
+ id,
565
+ fail_job_request,
566
+ _request_auth,
567
+ _content_type,
568
+ _headers,
569
+ _host_index,
570
+ ) -> RequestSerialized:
571
+
572
+ _host = None
573
+
574
+ _collection_formats: Dict[str, str] = {
575
+ }
576
+
577
+ _path_params: Dict[str, str] = {}
578
+ _query_params: List[Tuple[str, str]] = []
579
+ _header_params: Dict[str, Optional[str]] = _headers or {}
580
+ _form_params: List[Tuple[str, str]] = []
581
+ _files: Dict[
582
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
583
+ ] = {}
584
+ _body_params: Optional[bytes] = None
585
+
586
+ # process the path parameters
587
+ if id is not None:
588
+ _path_params['id'] = id
589
+ # process the query parameters
590
+ # process the header parameters
591
+ # process the form parameters
592
+ # process the body parameter
593
+ if fail_job_request is not None:
594
+ _body_params = fail_job_request
595
+
596
+
597
+ # set the HTTP header `Accept`
598
+ if 'Accept' not in _header_params:
599
+ _header_params['Accept'] = self.api_client.select_header_accept(
600
+ [
601
+ 'application/json'
602
+ ]
603
+ )
604
+
605
+ # set the HTTP header `Content-Type`
606
+ if _content_type:
607
+ _header_params['Content-Type'] = _content_type
608
+ else:
609
+ _default_content_type = (
610
+ self.api_client.select_header_content_type(
611
+ [
612
+ 'application/json'
613
+ ]
614
+ )
615
+ )
616
+ if _default_content_type is not None:
617
+ _header_params['Content-Type'] = _default_content_type
618
+
619
+ # authentication setting
620
+ _auth_settings: List[str] = [
621
+ 'bearerAuth'
622
+ ]
623
+
624
+ return self.api_client.param_serialize(
625
+ method='POST',
626
+ resource_path='/api/v1/jobs/{id}/fail',
627
+ path_params=_path_params,
628
+ query_params=_query_params,
629
+ header_params=_header_params,
630
+ body=_body_params,
631
+ post_params=_form_params,
632
+ files=_files,
633
+ auth_settings=_auth_settings,
634
+ collection_formats=_collection_formats,
635
+ _host=_host,
636
+ _request_auth=_request_auth
637
+ )
638
+
639
+
640
+
641
+
642
+ @validate_call
643
+ def heartbeat_job(
644
+ self,
645
+ id: Annotated[StrictStr, Field(description="Job id")],
646
+ heartbeat_request: HeartbeatRequest,
647
+ _request_timeout: Union[
648
+ None,
649
+ Annotated[StrictFloat, Field(gt=0)],
650
+ Tuple[
651
+ Annotated[StrictFloat, Field(gt=0)],
652
+ Annotated[StrictFloat, Field(gt=0)]
653
+ ]
654
+ ] = None,
655
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
656
+ _content_type: Optional[StrictStr] = None,
657
+ _headers: Optional[Dict[StrictStr, Any]] = None,
658
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
659
+ ) -> HeartbeatResponse:
660
+ """heartbeat_job
661
+
662
+
663
+ :param id: Job id (required)
664
+ :type id: str
665
+ :param heartbeat_request: (required)
666
+ :type heartbeat_request: HeartbeatRequest
667
+ :param _request_timeout: timeout setting for this request. If one
668
+ number provided, it will be total request
669
+ timeout. It can also be a pair (tuple) of
670
+ (connection, read) timeouts.
671
+ :type _request_timeout: int, tuple(int, int), optional
672
+ :param _request_auth: set to override the auth_settings for an a single
673
+ request; this effectively ignores the
674
+ authentication in the spec for a single request.
675
+ :type _request_auth: dict, optional
676
+ :param _content_type: force content-type for the request.
677
+ :type _content_type: str, Optional
678
+ :param _headers: set to override the headers for a single
679
+ request; this effectively ignores the headers
680
+ in the spec for a single request.
681
+ :type _headers: dict, optional
682
+ :param _host_index: set to override the host_index for a single
683
+ request; this effectively ignores the host_index
684
+ in the spec for a single request.
685
+ :type _host_index: int, optional
686
+ :return: Returns the result object.
687
+ """ # noqa: E501
688
+
689
+ _param = self._heartbeat_job_serialize(
690
+ id=id,
691
+ heartbeat_request=heartbeat_request,
692
+ _request_auth=_request_auth,
693
+ _content_type=_content_type,
694
+ _headers=_headers,
695
+ _host_index=_host_index
696
+ )
697
+
698
+ _response_types_map: Dict[str, Optional[str]] = {
699
+ '200': "HeartbeatResponse",
700
+ '401': "ErrorBody",
701
+ '403': "ErrorBody",
702
+ '404': "ErrorBody",
703
+ '409': "ErrorBody",
704
+ }
705
+ response_data = self.api_client.call_api(
706
+ *_param,
707
+ _request_timeout=_request_timeout
708
+ )
709
+ response_data.read()
710
+ return self.api_client.response_deserialize(
711
+ response_data=response_data,
712
+ response_types_map=_response_types_map,
713
+ ).data
714
+
715
+
716
+ @validate_call
717
+ def heartbeat_job_with_http_info(
718
+ self,
719
+ id: Annotated[StrictStr, Field(description="Job id")],
720
+ heartbeat_request: HeartbeatRequest,
721
+ _request_timeout: Union[
722
+ None,
723
+ Annotated[StrictFloat, Field(gt=0)],
724
+ Tuple[
725
+ Annotated[StrictFloat, Field(gt=0)],
726
+ Annotated[StrictFloat, Field(gt=0)]
727
+ ]
728
+ ] = None,
729
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
730
+ _content_type: Optional[StrictStr] = None,
731
+ _headers: Optional[Dict[StrictStr, Any]] = None,
732
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
733
+ ) -> ApiResponse[HeartbeatResponse]:
734
+ """heartbeat_job
735
+
736
+
737
+ :param id: Job id (required)
738
+ :type id: str
739
+ :param heartbeat_request: (required)
740
+ :type heartbeat_request: HeartbeatRequest
741
+ :param _request_timeout: timeout setting for this request. If one
742
+ number provided, it will be total request
743
+ timeout. It can also be a pair (tuple) of
744
+ (connection, read) timeouts.
745
+ :type _request_timeout: int, tuple(int, int), optional
746
+ :param _request_auth: set to override the auth_settings for an a single
747
+ request; this effectively ignores the
748
+ authentication in the spec for a single request.
749
+ :type _request_auth: dict, optional
750
+ :param _content_type: force content-type for the request.
751
+ :type _content_type: str, Optional
752
+ :param _headers: set to override the headers for a single
753
+ request; this effectively ignores the headers
754
+ in the spec for a single request.
755
+ :type _headers: dict, optional
756
+ :param _host_index: set to override the host_index for a single
757
+ request; this effectively ignores the host_index
758
+ in the spec for a single request.
759
+ :type _host_index: int, optional
760
+ :return: Returns the result object.
761
+ """ # noqa: E501
762
+
763
+ _param = self._heartbeat_job_serialize(
764
+ id=id,
765
+ heartbeat_request=heartbeat_request,
766
+ _request_auth=_request_auth,
767
+ _content_type=_content_type,
768
+ _headers=_headers,
769
+ _host_index=_host_index
770
+ )
771
+
772
+ _response_types_map: Dict[str, Optional[str]] = {
773
+ '200': "HeartbeatResponse",
774
+ '401': "ErrorBody",
775
+ '403': "ErrorBody",
776
+ '404': "ErrorBody",
777
+ '409': "ErrorBody",
778
+ }
779
+ response_data = self.api_client.call_api(
780
+ *_param,
781
+ _request_timeout=_request_timeout
782
+ )
783
+ response_data.read()
784
+ return self.api_client.response_deserialize(
785
+ response_data=response_data,
786
+ response_types_map=_response_types_map,
787
+ )
788
+
789
+
790
+ @validate_call
791
+ def heartbeat_job_without_preload_content(
792
+ self,
793
+ id: Annotated[StrictStr, Field(description="Job id")],
794
+ heartbeat_request: HeartbeatRequest,
795
+ _request_timeout: Union[
796
+ None,
797
+ Annotated[StrictFloat, Field(gt=0)],
798
+ Tuple[
799
+ Annotated[StrictFloat, Field(gt=0)],
800
+ Annotated[StrictFloat, Field(gt=0)]
801
+ ]
802
+ ] = None,
803
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
804
+ _content_type: Optional[StrictStr] = None,
805
+ _headers: Optional[Dict[StrictStr, Any]] = None,
806
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
807
+ ) -> RESTResponseType:
808
+ """heartbeat_job
809
+
810
+
811
+ :param id: Job id (required)
812
+ :type id: str
813
+ :param heartbeat_request: (required)
814
+ :type heartbeat_request: HeartbeatRequest
815
+ :param _request_timeout: timeout setting for this request. If one
816
+ number provided, it will be total request
817
+ timeout. It can also be a pair (tuple) of
818
+ (connection, read) timeouts.
819
+ :type _request_timeout: int, tuple(int, int), optional
820
+ :param _request_auth: set to override the auth_settings for an a single
821
+ request; this effectively ignores the
822
+ authentication in the spec for a single request.
823
+ :type _request_auth: dict, optional
824
+ :param _content_type: force content-type for the request.
825
+ :type _content_type: str, Optional
826
+ :param _headers: set to override the headers for a single
827
+ request; this effectively ignores the headers
828
+ in the spec for a single request.
829
+ :type _headers: dict, optional
830
+ :param _host_index: set to override the host_index for a single
831
+ request; this effectively ignores the host_index
832
+ in the spec for a single request.
833
+ :type _host_index: int, optional
834
+ :return: Returns the result object.
835
+ """ # noqa: E501
836
+
837
+ _param = self._heartbeat_job_serialize(
838
+ id=id,
839
+ heartbeat_request=heartbeat_request,
840
+ _request_auth=_request_auth,
841
+ _content_type=_content_type,
842
+ _headers=_headers,
843
+ _host_index=_host_index
844
+ )
845
+
846
+ _response_types_map: Dict[str, Optional[str]] = {
847
+ '200': "HeartbeatResponse",
848
+ '401': "ErrorBody",
849
+ '403': "ErrorBody",
850
+ '404': "ErrorBody",
851
+ '409': "ErrorBody",
852
+ }
853
+ response_data = self.api_client.call_api(
854
+ *_param,
855
+ _request_timeout=_request_timeout
856
+ )
857
+ return response_data.response
858
+
859
+
860
+ def _heartbeat_job_serialize(
861
+ self,
862
+ id,
863
+ heartbeat_request,
864
+ _request_auth,
865
+ _content_type,
866
+ _headers,
867
+ _host_index,
868
+ ) -> RequestSerialized:
869
+
870
+ _host = None
871
+
872
+ _collection_formats: Dict[str, str] = {
873
+ }
874
+
875
+ _path_params: Dict[str, str] = {}
876
+ _query_params: List[Tuple[str, str]] = []
877
+ _header_params: Dict[str, Optional[str]] = _headers or {}
878
+ _form_params: List[Tuple[str, str]] = []
879
+ _files: Dict[
880
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
881
+ ] = {}
882
+ _body_params: Optional[bytes] = None
883
+
884
+ # process the path parameters
885
+ if id is not None:
886
+ _path_params['id'] = id
887
+ # process the query parameters
888
+ # process the header parameters
889
+ # process the form parameters
890
+ # process the body parameter
891
+ if heartbeat_request is not None:
892
+ _body_params = heartbeat_request
893
+
894
+
895
+ # set the HTTP header `Accept`
896
+ if 'Accept' not in _header_params:
897
+ _header_params['Accept'] = self.api_client.select_header_accept(
898
+ [
899
+ 'application/json'
900
+ ]
901
+ )
902
+
903
+ # set the HTTP header `Content-Type`
904
+ if _content_type:
905
+ _header_params['Content-Type'] = _content_type
906
+ else:
907
+ _default_content_type = (
908
+ self.api_client.select_header_content_type(
909
+ [
910
+ 'application/json'
911
+ ]
912
+ )
913
+ )
914
+ if _default_content_type is not None:
915
+ _header_params['Content-Type'] = _default_content_type
916
+
917
+ # authentication setting
918
+ _auth_settings: List[str] = [
919
+ 'bearerAuth'
920
+ ]
921
+
922
+ return self.api_client.param_serialize(
923
+ method='POST',
924
+ resource_path='/api/v1/jobs/{id}/heartbeat',
925
+ path_params=_path_params,
926
+ query_params=_query_params,
927
+ header_params=_header_params,
928
+ body=_body_params,
929
+ post_params=_form_params,
930
+ files=_files,
931
+ auth_settings=_auth_settings,
932
+ collection_formats=_collection_formats,
933
+ _host=_host,
934
+ _request_auth=_request_auth
935
+ )
936
+
937
+
938
+
939
+
940
+ @validate_call
941
+ def lease_jobs(
942
+ self,
943
+ queue: Annotated[StrictStr, Field(description="Queue to lease from")],
944
+ lease_jobs_request: LeaseJobsRequest,
945
+ _request_timeout: Union[
946
+ None,
947
+ Annotated[StrictFloat, Field(gt=0)],
948
+ Tuple[
949
+ Annotated[StrictFloat, Field(gt=0)],
950
+ Annotated[StrictFloat, Field(gt=0)]
951
+ ]
952
+ ] = None,
953
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
954
+ _content_type: Optional[StrictStr] = None,
955
+ _headers: Optional[Dict[StrictStr, Any]] = None,
956
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
957
+ ) -> LeaseJobsResponse:
958
+ """lease_jobs
959
+
960
+
961
+ :param queue: Queue to lease from (required)
962
+ :type queue: str
963
+ :param lease_jobs_request: (required)
964
+ :type lease_jobs_request: LeaseJobsRequest
965
+ :param _request_timeout: timeout setting for this request. If one
966
+ number provided, it will be total request
967
+ timeout. It can also be a pair (tuple) of
968
+ (connection, read) timeouts.
969
+ :type _request_timeout: int, tuple(int, int), optional
970
+ :param _request_auth: set to override the auth_settings for an a single
971
+ request; this effectively ignores the
972
+ authentication in the spec for a single request.
973
+ :type _request_auth: dict, optional
974
+ :param _content_type: force content-type for the request.
975
+ :type _content_type: str, Optional
976
+ :param _headers: set to override the headers for a single
977
+ request; this effectively ignores the headers
978
+ in the spec for a single request.
979
+ :type _headers: dict, optional
980
+ :param _host_index: set to override the host_index for a single
981
+ request; this effectively ignores the host_index
982
+ in the spec for a single request.
983
+ :type _host_index: int, optional
984
+ :return: Returns the result object.
985
+ """ # noqa: E501
986
+
987
+ _param = self._lease_jobs_serialize(
988
+ queue=queue,
989
+ lease_jobs_request=lease_jobs_request,
990
+ _request_auth=_request_auth,
991
+ _content_type=_content_type,
992
+ _headers=_headers,
993
+ _host_index=_host_index
994
+ )
995
+
996
+ _response_types_map: Dict[str, Optional[str]] = {
997
+ '200': "LeaseJobsResponse",
998
+ '401': "ErrorBody",
999
+ '403': "ErrorBody",
1000
+ }
1001
+ response_data = self.api_client.call_api(
1002
+ *_param,
1003
+ _request_timeout=_request_timeout
1004
+ )
1005
+ response_data.read()
1006
+ return self.api_client.response_deserialize(
1007
+ response_data=response_data,
1008
+ response_types_map=_response_types_map,
1009
+ ).data
1010
+
1011
+
1012
+ @validate_call
1013
+ def lease_jobs_with_http_info(
1014
+ self,
1015
+ queue: Annotated[StrictStr, Field(description="Queue to lease from")],
1016
+ lease_jobs_request: LeaseJobsRequest,
1017
+ _request_timeout: Union[
1018
+ None,
1019
+ Annotated[StrictFloat, Field(gt=0)],
1020
+ Tuple[
1021
+ Annotated[StrictFloat, Field(gt=0)],
1022
+ Annotated[StrictFloat, Field(gt=0)]
1023
+ ]
1024
+ ] = None,
1025
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1026
+ _content_type: Optional[StrictStr] = None,
1027
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1028
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1029
+ ) -> ApiResponse[LeaseJobsResponse]:
1030
+ """lease_jobs
1031
+
1032
+
1033
+ :param queue: Queue to lease from (required)
1034
+ :type queue: str
1035
+ :param lease_jobs_request: (required)
1036
+ :type lease_jobs_request: LeaseJobsRequest
1037
+ :param _request_timeout: timeout setting for this request. If one
1038
+ number provided, it will be total request
1039
+ timeout. It can also be a pair (tuple) of
1040
+ (connection, read) timeouts.
1041
+ :type _request_timeout: int, tuple(int, int), optional
1042
+ :param _request_auth: set to override the auth_settings for an a single
1043
+ request; this effectively ignores the
1044
+ authentication in the spec for a single request.
1045
+ :type _request_auth: dict, optional
1046
+ :param _content_type: force content-type for the request.
1047
+ :type _content_type: str, Optional
1048
+ :param _headers: set to override the headers for a single
1049
+ request; this effectively ignores the headers
1050
+ in the spec for a single request.
1051
+ :type _headers: dict, optional
1052
+ :param _host_index: set to override the host_index for a single
1053
+ request; this effectively ignores the host_index
1054
+ in the spec for a single request.
1055
+ :type _host_index: int, optional
1056
+ :return: Returns the result object.
1057
+ """ # noqa: E501
1058
+
1059
+ _param = self._lease_jobs_serialize(
1060
+ queue=queue,
1061
+ lease_jobs_request=lease_jobs_request,
1062
+ _request_auth=_request_auth,
1063
+ _content_type=_content_type,
1064
+ _headers=_headers,
1065
+ _host_index=_host_index
1066
+ )
1067
+
1068
+ _response_types_map: Dict[str, Optional[str]] = {
1069
+ '200': "LeaseJobsResponse",
1070
+ '401': "ErrorBody",
1071
+ '403': "ErrorBody",
1072
+ }
1073
+ response_data = self.api_client.call_api(
1074
+ *_param,
1075
+ _request_timeout=_request_timeout
1076
+ )
1077
+ response_data.read()
1078
+ return self.api_client.response_deserialize(
1079
+ response_data=response_data,
1080
+ response_types_map=_response_types_map,
1081
+ )
1082
+
1083
+
1084
+ @validate_call
1085
+ def lease_jobs_without_preload_content(
1086
+ self,
1087
+ queue: Annotated[StrictStr, Field(description="Queue to lease from")],
1088
+ lease_jobs_request: LeaseJobsRequest,
1089
+ _request_timeout: Union[
1090
+ None,
1091
+ Annotated[StrictFloat, Field(gt=0)],
1092
+ Tuple[
1093
+ Annotated[StrictFloat, Field(gt=0)],
1094
+ Annotated[StrictFloat, Field(gt=0)]
1095
+ ]
1096
+ ] = None,
1097
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1098
+ _content_type: Optional[StrictStr] = None,
1099
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1100
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1101
+ ) -> RESTResponseType:
1102
+ """lease_jobs
1103
+
1104
+
1105
+ :param queue: Queue to lease from (required)
1106
+ :type queue: str
1107
+ :param lease_jobs_request: (required)
1108
+ :type lease_jobs_request: LeaseJobsRequest
1109
+ :param _request_timeout: timeout setting for this request. If one
1110
+ number provided, it will be total request
1111
+ timeout. It can also be a pair (tuple) of
1112
+ (connection, read) timeouts.
1113
+ :type _request_timeout: int, tuple(int, int), optional
1114
+ :param _request_auth: set to override the auth_settings for an a single
1115
+ request; this effectively ignores the
1116
+ authentication in the spec for a single request.
1117
+ :type _request_auth: dict, optional
1118
+ :param _content_type: force content-type for the request.
1119
+ :type _content_type: str, Optional
1120
+ :param _headers: set to override the headers for a single
1121
+ request; this effectively ignores the headers
1122
+ in the spec for a single request.
1123
+ :type _headers: dict, optional
1124
+ :param _host_index: set to override the host_index for a single
1125
+ request; this effectively ignores the host_index
1126
+ in the spec for a single request.
1127
+ :type _host_index: int, optional
1128
+ :return: Returns the result object.
1129
+ """ # noqa: E501
1130
+
1131
+ _param = self._lease_jobs_serialize(
1132
+ queue=queue,
1133
+ lease_jobs_request=lease_jobs_request,
1134
+ _request_auth=_request_auth,
1135
+ _content_type=_content_type,
1136
+ _headers=_headers,
1137
+ _host_index=_host_index
1138
+ )
1139
+
1140
+ _response_types_map: Dict[str, Optional[str]] = {
1141
+ '200': "LeaseJobsResponse",
1142
+ '401': "ErrorBody",
1143
+ '403': "ErrorBody",
1144
+ }
1145
+ response_data = self.api_client.call_api(
1146
+ *_param,
1147
+ _request_timeout=_request_timeout
1148
+ )
1149
+ return response_data.response
1150
+
1151
+
1152
+ def _lease_jobs_serialize(
1153
+ self,
1154
+ queue,
1155
+ lease_jobs_request,
1156
+ _request_auth,
1157
+ _content_type,
1158
+ _headers,
1159
+ _host_index,
1160
+ ) -> RequestSerialized:
1161
+
1162
+ _host = None
1163
+
1164
+ _collection_formats: Dict[str, str] = {
1165
+ }
1166
+
1167
+ _path_params: Dict[str, str] = {}
1168
+ _query_params: List[Tuple[str, str]] = []
1169
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1170
+ _form_params: List[Tuple[str, str]] = []
1171
+ _files: Dict[
1172
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1173
+ ] = {}
1174
+ _body_params: Optional[bytes] = None
1175
+
1176
+ # process the path parameters
1177
+ if queue is not None:
1178
+ _path_params['queue'] = queue
1179
+ # process the query parameters
1180
+ # process the header parameters
1181
+ # process the form parameters
1182
+ # process the body parameter
1183
+ if lease_jobs_request is not None:
1184
+ _body_params = lease_jobs_request
1185
+
1186
+
1187
+ # set the HTTP header `Accept`
1188
+ if 'Accept' not in _header_params:
1189
+ _header_params['Accept'] = self.api_client.select_header_accept(
1190
+ [
1191
+ 'application/json'
1192
+ ]
1193
+ )
1194
+
1195
+ # set the HTTP header `Content-Type`
1196
+ if _content_type:
1197
+ _header_params['Content-Type'] = _content_type
1198
+ else:
1199
+ _default_content_type = (
1200
+ self.api_client.select_header_content_type(
1201
+ [
1202
+ 'application/json'
1203
+ ]
1204
+ )
1205
+ )
1206
+ if _default_content_type is not None:
1207
+ _header_params['Content-Type'] = _default_content_type
1208
+
1209
+ # authentication setting
1210
+ _auth_settings: List[str] = [
1211
+ 'bearerAuth'
1212
+ ]
1213
+
1214
+ return self.api_client.param_serialize(
1215
+ method='POST',
1216
+ resource_path='/api/v1/queues/{queue}/lease',
1217
+ path_params=_path_params,
1218
+ query_params=_query_params,
1219
+ header_params=_header_params,
1220
+ body=_body_params,
1221
+ post_params=_form_params,
1222
+ files=_files,
1223
+ auth_settings=_auth_settings,
1224
+ collection_formats=_collection_formats,
1225
+ _host=_host,
1226
+ _request_auth=_request_auth
1227
+ )
1228
+
1229
+