mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-09 09:38:22 +00:00
Added logic to handle missing attributes from the context (#7696)
This commit is contained in:
parent
c4880d6c0e
commit
bdf85d0eae
@ -102,7 +102,25 @@ class TopologyRunnerMixin(Generic[C]):
|
||||
if node.post_process:
|
||||
logger.debug(f"Post processing node {node}")
|
||||
for process in node.post_process:
|
||||
node_post_process = getattr(self, process)
|
||||
try:
|
||||
yield from self.check_context_and_handle(process)
|
||||
except Exception as exc:
|
||||
logger.debug(traceback.format_exc())
|
||||
logger.warning(
|
||||
f"Could not run Post Process `{process}` from Topology Runner -- {exc}"
|
||||
)
|
||||
|
||||
def check_context_and_handle(self, post_process: str):
|
||||
"""Based on the post_process step, check context and
|
||||
evaluate if we can run it based on available class attributes
|
||||
|
||||
Args:
|
||||
post_process: the name of the post_process step
|
||||
"""
|
||||
if post_process == "mark_tables_as_deleted" and not self.context.database:
|
||||
raise ValueError("No Database found in `self.context`")
|
||||
|
||||
node_post_process = getattr(self, post_process)
|
||||
for entity_request in node_post_process():
|
||||
yield entity_request
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user