Skip to content

Commit

Permalink
Update default batch size to 1000 after stress testing
Browse files Browse the repository at this point in the history
  • Loading branch information
woodthom2 committed Dec 15, 2024
1 parent 2f85c05 commit 9a75aa6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/harmony/matching/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
import os


def get_batch_size(default=50):
# This has been tested on 16 GB RAM production server, 1000 seems a safe number (TW, 15 Dec 2024)
def get_batch_size(default=1000):
try:
batch_size = int(os.getenv("BATCH_SIZE", default))
return max(batch_size, 0)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_batching_in_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ def test_negative_batch_size(self):

@mock.patch.dict(os.environ, {}, clear=True)
def test_default_batch_size(self):
"""Test when BATCH_SIZE is not set, it defaults to 50."""
"""Test when BATCH_SIZE is not set, it defaults to 1000."""
items = [f"item{i}" for i in range(10)]
results = process_items_in_batches(items, mock_llm_function)
self.assertEqual(len(results), 10)

@mock.patch.dict(os.environ, {"BATCH_SIZE": "invalid"})
def test_invalid_batch_size(self):
"""Test when BATCH_SIZE is invalid, it defaults to 50."""
"""Test when BATCH_SIZE is invalid, it defaults to 1000."""
items = [f"item{i}" for i in range(10)]
results = process_items_in_batches(items, mock_llm_function)
self.assertEqual(len(results), 10)
Expand Down

0 comments on commit 9a75aa6

Please sign in to comment.