Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/common/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ def test_multinode_vllm_requires_full_node_occupancy(self):
with self.assertRaisesRegex(ValueError, "to be a multiple of"):
config.check_and_update()

def test_sync_interval_overrides_must_be_positive(self):
for field in ("explorer_sync_interval", "trainer_sync_interval"):
with self.subTest(field=field):
config = get_template_config()
config.synchronizer.sync_interval = 4
setattr(config.synchronizer, field, 0)

with self.assertRaisesRegex(AssertionError, f"`{field}` must be positive"):
config.check_and_update()

def test_load_default_config(self):
config = get_template_config()
config.buffer.batch_size = 8
Expand Down
6 changes: 6 additions & 0 deletions trinity/common/config_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,12 @@ def validate(self, config: Config) -> None:
config.synchronizer, "explorer_sync_interval", config.synchronizer.sync_interval
)
set_if_none(config.synchronizer, "trainer_sync_interval", config.synchronizer.sync_interval)
assert (
config.synchronizer.explorer_sync_interval > 0
), "`explorer_sync_interval` must be positive."
assert (
config.synchronizer.trainer_sync_interval > 0
), "`trainer_sync_interval` must be positive."


class IntervalConfigValidator(ConfigValidator):
Expand Down