gooddata-flight-server 1.40.1.dev2__py3-none-any.whl → 1.40.1.dev4__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.
Potentially problematic release.
This version of gooddata-flight-server might be problematic. Click here for more details.
- gooddata_flight_server/errors/error_info.py +34 -8
- {gooddata_flight_server-1.40.1.dev2.dist-info → gooddata_flight_server-1.40.1.dev4.dist-info}/METADATA +2 -2
- {gooddata_flight_server-1.40.1.dev2.dist-info → gooddata_flight_server-1.40.1.dev4.dist-info}/RECORD +7 -7
- {gooddata_flight_server-1.40.1.dev2.data → gooddata_flight_server-1.40.1.dev4.data}/scripts/gooddata-flight-server +0 -0
- {gooddata_flight_server-1.40.1.dev2.dist-info → gooddata_flight_server-1.40.1.dev4.dist-info}/WHEEL +0 -0
- {gooddata_flight_server-1.40.1.dev2.dist-info → gooddata_flight_server-1.40.1.dev4.dist-info}/licenses/LICENSE.txt +0 -0
- {gooddata_flight_server-1.40.1.dev2.dist-info → gooddata_flight_server-1.40.1.dev4.dist-info}/top_level.txt +0 -0
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
# (C) 2024 GoodData Corporation
|
|
2
2
|
import base64
|
|
3
3
|
import traceback
|
|
4
|
-
from typing import Callable, Optional, Union
|
|
4
|
+
from typing import Callable, Optional, Union, cast
|
|
5
5
|
|
|
6
6
|
import orjson
|
|
7
7
|
import pyarrow.flight
|
|
8
8
|
|
|
9
9
|
from gooddata_flight_server.errors.error_code import ErrorCode
|
|
10
10
|
|
|
11
|
+
_ERROR_INFO_MAX_MSG = 256
|
|
12
|
+
_ERROR_INFO_MAX_DETAIL = 512
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _truncate_str_value(val: Optional[str], max_len: int) -> Optional[str]:
|
|
16
|
+
if val is None:
|
|
17
|
+
return None
|
|
18
|
+
|
|
19
|
+
if len(val) <= max_len:
|
|
20
|
+
return val
|
|
21
|
+
|
|
22
|
+
# no big deal that the actual max length is slightly exceeded
|
|
23
|
+
# all this truncating happens because ErrorInfo is eventually
|
|
24
|
+
# passed via gRPC headers which have 16k hard limit
|
|
25
|
+
return val[:max_len] + " [truncated]"
|
|
26
|
+
|
|
11
27
|
|
|
12
28
|
class ErrorInfo:
|
|
13
29
|
"""
|
|
@@ -22,15 +38,15 @@ class ErrorInfo:
|
|
|
22
38
|
body: Optional[bytes] = None,
|
|
23
39
|
code: int = 0,
|
|
24
40
|
) -> None:
|
|
25
|
-
self._msg = msg
|
|
26
|
-
self._detail: Optional[str] = detail
|
|
41
|
+
self._msg = cast(str, _truncate_str_value(msg, _ERROR_INFO_MAX_MSG))
|
|
42
|
+
self._detail: Optional[str] = _truncate_str_value(detail, _ERROR_INFO_MAX_DETAIL)
|
|
27
43
|
self._body: Optional[bytes] = body
|
|
28
44
|
self._code: int = code
|
|
29
45
|
|
|
30
46
|
@property
|
|
31
47
|
def msg(self) -> str:
|
|
32
48
|
"""
|
|
33
|
-
:return: human
|
|
49
|
+
:return: human-readable error message
|
|
34
50
|
"""
|
|
35
51
|
return self._msg
|
|
36
52
|
|
|
@@ -60,26 +76,36 @@ class ErrorInfo:
|
|
|
60
76
|
"""
|
|
61
77
|
Updates error message.
|
|
62
78
|
|
|
63
|
-
:param msg: new message
|
|
79
|
+
:param msg: new message, up to 256 characters; will be truncated if the limit is exceeded
|
|
64
80
|
:return: self, for call chaining sakes
|
|
65
81
|
"""
|
|
66
|
-
self._msg = msg
|
|
82
|
+
self._msg = cast(str, _truncate_str_value(msg, _ERROR_INFO_MAX_MSG))
|
|
83
|
+
|
|
67
84
|
return self
|
|
68
85
|
|
|
69
86
|
def with_detail(self, detail: Optional[str] = None) -> "ErrorInfo":
|
|
70
87
|
"""
|
|
71
88
|
Updates or resets the error detail.
|
|
72
89
|
|
|
73
|
-
:param detail: detail to set; if None, the detail stored in the meta will be removed; default is None
|
|
90
|
+
:param detail: detail to set; if None, the detail stored in the meta will be removed; default is None;
|
|
91
|
+
detail can be up to 512 characters; will be truncated if the limit is exceeded
|
|
74
92
|
:return: self, for call chaining sakes
|
|
75
93
|
"""
|
|
76
|
-
self._detail = detail
|
|
94
|
+
self._detail = _truncate_str_value(detail, _ERROR_INFO_MAX_DETAIL)
|
|
95
|
+
|
|
77
96
|
return self
|
|
78
97
|
|
|
79
98
|
def with_body(self, body: Optional[Union[bytes, str]]) -> "ErrorInfo":
|
|
80
99
|
"""
|
|
81
100
|
Updates or resets the error body.
|
|
82
101
|
|
|
102
|
+
IMPORTANT: the ErrorInfo (and thus the contents of `body`) are passed out via FlightError.extra_info
|
|
103
|
+
property. The Flight RPC implementations pass the `extra_info` via gRPC headers. In turn, the gRPC headers
|
|
104
|
+
do have size limit. Keep this in mind when designing the value of `body`.
|
|
105
|
+
|
|
106
|
+
If you set body that is too large, you will run into problems like this:
|
|
107
|
+
https://github.com/grpc/grpc/issues/37852.
|
|
108
|
+
|
|
83
109
|
:param body: body to set; if None, the body stored in the meta will be removed; default is None
|
|
84
110
|
:return: self, for call chaining sakes
|
|
85
111
|
"""
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gooddata-flight-server
|
|
3
|
-
Version: 1.40.1.
|
|
3
|
+
Version: 1.40.1.dev4
|
|
4
4
|
Summary: Flight RPC server to host custom functions
|
|
5
5
|
Author: GoodData
|
|
6
6
|
Author-email: support@gooddata.com
|
|
7
7
|
License: MIT
|
|
8
|
-
Project-URL: Documentation, https://gooddata-flight-server.readthedocs.io/en/v1.40.1.
|
|
8
|
+
Project-URL: Documentation, https://gooddata-flight-server.readthedocs.io/en/v1.40.1.dev4
|
|
9
9
|
Project-URL: Source, https://github.com/gooddata/gooddata-python-sdk
|
|
10
10
|
Keywords: gooddata,flight,rpc,flight rpc,custom functions,analytics,headless,business,intelligence,headless-bi,cloud,native,semantic,layer,sql,metrics
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
{gooddata_flight_server-1.40.1.dev2.dist-info → gooddata_flight_server-1.40.1.dev4.dist-info}/RECORD
RENAMED
|
@@ -8,7 +8,7 @@ gooddata_flight_server/config/__init__.py,sha256=QL4TGz0QQfsNakkgMkve9k8wiR73dfo
|
|
|
8
8
|
gooddata_flight_server/config/config.py,sha256=vMdBzGnBrxPCAsfJgpOxQKjxXl5xjEFNu32_4Bk5Qdw,17108
|
|
9
9
|
gooddata_flight_server/errors/__init__.py,sha256=QL4TGz0QQfsNakkgMkve9k8wiR73dfoOF2_18ESSPRE,33
|
|
10
10
|
gooddata_flight_server/errors/error_code.py,sha256=s7wcNlsGKG0PSPXNMBMQMekViZeaoJKWVboEL12kogE,5808
|
|
11
|
-
gooddata_flight_server/errors/error_info.py,sha256=
|
|
11
|
+
gooddata_flight_server/errors/error_info.py,sha256=akYJk-QT0O2GQno__yc67YAxG5iBm-Fz4JDG2MQ6y4I,18852
|
|
12
12
|
gooddata_flight_server/health/__init__.py,sha256=QL4TGz0QQfsNakkgMkve9k8wiR73dfoOF2_18ESSPRE,33
|
|
13
13
|
gooddata_flight_server/health/health_check_http_server.py,sha256=A-wJ5L22s4PtJisNSOolrABp703w-0rhvDKKev_iN9I,3393
|
|
14
14
|
gooddata_flight_server/health/server_health_monitor.py,sha256=vDe3Z5u5SPPG3RWGtrexzoJJ4HLFl7A38_hA6LfS71I,2690
|
|
@@ -41,9 +41,9 @@ gooddata_flight_server/utils/libc_utils.py,sha256=_ZwKeeB0lk2xh-gSC_7rc9felHu_hq
|
|
|
41
41
|
gooddata_flight_server/utils/logging.py,sha256=3sip4Xte5YHjZNyQEQVo96rCsknxG1JPj7cIbnz0iBo,6081
|
|
42
42
|
gooddata_flight_server/utils/methods_discovery.py,sha256=ZcBJU5dHBsnZD5zDXajE5merwCISfjHGcIlIWCQtNLY,3618
|
|
43
43
|
gooddata_flight_server/utils/otel_tracing.py,sha256=MfKFh0TkVSUmPC6f8Oobp5XSCYxAsQyS0UaSJQF1nCw,4540
|
|
44
|
-
gooddata_flight_server-1.40.1.
|
|
45
|
-
gooddata_flight_server-1.40.1.
|
|
46
|
-
gooddata_flight_server-1.40.1.
|
|
47
|
-
gooddata_flight_server-1.40.1.
|
|
48
|
-
gooddata_flight_server-1.40.1.
|
|
49
|
-
gooddata_flight_server-1.40.1.
|
|
44
|
+
gooddata_flight_server-1.40.1.dev4.data/scripts/gooddata-flight-server,sha256=cXl4cF_pNme_0ns-Dap825C_L-0ovWs9hmlNl7kN9kU,239
|
|
45
|
+
gooddata_flight_server-1.40.1.dev4.dist-info/licenses/LICENSE.txt,sha256=o90MhGat28171lD8r77bLXsSnvDVu9CQAsWxAzx1Z2E,1064
|
|
46
|
+
gooddata_flight_server-1.40.1.dev4.dist-info/METADATA,sha256=PwM73ShpGNKInPXDVQWwsV0rbEVYJoApmXVt_87symE,30269
|
|
47
|
+
gooddata_flight_server-1.40.1.dev4.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
48
|
+
gooddata_flight_server-1.40.1.dev4.dist-info/top_level.txt,sha256=fkhUrPUK9CeUzu3qMaEXJbY-HVuY-sqUx8ct7AtZH0s,23
|
|
49
|
+
gooddata_flight_server-1.40.1.dev4.dist-info/RECORD,,
|
|
File without changes
|
{gooddata_flight_server-1.40.1.dev2.dist-info → gooddata_flight_server-1.40.1.dev4.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|