def load_progress(self): state = {} fname = os.path.join(self._results_path, "progress.json") if not os.path.exists(fname): return state = json.load(open(fname, "r")) self._fit_level = state.get("fit_level", self._fit_level) self._all_params = state.get("all_params", self._all_params) self._time_ctrl = TimeController.from_json(state.get("time_controller"))
def test_to_and_from_json(self): tc = TimeController( start_time=time.time(), total_time_limit=10, model_time_limit=None, steps=["simple_algorithms"], algorithms=["Baseline"], ) tc.log_time("1_Baseline", "Baseline", "simple_algorithms", 123.1) tc2 = TimeController.from_json(tc.to_json()) assert_almost_equal(tc2.step_spend("simple_algorithms"), 123.1) assert_almost_equal(tc2.model_spend("Baseline"), 123.1)