Skip to content

fix: Add error handling to write_predictions_to_csv - #18

Draft
exploring-curiosity wants to merge 1 commit into
mainfrom
fix/add-error-handling-to-write-predictions--17
Draft

exploring-curiosity wants to merge 1 commit into
mainfrom
fix/add-error-handling-to-write-predictions--17

Conversation

@exploring-curiosity

Copy link
Copy Markdown
Owner

Closes #17

What changed

The function writes predictions to CSV without any validation or error handling. If predictions is None, empty, or malformed, it will crash or produce a broken file. Add input validation (check predictions is a non-empty list of tuples) and wrap file I/O in try/except to handle permission/disk errors gracefully.

Approach

Locate the write_predictions_to_csv function in the codebase (likely in a Python file under model_serving or data_pipeline). Add input validation to ensure predictions is a non-empty list of tuples, raising a ValueError if invalid. Wrap the CSV writing logic in a try/except block to catch and handle IOError/OSError (e.g., permission denied, disk full) with a descriptive error message.
Files: model_serving/BirdClassification/app.py

Verification

Tier Result Detail
T0 Diff sanity pass internal: diff sanity
T1 Static skipped no notebooks changed
T2 Smoke skipped no build step configured
T3 Tests skipped pre-existing failure, not introduced by this change
T4 Runtime skipped no runtime check configured

Why this is a draft

nothing beyond diff sanity was verified - refusing to merge unverified work

Note: T1 (no notebooks changed), T2 (no build step configured), T3 (pre-existing failure, not introduced by this change), T4 (no runtime check configured) - these were not verified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add error handling to write_predictions_to_csv

1 participant