MCPcopy Create free account
hub / github.com/THUDM/AgentBench / delete

Method delete

src/server/tasks/dbbench/interaction.py:56–82  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

54 await self._create_database()
55
56 async def delete(self):
57 if self.database:
58 # try to connect and delete the database
59 try:
60 conn = await self._get_conn()
61 async with await conn.cursor() as cursor:
62 await cursor.execute(f'DROP DATABASE IF EXISTS {self.database}')
63 await conn.commit()
64 except:
65 self.logger.warning(f'Error dropping MySQL database {self.database}:', exc_info=True)
66 self.database = None
67
68 if self._conn:
69 try:
70 await self._conn.close()
71 except:
72 self.logger.warning(f'Error closing MySQL connection:', exc_info=True)
73 self._conn = None
74
75 if self.session_id:
76 try:
77 await self.env_controller.end_session(self.session_id)
78 except:
79 self.logger.warning(f'Error ending environment session {self.session_id}:', exc_info=True)
80 self.session_id = None
81 self.container_id = None
82 self.container_ip = None
83
84 async def execute(self, sql: str, data: Union[Sequence, Dict[str, Any]] = ()) -> str:
85 conn = await self._get_conn()

Callers 1

start_sampleMethod · 0.95

Calls 2

_get_connMethod · 0.95
executeMethod · 0.45

Tested by

no test coverage detected