mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-11 05:36:03 +02:00
Bugfix/indexing progress (#1916)
* mark in progress should always be committed * no_commit version of mark_attempt is not needed
This commit is contained in:
@@ -20,7 +20,7 @@ from danswer.db.connector_credential_pair import update_connector_credential_pai
|
|||||||
from danswer.db.engine import get_sqlalchemy_engine
|
from danswer.db.engine import get_sqlalchemy_engine
|
||||||
from danswer.db.index_attempt import get_index_attempt
|
from danswer.db.index_attempt import get_index_attempt
|
||||||
from danswer.db.index_attempt import mark_attempt_failed
|
from danswer.db.index_attempt import mark_attempt_failed
|
||||||
from danswer.db.index_attempt import mark_attempt_in_progress__no_commit
|
from danswer.db.index_attempt import mark_attempt_in_progress
|
||||||
from danswer.db.index_attempt import mark_attempt_succeeded
|
from danswer.db.index_attempt import mark_attempt_succeeded
|
||||||
from danswer.db.index_attempt import update_docs_indexed
|
from danswer.db.index_attempt import update_docs_indexed
|
||||||
from danswer.db.models import IndexAttempt
|
from danswer.db.models import IndexAttempt
|
||||||
@@ -299,9 +299,7 @@ def _prepare_index_attempt(db_session: Session, index_attempt_id: int) -> IndexA
|
|||||||
)
|
)
|
||||||
|
|
||||||
# only commit once, to make sure this all happens in a single transaction
|
# only commit once, to make sure this all happens in a single transaction
|
||||||
mark_attempt_in_progress__no_commit(attempt)
|
mark_attempt_in_progress(attempt, db_session)
|
||||||
if attempt.embedding_model.status != IndexModelStatus.PRESENT:
|
|
||||||
db_session.commit()
|
|
||||||
|
|
||||||
return attempt
|
return attempt
|
||||||
|
|
||||||
|
@@ -75,11 +75,13 @@ def get_not_started_index_attempts(db_session: Session) -> list[IndexAttempt]:
|
|||||||
return list(new_attempts.all())
|
return list(new_attempts.all())
|
||||||
|
|
||||||
|
|
||||||
def mark_attempt_in_progress__no_commit(
|
def mark_attempt_in_progress(
|
||||||
index_attempt: IndexAttempt,
|
index_attempt: IndexAttempt,
|
||||||
|
db_session: Session,
|
||||||
) -> None:
|
) -> None:
|
||||||
index_attempt.status = IndexingStatus.IN_PROGRESS
|
index_attempt.status = IndexingStatus.IN_PROGRESS
|
||||||
index_attempt.time_started = index_attempt.time_started or func.now() # type: ignore
|
index_attempt.time_started = index_attempt.time_started or func.now() # type: ignore
|
||||||
|
db_session.commit()
|
||||||
|
|
||||||
|
|
||||||
def mark_attempt_succeeded(
|
def mark_attempt_succeeded(
|
||||||
|
Reference in New Issue
Block a user