Example #1
0
    def test_save_load_experiment(self):
        exp = get_experiment()
        init_test_engine_and_session_factory()
        db_settings = DBSettings(url="sqlite://")
        save_experiment(exp, db_settings)
        load_experiment(exp.name, db_settings)

        simple_experiment = get_simple_experiment()
        save_experiment(simple_experiment, db_settings)
        with self.assertRaisesRegex(ValueError, "Service API only"):
            load_experiment(simple_experiment.name, db_settings)
Example #2
0
    def test_save_load_new_trial(self):
        exp = load_experiment(self.exp.name, self.db_settings)
        trial = exp.new_trial()
        save_new_trial(exp, trial, self.db_settings)
        exp = load_experiment(self.exp.name, self.db_settings)
        self.assertEqual(len(exp.trials), 1)
        self.assertEqual(exp.trials[0].status, TrialStatus.CANDIDATE)

        trial.mark_running(True)
        save_updated_trial(exp, trial, self.db_settings)
        exp = load_experiment(self.exp.name, self.db_settings)
        self.assertEqual(exp.trials[0].status, TrialStatus.RUNNING)
Example #3
0
    def test_save_load_experiment(self):
        exp = get_experiment()
        init_test_engine_and_session_factory(force_init=True)
        db_settings = DBSettings(
            encoder=Encoder(config=SQAConfig()),
            decoder=Decoder(config=SQAConfig()),
            creator=None,
        )
        save_experiment(exp, db_settings)
        load_experiment(exp.name, db_settings)

        simple_experiment = get_simple_experiment()
        save_experiment(simple_experiment, db_settings)
        with self.assertRaisesRegex(ValueError, "Service API only"):
            load_experiment(simple_experiment.name, db_settings)
Example #4
0
 def test_save_load_experiment(self):
     load_experiment(self.exp.name, self.db_settings)
     simple_experiment = get_simple_experiment()
     save_experiment(simple_experiment, self.db_settings)
     with self.assertRaisesRegex(ValueError, "Service API only"):
         load_experiment(simple_experiment.name, self.db_settings)