refractor : enhance workflow robustness and logging#27611
refractor : enhance workflow robustness and logging#27611mansirathee108-cloud wants to merge 1 commit intoopen-metadata:mainfrom
Conversation
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
| success = self.calculate_success() | ||
|
|
||
| if success is not None and self.workflow_config.successThreshold <= success < 100: |
There was a problem hiding this comment.
⚠️ Bug: calculate_success() returning None silently marks workflow as success
When calculate_success() returns None (all steps return None, or no steps), the success is not None guard at line 270 skips the partialSuccess check. The pipeline_state defaults to PipelineState.success (line 263), meaning a workflow where success could not be calculated is reported as fully successful rather than flagging an issue. The old code would have raised a TypeError (comparing None with <=), which would have been caught and set the state to failed. The new behavior is arguably wrong: an incalculable success metric should not default to success.
Suggested fix:
success = self.calculate_success()
if success is None:
logger.warning("Could not calculate success for the workflow")
elif self.workflow_config.successThreshold <= success < 100:
pipeline_state = PipelineState.partialSuccess
Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Gitar
Fixes N/A
I refactored the calculate_success method in the BaseWorkflow class.
I added a logger warning when there are no steps available to calculate success. Previously, the code would return None silently when encountering empty workflows or missing data, making it difficult to debug failures. This change ensures that if a workflow fails to calculate, there is a clear log entry explaining why.
Type of change:
[x] Improvement
Checklist:
[x] I have read the CONTRIBUTING document.
[ ] My PR title is Fixes :
[ ] I have commented on my code, particularly in hard-to-understand areas.
[ ] For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
Summary by Gitar
calculate_successto ignoreNonevalues and prevent potential errors inmeancalculations.start_timeinprint_statusto handle cases with empty steps.ingestionPipelineFQNfor better traceability.This will update automatically on new commits.