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 v0.60.0 · feast-dev/feast · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
feast-dev
/
feast
Public
Notifications
You must be signed in to change notification settings
Fork
1.4k
Star
7.2k
Code
Issues
215
Pull requests
190
Discussions
Actions
Security and quality
1
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
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
52 lines (38 loc) · 1.42 KB
Breadcrumbs
feast
/
sdk
/
python
/
feast
/
arrow_error_handler.py
Copy path
File metadata and controls
52 lines (38 loc) · 1.42 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
50
51
52
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
())
# Re-raise non-Feast exceptions so Arrow Flight returns a proper error
# instead of allowing the server method to return None.
raise
e
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