Skip to content

Commit

Permalink
Review comment updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nweires committed Jan 26, 2024
1 parent 93c587f commit a941448
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions buildstockbatch/cloud/docker_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def run_batch(self):
tmppath = pathlib.Path(tmpdir)
epws_to_copy, batch_info = self._run_batch_prep(tmppath)

# If we're rerunning failed tasks from a previous job, DO NOT overwite the job files.
# If we're rerunning failed tasks from a previous job, DO NOT overwrite the job files.
# That would assign a new random set of buildings to each task, making the rerun useless.
if not self.missing_only:
# Copy all the files to cloud storage
Expand Down Expand Up @@ -556,19 +556,22 @@ def find_missing_tasks(self, expected):
:returns: The number of files that were missing.
"""
fs = self.get_fs()
done_tasks = []
done_tasks = set()

for f in fs.ls(f"{self.results_dir}/simulation_output/"):
if m := re.match(".*results_job(\\d*).json.gz$", f):
done_tasks.append(int(m.group(1)))
done_tasks.add(int(m.group(1)))

job_count = 0
missing_tasks = []
with fs.open(f"{self.results_dir}/missing_tasks.txt", "w") as f:
for task_id in range(expected):
if task_id not in done_tasks:
f.write(f"{task_id}\n")
job_count += 1
missing_tasks.append(str(task_id))

logger.info(f"Found missing tasks: {', '.join(missing_tasks)}")

return job_count
return len(missing_tasks)

def log_summary(self):
"""
Expand Down

0 comments on commit a941448

Please sign in to comment.