mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-05-18 15:50:13 +02:00
Support not pausing connectors on initialization failure
This commit is contained in:
parent
1c12ab31f9
commit
8eb4320f76
@ -11,6 +11,7 @@ from onyx.background.indexing.checkpointing import get_time_windows_for_index_at
|
|||||||
from onyx.background.indexing.tracer import OnyxTracer
|
from onyx.background.indexing.tracer import OnyxTracer
|
||||||
from onyx.configs.app_configs import INDEXING_SIZE_WARNING_THRESHOLD
|
from onyx.configs.app_configs import INDEXING_SIZE_WARNING_THRESHOLD
|
||||||
from onyx.configs.app_configs import INDEXING_TRACER_INTERVAL
|
from onyx.configs.app_configs import INDEXING_TRACER_INTERVAL
|
||||||
|
from onyx.configs.app_configs import LEAVE_CONNECTOR_ACTIVE_ON_INITIALIZATION_FAILURE
|
||||||
from onyx.configs.app_configs import POLL_CONNECTOR_OFFSET
|
from onyx.configs.app_configs import POLL_CONNECTOR_OFFSET
|
||||||
from onyx.configs.constants import DocumentSource
|
from onyx.configs.constants import DocumentSource
|
||||||
from onyx.configs.constants import MilestoneRecordType
|
from onyx.configs.constants import MilestoneRecordType
|
||||||
@ -55,6 +56,7 @@ def _get_connector_runner(
|
|||||||
start_time: datetime,
|
start_time: datetime,
|
||||||
end_time: datetime,
|
end_time: datetime,
|
||||||
tenant_id: str | None,
|
tenant_id: str | None,
|
||||||
|
leave_connector_active: bool = LEAVE_CONNECTOR_ACTIVE_ON_INITIALIZATION_FAILURE,
|
||||||
) -> ConnectorRunner:
|
) -> ConnectorRunner:
|
||||||
"""
|
"""
|
||||||
NOTE: `start_time` and `end_time` are only used for poll connectors
|
NOTE: `start_time` and `end_time` are only used for poll connectors
|
||||||
@ -76,9 +78,14 @@ def _get_connector_runner(
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(f"Unable to instantiate connector due to {e}")
|
logger.exception(f"Unable to instantiate connector due to {e}")
|
||||||
# since we failed to even instantiate the connector, we pause the CCPair since
|
|
||||||
# it will never succeed
|
|
||||||
|
|
||||||
|
# since we failed to even instantiate the connector, we pause the CCPair since
|
||||||
|
# it will never succeed. Sometimes there are cases where the connector will
|
||||||
|
# intermittently fail to initialize in which case we should pass in
|
||||||
|
# leave_connector_active=True to allow it to continue.
|
||||||
|
# For example, if there is nightly maintenance on a Confluence Server instance,
|
||||||
|
# the connector will fail to initialize every night.
|
||||||
|
if not leave_connector_active:
|
||||||
cc_pair = get_connector_credential_pair_from_id(
|
cc_pair = get_connector_credential_pair_from_id(
|
||||||
db_session=db_session,
|
db_session=db_session,
|
||||||
cc_pair_id=attempt.connector_credential_pair.id,
|
cc_pair_id=attempt.connector_credential_pair.id,
|
||||||
|
@ -409,6 +409,11 @@ EXPERIMENTAL_CHECKPOINTING_ENABLED = (
|
|||||||
os.environ.get("EXPERIMENTAL_CHECKPOINTING_ENABLED", "").lower() == "true"
|
os.environ.get("EXPERIMENTAL_CHECKPOINTING_ENABLED", "").lower() == "true"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
LEAVE_CONNECTOR_ACTIVE_ON_INITIALIZATION_FAILURE = (
|
||||||
|
os.environ.get("LEAVE_CONNECTOR_ACTIVE_ON_INITIALIZATION_FAILURE", "").lower()
|
||||||
|
== "true"
|
||||||
|
)
|
||||||
|
|
||||||
PRUNING_DISABLED = -1
|
PRUNING_DISABLED = -1
|
||||||
DEFAULT_PRUNING_FREQ = 60 * 60 * 24 # Once a day
|
DEFAULT_PRUNING_FREQ = 60 * 60 * 24 # Once a day
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user