From 83e61033a8384960c4de7573a59918cf18c2d991 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Wed, 4 Sep 2019 14:09:37 +0100 Subject: [PATCH] Fix run --warm missing argument and integration test --- src/smif/controller/modelrun.py | 2 +- tests/cli/test_cli.py | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/smif/controller/modelrun.py b/src/smif/controller/modelrun.py index 4a383736f..6e29d6ab3 100644 --- a/src/smif/controller/modelrun.py +++ b/src/smif/controller/modelrun.py @@ -215,7 +215,7 @@ def solve_model(self, model_run, store): if self.warm_start: # filter graph to exclude already-available results complete_jobs = store.completed_jobs(model_run.name) - job_graph = self.filter_job_graph(job_graph, complete_jobs) + job_graph = self.filter_job_graph(model_run.name, job_graph, complete_jobs) job_id, err = job_scheduler.add(job_graph) self.logger.debug("Running job %s", job_id) diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.py index 89e84d456..2039cabf1 100644 --- a/tests/cli/test_cli.py +++ b/tests/cli/test_cli.py @@ -79,13 +79,22 @@ def test_fixture_single_run_warm(tmp_sample_project): """Test running the (default) single_run fixture with warm setting enabled """ config_dir = tmp_sample_project - output = subprocess.run(["smif", "run", "-v", "-w", "-d", config_dir, - "energy_central"], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - print(output.stdout.decode("utf-8")) - print(output.stderr.decode("utf-8"), file=sys.stderr) - assert "Running energy_central" in str(output.stderr) - assert "Model run 'energy_central' complete" in str(output.stdout) + cold_output = subprocess.run( + ["smif", "run", "-v", "-d", config_dir, "energy_central"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + print(cold_output.stdout.decode("utf-8")) + print(cold_output.stderr.decode("utf-8"), file=sys.stderr) + + warm_output = subprocess.run( + ["smif", "run", "-v", "-w", "-d", config_dir, "energy_central"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + print(warm_output.stdout.decode("utf-8")) + print(warm_output.stderr.decode("utf-8"), file=sys.stderr) + + assert "Job energy_central_simulate_2010_1_energy_demand" in str(cold_output.stderr) + assert "Job energy_central_simulate_2010_1_energy_demand" not in str(warm_output.stderr) def test_fixture_batch_run(tmp_sample_project):