Skip to content

Commit

Permalink
Add better warning message on failed profile uploads (#1466)
Browse files Browse the repository at this point in the history
## Description

If upload fails with a non-200 status code return but doesn't encounter
an error, we don't log enough information to diagnose this scenario.

## Changes

- Adds a warning message to any profile uploads to WhyLabs that get back
a status code other than 200.

- [x] I have reviewed the [Guidelines for Contributing](CONTRIBUTING.md)
and the [Code of Conduct](CODE_OF_CONDUCT.md).
  • Loading branch information
jamie256 committed Feb 13, 2024
1 parent 919ca77 commit 0174829
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/whylogs/api/writer/whylabs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
import logging
import os
import pprint
import tempfile
from typing import IO, Any, Dict, List, Optional, Tuple, Union
from urllib.parse import urlparse
Expand Down Expand Up @@ -788,6 +789,11 @@ def _put_file(self, profile_file: IO[bytes], upload_url: str, dataset_timestamp:
f"Done uploading {self._org_id}/{self._dataset_id}/{dataset_timestamp} to "
f"{self.whylabs_api_endpoint} with API token ID: {self._key_refresher.key_id}"
)
else:
logger.warning(
f"response from file upload was not 200, instead got: {pprint.pformat(vars(response), indent=4)}"
)

return is_successful, response.reason

def _do_upload(
Expand Down

0 comments on commit 0174829

Please sign in to comment.