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

Method _save_to_file

examples/run_benchmark.py:104–114  ·  view source on GitHub ↗

Save current results to JSON file.

(self)

Source from the content-addressed store, hash-verified

102 await self._save_to_file()
103
104 async def _save_to_file(self):
105 """Save current results to JSON file."""
106 try:
107 with open(self.filepath, 'w', encoding='utf-8') as f:
108 json.dump(self.results_data, f, indent=2, ensure_ascii=False)
109 f.flush() # Force write to disk
110 os.fsync(f.fileno()) # Ensure data is written to disk
111 logger.debug(f"Successfully saved results to {self.filepath}")
112 except Exception as e:
113 logger.error(f"Failed to save results to {self.filepath}: {e}")
114 raise # Re-raise exception to ensure it's not silently ignored
115
116 def update_total_tasks(self, total_tasks: int):
117 """Update the total number of tasks."""

Callers 2

__init__Method · 0.95
add_task_resultMethod · 0.95

Calls 4

dumpMethod · 0.80
debugMethod · 0.80
flushMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected