check if repo path exists before starting the pipeline (#252)

Co-authored-by: Rita Aleksziev <alekszievr@gmail..com>
This commit is contained in:
alekszievr 2024-12-04 16:25:05 +01:00 committed by GitHub
parent d793a5d9b5
commit df8fc829f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,12 +1,14 @@
import asyncio
import os
from concurrent.futures import ProcessPoolExecutor
from typing import AsyncGenerator
from uuid import NAMESPACE_OID, uuid5
import aiofiles
from concurrent.futures import ProcessPoolExecutor
import asyncio
from cognee.shared.CodeGraphEntities import CodeFile, Repository
from cognee.tasks.repo_processor.get_local_dependencies import get_local_script_dependencies
from cognee.tasks.repo_processor.get_local_dependencies import \
get_local_script_dependencies
async def get_py_path_and_source(file_path):
@ -54,6 +56,10 @@ def run_coroutine(coroutine_func, *args, **kwargs):
async def get_repo_file_dependencies(repo_path: str) -> AsyncGenerator[list, None]:
"""Generate a dependency graph for Python files in the given repository path."""
if not os.path.exists(repo_path):
raise FileNotFoundError(f"Repository path {repo_path} does not exist.")
py_files_dict = await get_py_files_dict(repo_path)
repo = Repository(