Skip to content

Commit

Permalink
convert to using logging.warning
Browse files Browse the repository at this point in the history
  • Loading branch information
cwharris committed Aug 23, 2024
1 parent 11118c1 commit cb13abb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python/morpheus/morpheus/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def model_max_batch_size(self, value: int):

def _validate_config(self):
if self._pipeline_batch_size < self._model_max_batch_size:
warnings.warn(
logging.warning(
"Config has `pipeline_batch_size < model_max_batch_size` which effectively limits `model_max_batch_size`. This may reduce performance."
)

Expand Down
15 changes: 11 additions & 4 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import json
import os
from unittest import mock
import logging

import pytest

Expand Down Expand Up @@ -108,15 +109,21 @@ def test_to_string(config):
assert isinstance(json.loads(conf_str), dict)


def test_warning_model_batch_size_less_than_pipeline_batch_size():
def test_warning_model_batch_size_less_than_pipeline_batch_size(caplog: pytest.LogCaptureFixture):
config = morpheus.config.Config()
config.pipeline_batch_size = 256
with pytest.warns():
with caplog.at_level(logging.WARNING):
config.model_max_batch_size = 257
assert len(caplog.records) == 1
import re
assert re.match(".*pipeline_batch_size < model_max_batch_size.*", caplog.records[0].message) is not None


def test_warning_pipeline_batch_size_less_than_model_batch_size():
def test_warning_pipeline_batch_size_less_than_model_batch_size(caplog: pytest.LogCaptureFixture):
config = morpheus.config.Config()
config.model_max_batch_size = 8
with pytest.warns():
with caplog.at_level(logging.WARNING):
config.pipeline_batch_size = 7
assert len(caplog.records) == 1
import re
assert re.match(".*pipeline_batch_size < model_max_batch_size.*", caplog.records[0].message) is not None

0 comments on commit cb13abb

Please sign in to comment.