Merge pull request #190 from topoteretes/COG-575-remove-graph-overwrite-on-error
Remove graph overwriting on exception in NetworkXAdapter
This commit is contained in:
commit
cdaf63f57c
3 changed files with 2 additions and 8 deletions
BIN
.DS_Store
vendored
Normal file
BIN
.DS_Store
vendored
Normal file
Binary file not shown.
BIN
cognee/.DS_Store
vendored
Normal file
BIN
cognee/.DS_Store
vendored
Normal file
Binary file not shown.
|
|
@ -284,16 +284,10 @@ class NetworkXAdapter(GraphDBInterface):
|
|||
os.makedirs(file_dir, exist_ok = True)
|
||||
|
||||
await self.save_graph_to_file(file_path)
|
||||
except Exception as e:
|
||||
logger.error("Failed to load graph from file: %s \n %s", file_path, str(e))
|
||||
# Initialize an empty graph in case of error
|
||||
self.graph = nx.MultiDiGraph()
|
||||
|
||||
file_dir = os.path.dirname(file_path)
|
||||
if not os.path.exists(file_dir):
|
||||
os.makedirs(file_dir, exist_ok = True)
|
||||
except Exception:
|
||||
logger.error("Failed to load graph from file: %s", file_path)
|
||||
|
||||
await self.save_graph_to_file(file_path)
|
||||
|
||||
async def delete_graph(self, file_path: str = None):
|
||||
"""Asynchronously delete the graph file from the filesystem."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue