MCPcopy Create free account
hub / github.com/SkyworkAI/DeepResearchAgent / restore

Method restore

src/benchmark/context.py:391–417  ·  view source on GitHub ↗

Restore a specific version of a benchmark.

(self, name: str, version: str, auto_initialize: bool = True)

Source from the content-addressed store, hash-verified

389 return config.instance if config else None
390
391 async def restore(self, name: str, version: str, auto_initialize: bool = True) -> Optional[BenchmarkConfig]:
392 """Restore a specific version of a benchmark."""
393 version_config = None
394 if name in self._benchmark_history_versions:
395 version_config = self._benchmark_history_versions[name].get(version)
396
397 if version_config is None:
398 logger.warning(f"| ⚠️ Version {version} not found for benchmark {name}")
399 return None
400
401 restored_config = BenchmarkConfig(**version_config.model_dump())
402 self._benchmark_configs[name] = restored_config
403
404 version_history = await version_manager.get_version_history("benchmark", name)
405 if version_history:
406 if version not in version_history.versions:
407 await version_manager.register_version("benchmark", name, version)
408 version_history.current_version = version
409 else:
410 await version_manager.register_version("benchmark", name, version)
411
412 if auto_initialize and restored_config.cls is not None:
413 await self.build(restored_config)
414
415 await self.save_to_json()
416 logger.info(f"| 🔄 Restored benchmark {name} to version {version}")
417 return restored_config
418
419 async def save_to_json(self):
420 """Save all benchmark configurations with history to JSON."""

Callers

nothing calls this directly

Calls 9

buildMethod · 0.95
save_to_jsonMethod · 0.95
BenchmarkConfigClass · 0.90
warningMethod · 0.80
get_version_historyMethod · 0.80
register_versionMethod · 0.80
getMethod · 0.45
model_dumpMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected