MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / prepare

Method prepare

trinity/buffer/storage/sql.py:335–350  ·  view source on GitHub ↗

Initialize async engine and create tables.

(self)

Source from the content-addressed store, hash-verified

333 self.total_samples = float("inf")
334
335 async def prepare(self) -> None:
336 """Initialize async engine and create tables."""
337 if self._initialized:
338 return
339 from trinity.buffer.schema.formatter import TaskFormatter
340
341 result = await init_async_engine(
342 self.config.path, self.config.name, self.config.schema_type # type: ignore
343 )
344 self.engine, self.table_model_cls = result
345 self.session = async_sessionmaker(self.engine, expire_on_commit=False)
346 self.default_workflow_cls = WORKFLOWS.get(self.config.default_workflow_type)
347 self.default_reward_fn_cls = REWARD_FUNCTIONS.get(self.config.default_reward_fn_type)
348 self.formatter = TaskFormatter(self.config)
349 self._initialized = True
350 self.logger.info(f"SQL task storage initialized at {self.config.path}")
351
352 async def write(self, data: List[Dict]) -> None:
353 await self.prepare()

Callers 9

writeMethod · 0.95
readMethod · 0.95
__init__Method · 0.45
_get_async_storageMethod · 0.45
load_from_datasetMethod · 0.45
load_from_datasetMethod · 0.45
_get_async_storageMethod · 0.45

Calls 3

init_async_engineFunction · 0.90
TaskFormatterClass · 0.90
getMethod · 0.45

Tested by 2