Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal change #738

Merged
merged 1 commit into from
Feb 20, 2025
Merged
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
4 changes: 2 additions & 2 deletions grain/_src/python/dataset/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def _running_in_colab() -> bool:
return "google.colab" in sys.modules


class _NoopStats(Stats):
class _DefaultStats(Stats):
"""Default implementation for statistics collection that does nothing."""

@contextlib.contextmanager
Expand Down Expand Up @@ -729,4 +729,4 @@ def make_stats(
return _ExecutionStats(config, parents=parents)
if vis_output_dir is not None:
return _VisualizationStats(config, parents=parents)
return _NoopStats(config, parents=parents)
return _DefaultStats(config, parents=parents)
8 changes: 4 additions & 4 deletions grain/_src/python/dataset/stats_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ def test_basic(self):
self.assertEqual(timer.value(), 0)


class NoopStatsTest(absltest.TestCase):
class DefaultStatsTest(absltest.TestCase):

def test_assert_is_noop(self):
def test_assert_is_default(self):
s = _make_stats_tree(stats.make_stats)
self.assertIsInstance(s, stats._NoopStats)
self.assertIsInstance(s, stats._DefaultStats)

def test_record_self_time(self):
s = _make_stats_tree(stats.make_stats)
Expand Down Expand Up @@ -572,7 +572,7 @@ def test_picklable(self):
@flagsaver.flagsaver(grain_py_dataset_visualization_output_dir=None)
def test_dataset_visualization_with_output_dir_none(self):
s = stats.make_stats(stats.StatsConfig(name="test_stats"), ())
self.assertIsInstance(s, stats._NoopStats)
self.assertIsInstance(s, stats._DefaultStats)


if __name__ == "__main__":
Expand Down