MCPcopy Create free account
hub / github.com/apple/axlearn / test_context

Method test_context

axlearn/common/checkpointer_test.py:923–938  ·  view source on GitHub ↗
(self, checkpointer_cls)

Source from the content-addressed store, hash-verified

921 ckpt.stop()
922 self.assertIsNone(ckpt._gc_thread)
923
924 @parameterized.parameters([Checkpointer, OrbaxCheckpointer])
925 def test_context(self, checkpointer_cls):
926 ckpt = _checkpointer_config(checkpointer_cls).instantiate(parent=None)
927
928 if checkpointer_cls is Checkpointer:
929 with ckpt:
930 self.assertIsNotNone(ckpt._gc_thread)
931 self.assertIsNone(ckpt._gc_thread)
932
933 # Nested contexts are not supported.
934 with ckpt:
935 with self.assertRaisesRegex(ValueError, "Already in a context"):
936 with ckpt:
937 pass
938
939 if checkpointer_cls is Checkpointer:
940 self.assertIsNone(ckpt._gc_thread)
941

Callers

nothing calls this directly

Calls 2

_checkpointer_configFunction · 0.70
instantiateMethod · 0.45

Tested by

no test coverage detected