fix: Resolve code graph pipeline issue
This commit is contained in:
parent
80896fdcc5
commit
67b61ff964
3 changed files with 55 additions and 49 deletions
|
|
@ -79,7 +79,9 @@ async def run_code_graph_pipeline(repo_path, include_docs=False):
|
||||||
async for run_status in non_code_pipeline_run:
|
async for run_status in non_code_pipeline_run:
|
||||||
yield run_status
|
yield run_status
|
||||||
|
|
||||||
async for run_status in run_tasks(tasks, dataset.id, repo_path, user, "cognify_code_pipeline"):
|
async for run_status in run_tasks(
|
||||||
|
tasks, dataset.id, repo_path, user, "cognify_code_pipeline", incremental_loading=False
|
||||||
|
):
|
||||||
yield run_status
|
yield run_status
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,8 @@ async def run_tasks(
|
||||||
|
|
||||||
# TODO: Convert to async gather task instead of for loop (just make sure it can work there were some issues when async gathering datasets)
|
# TODO: Convert to async gather task instead of for loop (just make sure it can work there were some issues when async gathering datasets)
|
||||||
for data_item in data:
|
for data_item in data:
|
||||||
|
# If incremental_loading of data is set to True don't process documents already processed by pipeline
|
||||||
|
if incremental_loading:
|
||||||
# If data is being added to Cognee for the first time calculate the id of the data
|
# If data is being added to Cognee for the first time calculate the id of the data
|
||||||
if not isinstance(data_item, Data):
|
if not isinstance(data_item, Data):
|
||||||
data = await resolve_data_directories(data)
|
data = await resolve_data_directories(data)
|
||||||
|
|
@ -108,8 +110,6 @@ async def run_tasks(
|
||||||
# If data was already processed by Cognee get data id
|
# If data was already processed by Cognee get data id
|
||||||
data_id = data_item.id
|
data_id = data_item.id
|
||||||
|
|
||||||
# If incremental_loading is set to True don't process documents already processed by pipeline
|
|
||||||
if incremental_loading:
|
|
||||||
# Check pipeline status, if Data already processed for pipeline before skip current processing
|
# Check pipeline status, if Data already processed for pipeline before skip current processing
|
||||||
async with db_engine.get_async_session() as session:
|
async with db_engine.get_async_session() as session:
|
||||||
data_point = (
|
data_point = (
|
||||||
|
|
@ -134,6 +134,7 @@ async def run_tasks(
|
||||||
payload=result,
|
payload=result,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if incremental_loading:
|
||||||
data_items_pipeline_run_info[data_id] = {
|
data_items_pipeline_run_info[data_id] = {
|
||||||
"run_info": PipelineRunCompleted(
|
"run_info": PipelineRunCompleted(
|
||||||
pipeline_run_id=pipeline_run_id,
|
pipeline_run_id=pipeline_run_id,
|
||||||
|
|
@ -158,7 +159,7 @@ async def run_tasks(
|
||||||
logger.error(
|
logger.error(
|
||||||
f"Exception caught while processing data: {error}.\n Data processing failed for data item: {data_item}."
|
f"Exception caught while processing data: {error}.\n Data processing failed for data item: {data_item}."
|
||||||
)
|
)
|
||||||
|
if incremental_loading:
|
||||||
data_items_pipeline_run_info = {
|
data_items_pipeline_run_info = {
|
||||||
"run_info": PipelineRunErrored(
|
"run_info": PipelineRunErrored(
|
||||||
pipeline_run_id=pipeline_run_id,
|
pipeline_run_id=pipeline_run_id,
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,9 @@ async def get_repo_file_dependencies(
|
||||||
extraction of dependencies (default is False). (default False)
|
extraction of dependencies (default is False). (default False)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if isinstance(repo_path, list) and len(repo_path) == 1:
|
||||||
|
repo_path = repo_path[0]
|
||||||
|
|
||||||
if not os.path.exists(repo_path):
|
if not os.path.exists(repo_path):
|
||||||
raise FileNotFoundError(f"Repository path {repo_path} does not exist.")
|
raise FileNotFoundError(f"Repository path {repo_path} does not exist.")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue