Skip to content

Commit 0174829

Browse files
authored
Add better warning message on failed profile uploads (#1466)
## 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).
1 parent 919ca77 commit 0174829

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

python/whylogs/api/writer/whylabs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import datetime
22
import logging
33
import os
4+
import pprint
45
import tempfile
56
from typing import IO, Any, Dict, List, Optional, Tuple, Union
67
from urllib.parse import urlparse
@@ -788,6 +789,11 @@ def _put_file(self, profile_file: IO[bytes], upload_url: str, dataset_timestamp:
788789
f"Done uploading {self._org_id}/{self._dataset_id}/{dataset_timestamp} to "
789790
f"{self.whylabs_api_endpoint} with API token ID: {self._key_refresher.key_id}"
790791
)
792+
else:
793+
logger.warning(
794+
f"response from file upload was not 200, instead got: {pprint.pformat(vars(response), indent=4)}"
795+
)
796+
791797
return is_successful, response.reason
792798

793799
def _do_upload(

0 commit comments

Comments
 (0)