Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle empty data_point_out.json #426

Merged
merged 4 commits into from Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -34,8 +34,8 @@ jobs:
wget --quiet https://data.nrel.gov/system/files/156/BuildStock_TMY3_FIPS.zip
- name: Download and Install OpenStudio
run: |
wget -q https://github.com/NREL/OpenStudio/releases/download/v3.7.0-rc1/OpenStudio-3.7.0-rc1+211bb633b0-Ubuntu-22.04-x86_64.deb
sudo apt install -y ./OpenStudio-3.7.0-rc1+211bb633b0-Ubuntu-22.04-x86_64.deb
wget -q https://github.com/NREL/OpenStudio/releases/download/v3.7.0/OpenStudio-3.7.0+d5269793f1-Ubuntu-22.04-x86_64.deb
sudo apt install -y ./OpenStudio-3.7.0+d5269793f1-Ubuntu-22.04-x86_64.deb
openstudio openstudio_version
which openstudio
- name: Install buildstockbatch
Expand Down
2 changes: 2 additions & 0 deletions buildstockbatch/postprocessing.py
Expand Up @@ -42,6 +42,8 @@ def read_data_point_out_json(fs, reporting_measures, filename):
try:
with fs.open(filename, "r") as f:
d = json.load(f)
if not d:
return None
except (FileNotFoundError, json.JSONDecodeError):
return None
Comment on lines 42 to 48
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm kind of curious what kind of file would run into this block. We're already handling the file being missing and it not being valid json, which is the error hit when the file is just empty. Based on messing around a little with it, I think the file would have to be just

null

I wonder where we're creating files like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into a case where it was just "{}" when ResStock fails in some specific step.

else:
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog/changelog_dev.rst
Expand Up @@ -20,3 +20,9 @@ Development Changelog
:pullreq: 422

Refactor AWS code so it can be shared by the upcoming GCP implementation.

.. change::
:tags: general, bugfix
:pullreq: 426

A bugfix for gracefully handling empty data_point_out.json files.