class TestProcess(AiidaTestCase): def setUp(self): super(TestProcess, self).setUp() self.assertEquals(len(util.ProcessStack.stack()), 0) self.assertEquals(len(plum.process_monitor.MONITOR.get_pids()), 0) self.persistence = Persistence(running_directory=tempfile.mkdtemp()) def tearDown(self): super(TestProcess, self).tearDown() self.assertEquals(len(util.ProcessStack.stack()), 0) self.assertEquals(len(plum.process_monitor.MONITOR.get_pids()), 0) def test_save_load(self): dp = DummyProcess.new_instance() # Create a bundle b = self.persistence.create_bundle(dp) # Save a bundle and reload it self.persistence.save(dp) b2 = self.persistence.load_checkpoint(dp.pid) # Now check that they are equal self.assertEqual(b, b2) dp.run_until_complete()
def test_seal(self): rinfo = run(DummyProcess, _return_pid=True)[1] self.assertTrue(load_node(pk=rinfo).is_sealed) storedir = tempfile.mkdtemp() storage = Persistence.create_from_basedir(storedir) rinfo = submit(DummyProcess, _jobs_store=storage) n = load_node(pk=rinfo.pid) self.assertFalse(n.is_sealed) dp = DummyProcess.create_from(storage.load_checkpoint(rinfo.pid)) dp.run_until_complete() self.assertTrue(n.is_sealed) shutil.rmtree(storedir)
def setUp(self): super(TestRun, self).setUp() self.assertEquals(len(plum.process_monitor.MONITOR.get_pids()), 0) self.storedir = tempfile.mkdtemp() self.storage = Persistence.create_from_basedir(self.storedir)
def setUp(self): super(TestProcess, self).setUp() self.assertEquals(len(util.ProcessStack.stack()), 0) self.assertEquals(len(plum.process_monitor.MONITOR.get_pids()), 0) self.persistence = Persistence(running_directory=tempfile.mkdtemp())
def setUp(self): self.assertEquals(len(util.ProcessStack.stack()), 0) self.storedir = tempfile.mkdtemp() self.storage = Persistence.create_from_basedir(self.storedir)