Skip to content

Commit

Permalink
Add default values to Pop to prevent exceptions
Browse files Browse the repository at this point in the history
Signed-off-by: zhenshan.cao <[email protected]>
  • Loading branch information
czs007 committed Nov 25, 2024
1 parent 26e92ff commit 6d0f95b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 54 deletions.
92 changes: 46 additions & 46 deletions pymilvus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,63 +71,63 @@
from .settings import Config as DefaultConfig

__all__ = [
"AnnSearchRequest",
"BulkInsertState",
"Collection",
"CollectionSchema",
"Connections",
"DataType",
"DefaultConfig",
"ExceptionsMessage",
"FieldSchema",
"Group",
"Hit",
"Hits",
"Index",
"IndexType",
"Milvus",
"MilvusClient",
"MilvusException",
"MilvusUnavailableException",
"MutationFuture",
"Partition",
"Prepare",
"RRFRanker",
"Replica",
"ResourceGroupInfo",
"Role",
"SearchFuture",
"SearchResult",
"Shard",
"Status",
"WeightedRanker",
"__version__",
"connections",
"loading_progress",
"index_building_progress",
"wait_for_index_building_complete",
"create_resource_group",
"create_user",
"db",
"delete_user",
"describe_resource_group",
"drop_collection",
"drop_resource_group",
"has_collection",
"list_collections",
"wait_for_loading_complete",
"has_partition",
"hybridts_to_datetime",
"hybridts_to_unixtime",
"index_building_progress",
"list_collections",
"list_resource_groups",
"list_usernames",
"loading_progress",
"mkts_from_datetime",
"mkts_from_hybridts",
"mkts_from_unixtime",
"mkts_from_datetime",
"hybridts_to_unixtime",
"hybridts_to_datetime",
"reset_password",
"create_user",
"transfer_node",
"transfer_replica",
"update_password",
"update_resource_groups",
"delete_user",
"list_usernames",
"SearchResult",
"Hits",
"Hit",
"Replica",
"Group",
"Shard",
"FieldSchema",
"CollectionSchema",
"SearchFuture",
"MutationFuture",
"utility",
"db",
"DefaultConfig",
"Role",
"ExceptionsMessage",
"MilvusUnavailableException",
"BulkInsertState",
"create_resource_group",
"drop_resource_group",
"describe_resource_group",
"list_resource_groups",
"transfer_node",
"transfer_replica",
"Milvus",
"Prepare",
"Status",
"DataType",
"MilvusException",
"__version__",
"MilvusClient",
"ResourceGroupInfo",
"Connections",
"IndexType",
"AnnSearchRequest",
"RRFRanker",
"WeightedRanker",
"wait_for_index_building_complete",
"wait_for_loading_complete",
]
8 changes: 4 additions & 4 deletions pymilvus/bulk_writer/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ def append_row(self, row: dict):
if DYNAMIC_FIELD_NAME in row and not isinstance(row[DYNAMIC_FIELD_NAME], dict):
self._throw(f"Dynamic field '{DYNAMIC_FIELD_NAME}' value should be JSON format")

for k in row:
for k, v in row.items():
if k == DYNAMIC_FIELD_NAME:
dynamic_values.update(row[k])
dynamic_values.update(v)
continue

if k not in self._buffer:
dynamic_values[k] = self._raw_obj(row[k])
dynamic_values[k] = self._raw_obj(v)
else:
self._buffer[k].append(row[k])
self._buffer[k].append(v)

if DYNAMIC_FIELD_NAME in self._buffer:
self._buffer[DYNAMIC_FIELD_NAME].append(dynamic_values)
Expand Down
2 changes: 1 addition & 1 deletion pymilvus/client/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def is_legal_round_decimal(round_decimal: Any) -> bool:


def is_legal_guarantee_timestamp(ts: Any) -> bool:
return ts is None or isinstance(ts, int) and ts >= 0
return (ts is None) or (isinstance(ts, int) and ts >= 0)


def is_legal_user(user: Any) -> bool:
Expand Down
4 changes: 1 addition & 3 deletions pymilvus/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ def timeout(start_time: Optional[float] = None) -> bool:
e.code == ErrorCode.RATE_LIMIT
or e.compatible_code == common_pb2.RateLimit
)
or retry_on_inconsistent_requery
and e.code == 2200
):
) or (retry_on_inconsistent_requery and e.code == 2200):
time.sleep(back_off)
back_off = min(back_off * back_off_multiplier, max_back_off)
else:
Expand Down

0 comments on commit 6d0f95b

Please sign in to comment.