fix for Nonetype: None in the ERROR logs #400
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What: Observed
NoneType: None
in preprocess and inference UDFs. Example:2024-07-02 03:44:26,863 - 139658258261696 - ERROR - uuid='2a4ae443-15ab-496c-95ba-83ebc380df59' event='Artifact model not loaded!' udf_vertex='inference' config_id='serviceTraceMetrics' pipeline_id='request' metadata={'adjust_with_impact': {'timestamp': 1719891659999, 'true': 0}, 'mean_of_features': {'true': 0.23076923076923078}, 'numalogic_opex_tags': {'source': 'numalogic_metrics'}, 'tags': {'assetAlias': 'Intuit.cto.iam.iux', 'assetId': '3172803529671879897', 'env': 'prd', 'opname': 'GET /fe_logger/.env.dev.local'}} exc_info=True level='error' timestamp='2024-07-02T03:44:26.863733Z' NoneType: None
Why: logger.exception is usually called from the
except
block. Not logging from the except block, means there is no execution_info provided. As a result, sys_exec.info() call from logging stdlib return (None, None, None) for type, value and stackTrace of exception.How: Either write
logger.exception
inside the except block or uselogger.error
instead.