mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-02 19:48:17 +00:00
MINOR: Skip source hash generation for service (#15516)
This commit is contained in:
parent
2582ec60f2
commit
658526e02c
@ -265,11 +265,12 @@ class TopologyRunnerMixin(Generic[C]):
|
||||
if entity:
|
||||
same_fingerprint = True
|
||||
|
||||
create_entity_request_hash = generate_source_hash(
|
||||
create_request=entity_request.right,
|
||||
)
|
||||
create_entity_request_hash = None
|
||||
|
||||
if hasattr(entity_request.right, "sourceHash"):
|
||||
create_entity_request_hash = generate_source_hash(
|
||||
create_request=entity_request.right,
|
||||
)
|
||||
entity_request.right.sourceHash = create_entity_request_hash
|
||||
|
||||
if entity is None and stage.use_cache:
|
||||
|
||||
@ -14,9 +14,14 @@ Source hash utils module
|
||||
"""
|
||||
|
||||
import hashlib
|
||||
import traceback
|
||||
from typing import Dict, Optional
|
||||
|
||||
from metadata.ingestion.ometa.ometa_api import C
|
||||
from metadata.utils.logger import utils_logger
|
||||
|
||||
logger = utils_logger()
|
||||
|
||||
|
||||
SOURCE_HASH_EXCLUDE_FIELDS = {
|
||||
"sourceHash": True,
|
||||
@ -25,19 +30,24 @@ SOURCE_HASH_EXCLUDE_FIELDS = {
|
||||
|
||||
def generate_source_hash(
|
||||
create_request: C, exclude_fields: Optional[Dict] = None
|
||||
) -> str:
|
||||
) -> Optional[str]:
|
||||
"""
|
||||
Given a create_request model convert it to json string and generate a hash value
|
||||
"""
|
||||
try:
|
||||
# We always want to exclude the sourceHash when generating the fingerprint
|
||||
exclude_fields = (
|
||||
SOURCE_HASH_EXCLUDE_FIELDS.update(exclude_fields)
|
||||
if exclude_fields
|
||||
else SOURCE_HASH_EXCLUDE_FIELDS
|
||||
)
|
||||
|
||||
# We always want to exclude the sourceHash when generating the fingerprint
|
||||
exclude_fields = (
|
||||
SOURCE_HASH_EXCLUDE_FIELDS.update(exclude_fields)
|
||||
if exclude_fields
|
||||
else SOURCE_HASH_EXCLUDE_FIELDS
|
||||
)
|
||||
create_request_json = create_request.json(exclude=exclude_fields)
|
||||
|
||||
create_request_json = create_request.json(exclude=exclude_fields)
|
||||
json_bytes = create_request_json.encode("utf-8")
|
||||
return hashlib.md5(json_bytes).hexdigest()
|
||||
|
||||
json_bytes = create_request_json.encode("utf-8")
|
||||
return hashlib.md5(json_bytes).hexdigest()
|
||||
except Exception as exc:
|
||||
logger.warning(f"Failed to generate source hash due to - {exc}")
|
||||
logger.debug(traceback.format_exc())
|
||||
return None
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user