@@ -62,7 +62,9 @@ class RetrievalJob(ABC):
62
62
"""A RetrievalJob manages the execution of a query to retrieve data from the offline store."""
63
63
64
64
def to_df (
65
- self , validation_reference : Optional ["ValidationReference" ] = None
65
+ self ,
66
+ validation_reference : Optional ["ValidationReference" ] = None ,
67
+ timeout : Optional [int ] = None ,
66
68
) -> pd .DataFrame :
67
69
"""
68
70
Synchronously executes the underlying query and returns the result as a pandas dataframe.
@@ -72,8 +74,9 @@ def to_df(
72
74
73
75
Args:
74
76
validation_reference (optional): The validation to apply against the retrieved dataframe.
77
+ timeout (optional): The query timeout if applicable.
75
78
"""
76
- features_df = self ._to_df_internal ()
79
+ features_df = self ._to_df_internal (timeout = timeout )
77
80
78
81
if self .on_demand_feature_views :
79
82
# TODO(adchia): Fix requirement to specify dependent feature views in feature_refs
@@ -101,7 +104,9 @@ def to_df(
101
104
return features_df
102
105
103
106
def to_arrow (
104
- self , validation_reference : Optional ["ValidationReference" ] = None
107
+ self ,
108
+ validation_reference : Optional ["ValidationReference" ] = None ,
109
+ timeout : Optional [int ] = None ,
105
110
) -> pyarrow .Table :
106
111
"""
107
112
Synchronously executes the underlying query and returns the result as an arrow table.
@@ -111,11 +116,12 @@ def to_arrow(
111
116
112
117
Args:
113
118
validation_reference (optional): The validation to apply against the retrieved dataframe.
119
+ timeout (optional): The query timeout if applicable.
114
120
"""
115
121
if not self .on_demand_feature_views and not validation_reference :
116
- return self ._to_arrow_internal ()
122
+ return self ._to_arrow_internal (timeout = timeout )
117
123
118
- features_df = self ._to_df_internal ()
124
+ features_df = self ._to_df_internal (timeout = timeout )
119
125
if self .on_demand_feature_views :
120
126
for odfv in self .on_demand_feature_views :
121
127
features_df = features_df .join (
@@ -147,20 +153,24 @@ def to_sql(self) -> str:
147
153
pass
148
154
149
155
@abstractmethod
150
- def _to_df_internal (self ) -> pd .DataFrame :
156
+ def _to_df_internal (self , timeout : Optional [ int ] = None ) -> pd .DataFrame :
151
157
"""
152
158
Synchronously executes the underlying query and returns the result as a pandas dataframe.
153
159
160
+ timeout: RetreivalJob implementations may implement a timeout.
161
+
154
162
Does not handle on demand transformations or dataset validation. For either of those,
155
163
`to_df` should be used.
156
164
"""
157
165
pass
158
166
159
167
@abstractmethod
160
- def _to_arrow_internal (self ) -> pyarrow .Table :
168
+ def _to_arrow_internal (self , timeout : Optional [ int ] = None ) -> pyarrow .Table :
161
169
"""
162
170
Synchronously executes the underlying query and returns the result as an arrow table.
163
171
172
+ timeout: RetreivalJob implementations may implement a timeout.
173
+
164
174
Does not handle on demand transformations or dataset validation. For either of those,
165
175
`to_arrow` should be used.
166
176
"""
0 commit comments