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

Method test_stop

axlearn/common/checkpointer_test.py:901–920  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

899 check_state_structure(
900 actual, target, validation=CheckpointValidationType.CONTAINS_STATE_UP_TO_DTYPE
901 )
902
903 def test_stop(self):
904 mesh_shape = (1, 1)
905 if not test_utils.is_supported_mesh_shape(mesh_shape):
906 return
907 cfg = _checkpointer_config()
908 ckpt: Checkpointer = cfg.instantiate(parent=None)
909 # GC thread is not started until the start_gc_thread() call.
910 self.assertIsNone(ckpt._gc_thread)
911
912 ckpt._start_gc_thread()
913 self.assertIsNotNone(ckpt._gc_thread)
914 ckpt.stop()
915 # GC thread is terminated after stop() returns.
916 self.assertIsNone(ckpt._gc_thread)
917
918 # We can start gc and stop again.
919 ckpt._start_gc_thread()
920 self.assertIsNotNone(ckpt._gc_thread)
921 ckpt.stop()
922 self.assertIsNone(ckpt._gc_thread)
923

Callers

nothing calls this directly

Calls 4

_start_gc_threadMethod · 0.80
_checkpointer_configFunction · 0.70
instantiateMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected