Skip to content

Commit

Permalink
Update logging messages for JWT tokens (#12169)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmbrull authored Jun 27, 2023
1 parent 36dd1b6 commit c22c587
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
6 changes: 4 additions & 2 deletions ingestion/src/metadata/ingestion/api/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,10 @@ def _retrieve_service_connection_if_needed(self, service_type: ServiceType) -> N
)
else:
raise InvalidWorkflowJSONException(
"The serviceConnection is not informed and we cannot retrieve it from the API"
f" by searching for the service name [{service_name}]. Does this service exist in OpenMetadata?"
f"Error getting the service [{service_name}] from the API. If it exists in OpenMetadata,"
" make sure the ingestion-bot JWT token is valid and that the Workflow is deployed"
" with the latest one. If this error persists, recreate the JWT token and"
" redeploy the Workflow."
)
except InvalidWorkflowJSONException as exc:
raise exc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,9 @@ def test_connection_steps(

if not test_connection_definition:
raise SourceConnectionException(
f"Test connection definition for {test_connection_def_fqn} not found please review the Server Configuration"
f" of the Workflow configuration. Check that the Security Configuration has been set up correctly."
f"Test connection definition for {test_connection_def_fqn} not found! Make sure the"
" ingestion-bot JWT token is valid and that the Workflow is deployed with the latest one."
" If this error persists, recreate the JWT token and redeploy the Workflow."
)

steps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ class GetServiceException(Exception):

def __init__(self, service_type: str, service_name: str):
self.message = (
f"Could not get service from type {service_type}. This means that the"
f"Could not get service from type [{service_type}]. This means that the"
" OpenMetadata client running in the Airflow host had issues getting"
f" the service {service_name}. Validate your ingestion-bot authentication."
f" the service [{service_name}]. Make sure the ingestion-bot JWT token"
" is valid and that the Workflow is deployed with the latest one. If this error"
" persists, recreate the JWT token and redeploy the Workflow."
)
super().__init__(self.message)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from openmetadata_managed_apis.utils.logger import set_operator_logger
from openmetadata_managed_apis.workflows.ingestion.common import (
ClientInitializationError,
GetServiceException,
build_dag,
)
from openmetadata_managed_apis.workflows.ingestion.elasticsearch_sink import (
Expand Down Expand Up @@ -83,9 +84,7 @@ def build_data_insight_workflow_config(
)

if not openmetadata_service:
raise ValueError(
"Could not retrieve the OpenMetadata service! This should not happen."
)
raise GetServiceException(service_type="metadata", service_name="OpenMetadata")

sink = build_elasticsearch_sink(
openmetadata_service.connection.config, ingestion_pipeline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from airflow import DAG
from openmetadata_managed_apis.workflows.ingestion.common import (
ClientInitializationError,
GetServiceException,
build_dag,
metadata_ingestion_workflow,
)
Expand Down Expand Up @@ -56,9 +57,7 @@ def build_es_reindex_workflow_config(
entity=MetadataService, fqn=ingestion_pipeline.service.fullyQualifiedName
)
if not openmetadata_service:
raise ValueError(
"Could not retrieve the OpenMetadata service! This should not happen."
)
raise GetServiceException(service_type="metadata", service_name="OpenMetadata")

sink = Sink(type="metadata-rest", config={})

Expand Down

0 comments on commit c22c587

Please sign in to comment.