Skip to content

Commit

Permalink
add explicit logs for failed connection to source API
Browse files Browse the repository at this point in the history
  • Loading branch information
santteegt committed Nov 26, 2024
1 parent 441065b commit 0f24cc0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gaianet_rag_api_pipeline/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def create_endpoint_stream(
try:
stream_connector.check()
except Exception as error:
logger.error(f"FATAL error: manifest error when creating {stream_id} stream", exc_info=True)
logger.error(f"An error occurred when checking the source connection for {stream_id} stream", exc_info=True)
raise error

stream = pw.io.python.read(
Expand Down
38 changes: 27 additions & 11 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,33 @@ def all(
import gaianet_rag_api_pipeline.pipeline as rag_api_pipeline

# fetch data from endpoints as individual streams
stream_tables = input(
api_name=api_name,
settings=settings,
endpoints=endpoints,
source_manifest=source_manifest,
config=dict(
api_key=settings.api_key,
**api_parameters
),
force_full_refresh=full_refresh # NOTICE: CLI param
)
from airbyte.exceptions import AirbyteConnectorCheckFailedError
stream_tables = None
try:
stream_tables = input(
api_name=api_name,
settings=settings,
endpoints=endpoints,
source_manifest=source_manifest,
config=dict(
api_key=settings.api_key,
**api_parameters
),
force_full_refresh=full_refresh # NOTICE: CLI param
)
except AirbyteConnectorCheckFailedError as error:
click.echo(error, err=True)
click.echo(click.style(AirbyteConnectorCheckFailedError.guidance, fg="yellow"), err=True)
click.echo(
click.style(
f"Failed to establish a connection to the REST API. Check your API Key or manifest definition are correct",
fg="red"
),
err=True
)

if stream_tables is None:
return

# pipeline from streams to normalized|chunked|embeddings data
output_table = rag_api_pipeline.execute(
Expand Down

0 comments on commit 0f24cc0

Please sign in to comment.