FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
feast/sdk/python/feast/arrow_error_handler.py at master · elshize/feast · GitHub
elshize
/
feast
Public
forked from
feast-dev/feast
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
feast
/
sdk
/
python
/
feast
/
arrow_error_handler.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
49 lines (35 loc) · 1.25 KB
Breadcrumbs
feast
/
sdk
/
python
/
feast
/
arrow_error_handler.py
Copy path
File metadata and controls
49 lines (35 loc) · 1.25 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import
logging
from
functools
import
wraps
import
pyarrow
.
flight
as
fl
from
feast
.
errors
import
FeastError
logger
=
logging
.
getLogger
(
__name__
)
def
arrow_client_error_handling_decorator
(
func
):
@
wraps
(
func
)
def
wrapper
(
*
args
,
**
kwargs
):
try
:
return
func
(
*
args
,
**
kwargs
)
except
Exception
as
e
:
mapped_error
=
FeastError
.
from_error_detail
(
_get_exception_data
(
e
.
args
[
0
]))
if
mapped_error
is
not
None
:
raise
mapped_error
raise
e
return
wrapper
def
arrow_server_error_handling_decorator
(
func
):
@
wraps
(
func
)
def
wrapper
(
*
args
,
**
kwargs
):
try
:
return
func
(
*
args
,
**
kwargs
)
except
Exception
as
e
:
if
isinstance
(
e
,
FeastError
):
raise
fl
.
FlightError
(
e
.
to_error_detail
())
return
wrapper
def
_get_exception_data
(
except_str
)
->
str
:
substring
=
"Flight error: "
# Find the starting index of the substring
position
=
except_str
.
find
(
substring
)
end_json_index
=
except_str
.
find
(
"}"
)
if
position
!=
-
1
and
end_json_index
!=
-
1
:
# Extract the part of the string after the substring
result
=
except_str
[
position
+
len
(
substring
) :
end_json_index
+
1
]
return
result
return
""
Back
|
FazBrowse Home
|
New Git URL