Skip to content

Commit

Permalink
Verbose retry in whylabs writer, test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie256 committed Jan 10, 2025
1 parent d688907 commit e3c7e29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
16 changes: 0 additions & 16 deletions python/tests/api/writer/test_whylabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,22 +342,6 @@ def test_option_will_overwrite_defaults(self) -> None:
assert writer._whylabs_client._dataset_id == "new_dataset_id"
assert writer.key_id == "newkeynewk"

def test_api_key_prefers_parameter_over_env_var(self, results, caplog):
with pytest.raises(ValueError):
results.writer("whylabs").option(org_id="org_id", api_key="api_key_123.foo").write(dataset_id="dataset_id")

def test_writer_accepts_dest_param(self, results, caplog):
# TODO: inspect error or mock better to avoid network call and keep test focused.
with pytest.raises(ValueError):
results.writer("whylabs").option(api_key="bad_key_format").write(dataset_id="dataset_id", dest="tmp")

def test_write_response(self, results):
with pytest.raises(ValueError):
response = (
results.writer("whylabs").option(api_key="bad_key_format").write(dataset_id="dataset_id", dest="tmp")
)
assert response[0] is True

def test_changing_api_key_works(self) -> None:
#
# Defaults
Expand Down
4 changes: 3 additions & 1 deletion python/whylogs/api/writer/whylabs_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@


def _giveup(e) -> bool:
return (e.status not in _RETRY_CODES,) # type: ignore
result = e.status not in _RETRY_CODES
logger.warning(f"whylabs client communication error: {e}, retryable: {result}")
return result


def _get_column_names(x: Union[DatasetProfile, DatasetProfileView, SegmentedDatasetProfileView, ResultSet]) -> Set[str]:
Expand Down

0 comments on commit e3c7e29

Please sign in to comment.