Skip to content

Commit 7d9199e

Browse files
authored
[Serving] Fix OnlineVectorService following changes in mlrun#9248 (mlrun#9277)
[ML-12095](https://iguazio.atlassian.net/browse/ML-12095) Changes: * Removed `.body` access from `await_result()` since the body is now returned directly * Removed redundant `if data:` conditional - the processing logic should run regardless, with `None` results handled appropriately downstream * Flattened indentation accordingly [ML-12095]: https://iguazio.atlassian.net/browse/ML-12095?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 97dffec commit 7d9199e

File tree

1 file changed

+24
-26
lines changed

1 file changed

+24
-26
lines changed

mlrun/feature_store/feature_vector_utils.py

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -394,33 +394,31 @@ def get(self, entity_rows: list[Union[dict, list]], as_list=False):
394394
futures.append(self._controller.emit(row, return_awaitable_result=True))
395395

396396
for future in futures:
397-
result = future.await_result()
398-
data = result.body
399-
if data:
400-
actual_columns = data.keys()
401-
if all([col in self._index_columns for col in actual_columns]):
402-
# didn't get any data from the graph
403-
results.append(None)
404-
continue
405-
for column in self._requested_columns:
406-
if (
407-
column not in actual_columns
408-
and column != self.vector.status.label_column
397+
data = future.await_result()
398+
actual_columns = data.keys()
399+
if all([col in self._index_columns for col in actual_columns]):
400+
# didn't get any data from the graph
401+
results.append(None)
402+
continue
403+
for column in self._requested_columns:
404+
if (
405+
column not in actual_columns
406+
and column != self.vector.status.label_column
407+
):
408+
data[column] = None
409+
410+
if self._impute_values:
411+
for name in data.keys():
412+
v = data[name]
413+
if v is None or (
414+
isinstance(v, float) and (np.isinf(v) or np.isnan(v))
409415
):
410-
data[column] = None
411-
412-
if self._impute_values:
413-
for name in data.keys():
414-
v = data[name]
415-
if v is None or (
416-
isinstance(v, float) and (np.isinf(v) or np.isnan(v))
417-
):
418-
data[name] = self._impute_values.get(name, v)
419-
if not self.vector.spec.with_indexes:
420-
for name in self.vector.status.index_keys:
421-
data.pop(name, None)
422-
if not any(data.values()):
423-
data = None
416+
data[name] = self._impute_values.get(name, v)
417+
if not self.vector.spec.with_indexes:
418+
for name in self.vector.status.index_keys:
419+
data.pop(name, None)
420+
if not any(data.values()):
421+
data = None
424422

425423
if as_list and data:
426424
data = [

0 commit comments

Comments
 (0)