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
queueflow/rest.py ADDED
@@ -0,0 +1,257 @@
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
+
15
+ import io
16
+ import json
17
+ import re
18
+ import ssl
19
+
20
+ import urllib3
21
+
22
+ from queueflow.exceptions import ApiException, ApiValueError
23
+
24
+ SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
25
+ RESTResponseType = urllib3.HTTPResponse
26
+
27
+
28
+ def is_socks_proxy_url(url):
29
+ if url is None:
30
+ return False
31
+ split_section = url.split("://")
32
+ if len(split_section) < 2:
33
+ return False
34
+ else:
35
+ return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
36
+
37
+
38
+ class RESTResponse(io.IOBase):
39
+
40
+ def __init__(self, resp) -> None:
41
+ self.response = resp
42
+ self.status = resp.status
43
+ self.reason = resp.reason
44
+ self.data = None
45
+
46
+ def read(self):
47
+ if self.data is None:
48
+ self.data = self.response.data
49
+ return self.data
50
+
51
+ def getheaders(self):
52
+ """Returns a dictionary of the response headers."""
53
+ return self.response.headers
54
+
55
+ def getheader(self, name, default=None):
56
+ """Returns a given response header."""
57
+ return self.response.headers.get(name, default)
58
+
59
+
60
+ class RESTClientObject:
61
+
62
+ def __init__(self, configuration) -> None:
63
+ # urllib3.PoolManager will pass all kw parameters to connectionpool
64
+ # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
65
+ # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
66
+ # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
67
+
68
+ # cert_reqs
69
+ if configuration.verify_ssl:
70
+ cert_reqs = ssl.CERT_REQUIRED
71
+ else:
72
+ cert_reqs = ssl.CERT_NONE
73
+
74
+ pool_args = {
75
+ "cert_reqs": cert_reqs,
76
+ "ca_certs": configuration.ssl_ca_cert,
77
+ "cert_file": configuration.cert_file,
78
+ "key_file": configuration.key_file,
79
+ }
80
+ if configuration.assert_hostname is not None:
81
+ pool_args['assert_hostname'] = (
82
+ configuration.assert_hostname
83
+ )
84
+
85
+ if configuration.retries is not None:
86
+ pool_args['retries'] = configuration.retries
87
+
88
+ if configuration.tls_server_name:
89
+ pool_args['server_hostname'] = configuration.tls_server_name
90
+
91
+
92
+ if configuration.socket_options is not None:
93
+ pool_args['socket_options'] = configuration.socket_options
94
+
95
+ if configuration.connection_pool_maxsize is not None:
96
+ pool_args['maxsize'] = configuration.connection_pool_maxsize
97
+
98
+ # https pool manager
99
+ self.pool_manager: urllib3.PoolManager
100
+
101
+ if configuration.proxy:
102
+ if is_socks_proxy_url(configuration.proxy):
103
+ from urllib3.contrib.socks import SOCKSProxyManager
104
+ pool_args["proxy_url"] = configuration.proxy
105
+ pool_args["headers"] = configuration.proxy_headers
106
+ self.pool_manager = SOCKSProxyManager(**pool_args)
107
+ else:
108
+ pool_args["proxy_url"] = configuration.proxy
109
+ pool_args["proxy_headers"] = configuration.proxy_headers
110
+ self.pool_manager = urllib3.ProxyManager(**pool_args)
111
+ else:
112
+ self.pool_manager = urllib3.PoolManager(**pool_args)
113
+
114
+ def request(
115
+ self,
116
+ method,
117
+ url,
118
+ headers=None,
119
+ body=None,
120
+ post_params=None,
121
+ _request_timeout=None
122
+ ):
123
+ """Perform requests.
124
+
125
+ :param method: http request method
126
+ :param url: http request url
127
+ :param headers: http request headers
128
+ :param body: request json body, for `application/json`
129
+ :param post_params: request post parameters,
130
+ `application/x-www-form-urlencoded`
131
+ and `multipart/form-data`
132
+ :param _request_timeout: timeout setting for this request. If one
133
+ number provided, it will be total request
134
+ timeout. It can also be a pair (tuple) of
135
+ (connection, read) timeouts.
136
+ """
137
+ method = method.upper()
138
+ assert method in [
139
+ 'GET',
140
+ 'HEAD',
141
+ 'DELETE',
142
+ 'POST',
143
+ 'PUT',
144
+ 'PATCH',
145
+ 'OPTIONS'
146
+ ]
147
+
148
+ if post_params and body:
149
+ raise ApiValueError(
150
+ "body parameter cannot be used with post_params parameter."
151
+ )
152
+
153
+ post_params = post_params or {}
154
+ headers = headers or {}
155
+
156
+ timeout = None
157
+ if _request_timeout:
158
+ if isinstance(_request_timeout, (int, float)):
159
+ timeout = urllib3.Timeout(total=_request_timeout)
160
+ elif (
161
+ isinstance(_request_timeout, tuple)
162
+ and len(_request_timeout) == 2
163
+ ):
164
+ timeout = urllib3.Timeout(
165
+ connect=_request_timeout[0],
166
+ read=_request_timeout[1]
167
+ )
168
+
169
+ try:
170
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
171
+ if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
172
+
173
+ # no content type provided or payload is json
174
+ content_type = headers.get('Content-Type')
175
+ if (
176
+ not content_type
177
+ or re.search('json', content_type, re.IGNORECASE)
178
+ ):
179
+ request_body = None
180
+ if body is not None:
181
+ request_body = json.dumps(body)
182
+ r = self.pool_manager.request(
183
+ method,
184
+ url,
185
+ body=request_body,
186
+ timeout=timeout,
187
+ headers=headers,
188
+ preload_content=False
189
+ )
190
+ elif content_type == 'application/x-www-form-urlencoded':
191
+ r = self.pool_manager.request(
192
+ method,
193
+ url,
194
+ fields=post_params,
195
+ encode_multipart=False,
196
+ timeout=timeout,
197
+ headers=headers,
198
+ preload_content=False
199
+ )
200
+ elif content_type == 'multipart/form-data':
201
+ # must del headers['Content-Type'], or the correct
202
+ # Content-Type which generated by urllib3 will be
203
+ # overwritten.
204
+ del headers['Content-Type']
205
+ # Ensures that dict objects are serialized
206
+ post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
207
+ r = self.pool_manager.request(
208
+ method,
209
+ url,
210
+ fields=post_params,
211
+ encode_multipart=True,
212
+ timeout=timeout,
213
+ headers=headers,
214
+ preload_content=False
215
+ )
216
+ # Pass a `string` parameter directly in the body to support
217
+ # other content types than JSON when `body` argument is
218
+ # provided in serialized form.
219
+ elif isinstance(body, str) or isinstance(body, bytes):
220
+ r = self.pool_manager.request(
221
+ method,
222
+ url,
223
+ body=body,
224
+ timeout=timeout,
225
+ headers=headers,
226
+ preload_content=False
227
+ )
228
+ elif headers['Content-Type'].startswith('text/') and isinstance(body, bool):
229
+ request_body = "true" if body else "false"
230
+ r = self.pool_manager.request(
231
+ method,
232
+ url,
233
+ body=request_body,
234
+ preload_content=False,
235
+ timeout=timeout,
236
+ headers=headers)
237
+ else:
238
+ # Cannot generate the request from given parameters
239
+ msg = """Cannot prepare a request message for provided
240
+ arguments. Please check that your arguments match
241
+ declared content type."""
242
+ raise ApiException(status=0, reason=msg)
243
+ # For `GET`, `HEAD`
244
+ else:
245
+ r = self.pool_manager.request(
246
+ method,
247
+ url,
248
+ fields={},
249
+ timeout=timeout,
250
+ headers=headers,
251
+ preload_content=False
252
+ )
253
+ except urllib3.exceptions.SSLError as e:
254
+ msg = "\n".join([type(e).__name__, str(e)])
255
+ raise ApiException(status=0, reason=msg)
256
+
257
+ return RESTResponse(r)
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: queueflow
3
+ Version: 0.1.0
4
+ Summary: QueueFlow API
5
+ Home-page: https://github.com/queueflow/queueflow-sdk-python
6
+ Author: QueueFlow
7
+ Author-email: team@queueflow.dev
8
+ License: MIT
9
+ Keywords: OpenAPI,OpenAPI-Generator,QueueFlow API
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: urllib3<3.0.0,>=1.25.3
12
+ Requires-Dist: python-dateutil>=2.8.2
13
+ Requires-Dist: pydantic>=2
14
+ Requires-Dist: typing-extensions>=4.7.1
15
+ Dynamic: author
16
+ Dynamic: author-email
17
+ Dynamic: description
18
+ Dynamic: description-content-type
19
+ Dynamic: home-page
20
+ Dynamic: keywords
21
+ Dynamic: license
22
+ Dynamic: requires-dist
23
+ Dynamic: summary
24
+
25
+ REST API for QueueFlow, a PostgreSQL-native distributed job queue and workflow engine.
26
+
@@ -0,0 +1,62 @@
1
+ queueflow/__init__.py,sha256=oj5IED3dwgyKiwZsJ7DBQjRaONciCB5KjZhcqkYTKUg,3758
2
+ queueflow/api_client.py,sha256=n3tEbKgQXt2uqbqqL-Jh67jT7_ySSJ4SQdpnKfJNpq0,27423
3
+ queueflow/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
4
+ queueflow/configuration.py,sha256=RhEjrEPC4hpz9dUmATLt0b9Jr9l54hofNJmoW3eiLcA,18057
5
+ queueflow/exceptions.py,sha256=gYMwIB4L1CmjProtkG9BumRPkYwletpAC5QMWPG9AN0,5958
6
+ queueflow/facade.py,sha256=omS4wKfBStlKJx0LQiKrp81GfXr6FKiO5YITRQ4yD0s,9889
7
+ queueflow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ queueflow/rest.py,sha256=7Ms20RQWA3fVHuQMLx7Npw99eZp5qPHq6DIWo5oI6KA,9393
9
+ queueflow/api/__init__.py,sha256=tM-5KblwDhrv1Kn3M3Ty4x-_bLQrUJciEEyFL88KXTs,369
10
+ queueflow/api/cron_api.py,sha256=mfz_ONRNNt-B40w55jq2krDjq4Js_eUHduU2eMYQQFs,71627
11
+ queueflow/api/dlq_api.py,sha256=XhrPV9wYWyX7MkrKHAhrKeidNny9pJOdHmaAJF4jD_A,41573
12
+ queueflow/api/health_api.py,sha256=D-fSj6AcxpMv0-cSbz3QlJdRfCr2TuLOYPzw26zDljs,19376
13
+ queueflow/api/jobs_api.py,sha256=FEIHcmB1BoglYBTwXguRPMzASHLlivlUdyUwYgOeBlM,74337
14
+ queueflow/api/system_api.py,sha256=YURq_bokMRlFQkeGZ7imtvHKbPHln5ABJbXOqtVolJo,19268
15
+ queueflow/api/worker_api.py,sha256=zqgxoFHCJ7huwTk0-9Ni9_MU9lG3lo3yc7sAErYKzkg,46010
16
+ queueflow/api/workflows_api.py,sha256=LdNSbvW8hfOHuEXKn_c1W34xMWTjj3sWJFvQslaFDRo,72257
17
+ queueflow/models/__init__.py,sha256=lzpi5DbZcTbL9j6Nyo_jjWFjNspoGj1pQfflnGwVtuw,2938
18
+ queueflow/models/backoff_strategy.py,sha256=lvKHe-dQBW4HgHNuzOoFQ8Vje1TUJkf2wCpktO5wzZk,798
19
+ queueflow/models/complete_job_request.py,sha256=a6b67PucHywZsIZb1cPizQXgKxUX_6zA0sWZ71F4GAE,2806
20
+ queueflow/models/create_batch_jobs_request.py,sha256=kABWHFd_fQaMF0gQW5uYBIrImFMVEYRFNaN287jEivU,2951
21
+ queueflow/models/create_batch_jobs_response.py,sha256=P2JReuy6hb7DRvqrX8kAh7PQc_Lb5DVuU6bXcN_FNLw,2659
22
+ queueflow/models/create_cron_request.py,sha256=jidXOwvCjztrPCQ5kJj8Tgo10a0q3LpT5jfVakq-f_s,3773
23
+ queueflow/models/create_cron_response.py,sha256=WSwWaisFdz3K1NuRufoLLfntA-thFkrx3Y87CfTQPCU,2486
24
+ queueflow/models/create_job_request.py,sha256=mCKX2CrPp77T98OwIK8j5snCM1XR8RyXImQFGnmH0BE,3808
25
+ queueflow/models/create_job_response.py,sha256=W68mYk9VXJ7AUBMbgFoXWW-KLDXou3FVKY1UprYS9WQ,2478
26
+ queueflow/models/create_workflow_request.py,sha256=HHYLccPZCk8ZMRDzod_fzbL4N3AeKKEEOuMtwDe8qOw,3327
27
+ queueflow/models/create_workflow_response.py,sha256=s4QuTyC43IoRybob-IRgm7m_W-lmcogYwunI3TXb7dE,2518
28
+ queueflow/models/cron_schedule.py,sha256=jxTej_w-kKhwtbEQfOyF3ZYa7cWdPi9vFabmDYMQtIk,5142
29
+ queueflow/models/dead_letter.py,sha256=rcZh_SMYGAcIQTj2rIALB_o_qOqWp1gvIUu5M8msWwY,5229
30
+ queueflow/models/error_body.py,sha256=E2C-vOu_mjqUywCeP4ZoAP_YqOT_Q1gzMuV-BezXWyQ,2556
31
+ queueflow/models/fail_job_request.py,sha256=xY9_8RzYggf_s9mxUNAHDRx5mdUdjtsYwU1JllPqFcc,2998
32
+ queueflow/models/health_status.py,sha256=gK4iDvb35h2uwYX2XAvadvOrQEzvzULq66s8uq3Gtng,2649
33
+ queueflow/models/heartbeat_request.py,sha256=W-nZLKCG7dpcAJrUo6kCuTAx2y-BQi36R-fp-94BRZM,2844
34
+ queueflow/models/heartbeat_response.py,sha256=WLaWKjYvN2yNTvgLNTtvgGtfdrhsyVjnb5BSQHeTFqQ,2755
35
+ queueflow/models/job.py,sha256=fc9Fbk06iGe95ZJkP5uSYlKsGBOR9yc_-RlZJx68mNQ,7546
36
+ queueflow/models/job_config.py,sha256=mrarvPRCfWGXmPZnY1kIOWdVb5IBfM2wUKESGVrmnkc,4550
37
+ queueflow/models/job_config_request.py,sha256=GHysVx-3ng98Jep-d6jUy6lZbky7nnt1pvUdG5IwzEQ,6000
38
+ queueflow/models/job_status.py,sha256=UANbCg9bjCI7p9LrAFZvhuuJSHB2S4cyWlLKg_F1Rhk,857
39
+ queueflow/models/lease_jobs_request.py,sha256=Ao7VA41410YXPQ3L0bvDkDbJ9rZH0UlxznQsPByF3kw,3821
40
+ queueflow/models/lease_jobs_response.py,sha256=ZZqYfqsMMdARg6uOT4AZMAVHVa8yG70nGWzY4Ukgtbk,2902
41
+ queueflow/models/leased_job.py,sha256=oauCp5M0M_cVVOH1PuhwmQbJhOCx2MicOemTL04Ke4k,3083
42
+ queueflow/models/list_crons_response.py,sha256=3OgFNNE6dEkWv7YUlCRYFeqUq_ynNoa450oz5EdPRuE,4111
43
+ queueflow/models/list_dead_letters_response.py,sha256=Arv2JiDuHvZ9l0-eWCMryheUlF42Mb0PBRbi6AHqu-A,4211
44
+ queueflow/models/list_jobs_response.py,sha256=T27wLAkZrH9q_UXhZTXlVO_uK1HtkJZBUd1_SoSfyjI,4146
45
+ queueflow/models/list_workflows_response.py,sha256=lLgKFRosvv35BDFmfWCi4oQr-OGBJBY0Jj6T4mrmeSE,4158
46
+ queueflow/models/on_failure.py,sha256=Vddg4RFnbZNNSttIaCB1gPg05aDzcKOM5pBRgEWkHlY,786
47
+ queueflow/models/on_success.py,sha256=TGwLUuWJn_Kw3SrSjQo1VzqfWxzU3xlqu1suajTOYk4,766
48
+ queueflow/models/ready_status.py,sha256=Tcb2deIWEhsrff_ANFqrq9PI4c8VrQnS2pg5PyviW7Y,2454
49
+ queueflow/models/replay_dead_letter_response.py,sha256=6EHZwOHTd9tNORJhTM9VayiE1Q3MdCgdEle0pUd6gnc,2586
50
+ queueflow/models/stats_snapshot.py,sha256=g2WF927iSNJiR0OwNoNBHKxLnnjfnfjXt43_rzXRR_o,3562
51
+ queueflow/models/step_status.py,sha256=1VHvqYgwsbem-33To4ojxxR46uWznYA8Z_VFMQLmrx4,867
52
+ queueflow/models/tasks_response.py,sha256=bsm1AQKV4OemP9CK4NqwhDQf-EbL40VZkKXJDlYadpo,2464
53
+ queueflow/models/workflow.py,sha256=nF8MvYeZkEVNK_O1lrl1HSc_Hr3CfCBwbY4NTLNMGRY,4654
54
+ queueflow/models/workflow_diagram_response.py,sha256=j9R7XFXYH1mh3j2SzUhsRfK0SAbWM27WEICyD_INNL4,2722
55
+ queueflow/models/workflow_status.py,sha256=dz2kUq7prbslisrqXzUapkOkXFss0vSsFNnSoIDl11M,890
56
+ queueflow/models/workflow_step.py,sha256=Gb7mGRPe0Xvo70n4SJ0c3eHJGJFJMJZVqMULj1SmoUk,3860
57
+ queueflow/models/workflow_step_state.py,sha256=UhlzhRs_p81AJ0X4WLGsEzJYYFmi8uxRrky-e54zhX4,3116
58
+ queueflow/models/workflow_step_states_response.py,sha256=vxD3PWqNmKE_hCsc1q8kid6QFvrUA-PrmLTDZB-YEQg,3055
59
+ queueflow-0.1.0.dist-info/METADATA,sha256=pP4IJJh6qxgL6me5Htb-Rxwdk3MU3zL-Ixv2qOYPE6k,718
60
+ queueflow-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
61
+ queueflow-0.1.0.dist-info/top_level.txt,sha256=J9jGksZj4ffWlkAOswE7Z989FNzjVI8lY858M7UIMrk,10
62
+ queueflow-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ queueflow