Skip to content

Commit

Permalink
Fix run --warm
Browse files Browse the repository at this point in the history
missing argument and integration test
  • Loading branch information
tomalrussell committed Sep 4, 2019
1 parent a0efe8f commit 83e6103
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/smif/controller/modelrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 16 additions & 7 deletions tests/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 83e6103

Please sign in to comment.