def test_dump(self):
        ps = ParameterSet.find_or_create((0, 1, 2, 3))
        runs = ps.create_runs_upto(3)
        runs[0].store_result([1.0, 2.0, 3.0], 0, 3, 111, 222)
        ps = ParameterSet.find_or_create((4, 5, 6, 7))
        self.assertEqual(len(self.t.ps_table), 2)
        runs = ps.create_runs_upto(3)
        runs[2].store_result([1.0, 2.0, 3.0], 0, 3, 111, 222)
        self.assertEqual(len(self.t.tasks_table), 6)

        path = self.dump_path
        Tables.dump(path)
        self.assertTrue(os.path.exists(path))
        self.t.clear()
        Tables.load(path)
        self.t = Tables.get()
        self.assertEqual(len(self.t.ps_table), 2)
        self.assertEqual(len(self.t.tasks_table), 6)
        self.assertTrue(self.t.tasks_table[0].is_finished())
        self.assertTrue(self.t.tasks_table[5].is_finished())
Ejemplo n.º 2
0
    def test_dump(self):
        sim = Simulator.create("~/my_simulator")
        ps = sim.find_or_create_parameter_set({"p1": 0, "p2": 1})
        runs = ps.create_runs_upto(3)
        runs[0]._store_result([1.0, 2.0, 3.0], 0, 3, 111, 222)
        ps2 = sim.find_or_create_parameter_set({"p1": 2, "p2": 3})
        self.assertEqual(len(ParameterSet.all()), 2)
        runs = ps2.create_runs_upto(3)
        runs[2]._store_result([1.0, 2.0, 3.0], 0, 3, 111, 222)
        self.assertEqual(len(self.t.tasks_table), 6)

        path = self.dump_path
        Tables.dump(path)
        self.assertTrue(os.path.exists(path))
        self.t.clear()
        Tables.load(path)
        self.t = Tables.get()
        self.assertEqual(len(ParameterSet.all()), 2)
        self.assertEqual(len(Task.all()), 6)
        self.assertTrue(Task.find(0).is_finished())
        self.assertTrue(Task.find(5).is_finished())
Ejemplo n.º 3
0
 def setUp(self):
     self.t = Tables.get()
     self.t.clear()
Ejemplo n.º 4
0
 def setUp(self):
     self.t = Tables.get()
     self.t.clear()
     self.sim = Simulator.create("echo")
Ejemplo n.º 5
0
 def setUp(self):
     self.t = Tables.get()
     self.t.clear()
     self.sim = Simulator.create("~/my_simulator")
     self.ps = self.sim.find_or_create_parameter_set({"p1": 1})
 def setUp(self):
     self.t = Tables.get()
     self.t.clear()
     self.dump_path = "test.pkl"
     self._clean()