[skip ci] Update codes of drop func on benchmark (#13056)

Signed-off-by: wangting0128 <ting.wang@zilliz.com>
This commit is contained in:
wt 2021-12-09 15:29:25 +08:00 committed by GitHub
parent 6845d2d90c
commit bc2bd2d0fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -418,20 +418,20 @@ class MilvusClient(object):
logger.debug("Row count: %d in collection: <%s>" % (row_count, collection_name)) logger.debug("Row count: %d in collection: <%s>" % (row_count, collection_name))
return row_count return row_count
def drop(self, timeout=120, collection_name=None): def drop(self, loop_cunt=120, collection_name=None):
""" """
drop steps: drop steps:
1.drop collection 1.drop collection
2.check collection exist 2.check collection exist
3.Set timeout to exit 3.Set timeout to exit
""" """
timeout = int(timeout) loop_cunt = int(loop_cunt)
if collection_name is None: if collection_name is None:
collection_name = self._collection_name collection_name = self._collection_name
logger.info("Start delete collection: %s" % collection_name) logger.info("Start delete collection: %s" % collection_name)
self._milvus.drop_collection(collection_name) self._milvus.drop_collection(collection_name)
i = 0 i = 0
while i < timeout: while i < loop_cunt:
try: try:
res = self._milvus.has_collection(collection_name) res = self._milvus.has_collection(collection_name)
if res: if res:
@ -443,7 +443,7 @@ class MilvusClient(object):
except Exception as e: except Exception as e:
logger.warning("Collection count failed: {}".format(str(e))) logger.warning("Collection count failed: {}".format(str(e)))
break break
if i >= timeout: if i >= loop_cunt:
logger.error("Delete collection timeout") logger.error("Delete collection timeout")
def get_stats(self): def get_stats(self):