class_docstr: Method of encapsulating utility files 
class_docstr_tok: ["Method","of","encapsulating","utility","files"]
code: def wait_all_pending_tasks_finished(self):
      task_states_map = {}
      all_tasks, _ = self.list_bulk_insert_tasks()
      # log.info(f"all tasks: {all_tasks}")
      for task in all_tasks:
          if task.state in [
              BulkInsertState.ImportStarted,
              BulkInsertState.ImportPersisted,
          ]:
              task_states_map[task.task_id] = task.state
  
      log.info(f"current tasks states: {task_states_map}")
      pending_tasks = self.get_bulk_insert_pending_list()
      working_tasks = self.get_bulk_insert_working_list()
      log.info(
          f"in the start, there are {len(working_tasks)} working tasks, {working_tasks} {len(pending_tasks)} pending tasks, {pending_tasks}"
      )
      time_cnt = 0
      pending_task_ids = set()
      while len(pending_tasks) > 0:
          time.sleep(5)
          time_cnt += 5
          pending_tasks = self.get_bulk_insert_pending_list()
          working_tasks = self.get_bulk_insert_working_list()
          cur_pending_task_ids = []
          for task_id in pending_tasks.keys():
              cur_pending_task_ids.append(task_id)
              pending_task_ids.add(task_id)
          log.info(
              f"after {time_cnt}, there are {len(working_tasks)} working tasks, {len(pending_tasks)} pending tasks"
          )
          log.debug(
              f"total pending tasks: {pending_task_ids} current pending tasks: {cur_pending_task_ids}"
          )
      log.info(f"after {time_cnt}, all pending tasks are finished")
      all_tasks, _ = self.list_bulk_insert_tasks()
      for task in all_tasks:
          if task.task_id in pending_task_ids:
              log.info(
                  f"task {task.task_id} state transfer from pending to {task.state_name}"
              )
  
imports: from datetime import datetime
  import time
  from pymilvus import utility
  import sys
  from check.func_check import ResponseChecker
  from utils.api_request import api_request
  from pymilvus import BulkInsertState
  from pymilvus.orm.role import Role
  from utils.util_log import test_log
label_desc: Use image node_id 8 for calling the ApiUtilityWrapper obj's underlying member method code with example usage: obj.wait_all_pending_tasks_finished() without return types