def test_log_empty_str(self): PARAM_NAME = "new param" fs = FileStore(self.test_root) run_id = self.exp_data[FileStore.DEFAULT_EXPERIMENT_ID]["runs"][0] fs.log_param(run_id, Param(PARAM_NAME, "")) run = fs.get_run(run_id) assert run.data.params[PARAM_NAME] == ""
def test_weird_param_names(self): WEIRD_PARAM_NAME = "this is/a weird/but valid param" fs = FileStore(self.test_root) run_id = self.exp_data[FileStore.DEFAULT_EXPERIMENT_ID]["runs"][0] fs.log_param(run_id, Param(WEIRD_PARAM_NAME, "Value")) run = fs.get_run(run_id) assert run.data.params[WEIRD_PARAM_NAME] == "Value"
def test_weird_param_names(self): WEIRD_PARAM_NAME = "this is/a weird/but valid param" fs = FileStore(self.test_root) run_uuid = self.exp_data[0]["runs"][0] fs.log_param(run_uuid, Param(WEIRD_PARAM_NAME, "Value")) param = fs.get_param(run_uuid, WEIRD_PARAM_NAME) assert param.key == WEIRD_PARAM_NAME assert param.value == "Value"
def test_weird_param_names(self): WEIRD_PARAM_NAME = "this is/a weird/but valid param" fs = FileStore(self.test_root) run_uuid = self.exp_data[0]["runs"][0] fs.log_param(run_uuid, Param(WEIRD_PARAM_NAME, "Value")) run = fs.get_run(run_uuid) my_params = [p for p in run.data.params if p.key == WEIRD_PARAM_NAME] assert len(my_params) == 1 param = my_params[0] assert param.key == WEIRD_PARAM_NAME assert param.value == "Value"
def test_log_empty_str(self): PARAM_NAME = "new param" fs = FileStore(self.test_root) run_uuid = self.exp_data[0]["runs"][0] fs.log_param(run_uuid, Param(PARAM_NAME, "")) run = fs.get_run(run_uuid) my_params = [p for p in run.data.params if p.key == PARAM_NAME] assert len(my_params) == 1 param = my_params[0] assert param.key == PARAM_NAME assert param.value == ""
def test_set_deleted_run(self): """ Setting metrics/tags/params/updating run info should not be allowed on deleted runs. """ fs = FileStore(self.test_root) exp_id = self.experiments[random_int(0, len(self.experiments) - 1)] run_id = self.exp_data[exp_id]['runs'][0] fs.delete_run(run_id) assert fs.get_run(run_id).info.lifecycle_stage == LifecycleStage.DELETED with pytest.raises(MlflowException): fs.set_tag(run_id, RunTag('a', 'b')) with pytest.raises(MlflowException): fs.log_metric(run_id, Metric('a', 0.0, timestamp=0)) with pytest.raises(MlflowException): fs.log_param(run_id, Param('a', 'b'))