Data Source Connectors: Propagate error and misc - #1284
Conversation
| return settings.digitize.connector.encryption_key_path | ||
|
|
||
|
|
||
| async def _probe_connector_credentials( |
There was a problem hiding this comment.
This is a makeshift solution to async update the DB (for failed creds).
This still does not provide direct validation to the end-user when a PUT/POST on connector is done
There was a problem hiding this comment.
I am not fully convinced this is really needed, because in case of POST the immediate sync operation will do this and report this failure anyway.
And for PUT this would be done in next sync which would be 5 mins later.
But somehow after seeing this, I m thinking why not trigger the sync immediately after PUT as well like POST, if someone updates the connector, I feel they would like the sync to happen immediately wdyt?
If we do that, this probing is not needed.
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
72685cb to
22e9438
Compare
| return settings.digitize.connector.encryption_key_path | ||
|
|
||
|
|
||
| async def _probe_connector_credentials( |
There was a problem hiding this comment.
I am not fully convinced this is really needed, because in case of POST the immediate sync operation will do this and report this failure anyway.
And for PUT this would be done in next sync which would be 5 mins later.
But somehow after seeing this, I m thinking why not trigger the sync immediately after PUT as well like POST, if someone updates the connector, I feel they would like the sync to happen immediately wdyt?
If we do that, this probing is not needed.
| f"Scheduler registration failed for {connector_id!r}: {sched_exc}", | ||
| exc_info=True, | ||
| ) | ||
| raise |
There was a problem hiding this comment.
These kind of empty raise statements needs to be updated with a prefix message saying on what operation and situation, this specific exception is raised. Please take care of all the plain raise statements wrt to the connector changes added.
There was a problem hiding this comment.
This applies to other endpoint handlers as well.
Also please ensure to log them before raising
There was a problem hiding this comment.
@manalilatkar @Niharika0306
I think similar behaviour need to be taken care in extract and translate service as well.
Please see whether you can address them in your upcoming PRs
| Inherits from str so values can be compared directly against DB strings. | ||
| """ | ||
|
|
||
| CREDENTIAL_ERROR_MSG = "Authentication failed: unable to connect with the provided credentials" |
There was a problem hiding this comment.
this should be used on auth issues faced during sync operation as well
| total_files INTEGER NOT NULL DEFAULT 0, | ||
| new_files INTEGER NOT NULL DEFAULT 0, | ||
| removed_files INTEGER NOT NULL DEFAULT 0, | ||
| failed_files INTEGER NOT NULL DEFAULT 0, |
There was a problem hiding this comment.
can you help me remember why are we removing failed_files?
| if total_files is not None: | ||
| values["total_files"] = total_files | ||
| if error is not None: | ||
| if error is not _UNSET: |
There was a problem hiding this comment.
can you not simply do this by removing this if?
what ever is passed for error arg needs to be set as is.
So when an error exists currently, if its cleared in next run, the error passed here would be none, which can be set as is. wdyt?
dharaneeshvrd
left a comment
There was a problem hiding this comment.
It would be great, if you can produce possible error cases and how the connector and sync log's error fields looks like.
| @@ -129,7 +180,7 @@ async def create_connector(body: ConnectorCreateRequest): | |||
| # id or name already exists | |||
There was a problem hiding this comment.
I think we also discussed to log the exceptions before raising, can you please take care in all the occurrences?
| if not found: | ||
| return False | ||
| db_manager.update_connector_after_sync(connector_id, status=status, last_sync_at=now) | ||
| db_manager.update_connector_after_sync( |
There was a problem hiding this comment.
It's better to rephrase the error message of a last sync when we update it on connector to depict that it s from the last sync.
| if batch_failed: | ||
| raise RuntimeError( | ||
| f"One or more batches failed to ingest for connector {connector_id!r}; " | ||
| "connector marked as out of sync" |
There was a problem hiding this comment.
This is going to be a user facing error message, can we please rephrase accordingly?
Something like: One or more documents failed to sync. See more details on digitize jobs <f"Connector-{connector_name}-{sync_seq}-*>
| f"Scheduler registration failed for {connector_id!r}: {sched_exc}", | ||
| exc_info=True, | ||
| ) | ||
| raise |
There was a problem hiding this comment.
This applies to other endpoint handlers as well.
Also please ensure to log them before raising
--This error is never overwritten by a sync tick failure error message (highlighting root cause being wrong creds)
--Only correct creds via another PUT request can clear the previous auth failure message