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

[bugfix] wrap read metadata.json in a try except block #466

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NihalHarish
Copy link
Contributor

Description of changes:

  • if the metadata.json file is empty there is potential that the hook will crash.

Style and formatting:

I have run pre-commit install to ensure that auto-formatting happens with every commit.

Issue number, if available

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

try:
parameters = json.load(json_data)
except json.decoder.JSONDecodeError:
logger.warning(f"{self._states_file} was empty")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should not have potential to create a log flood since the str is constant.
Keeping the level=warning since we'd ideally want feedback if this behavior is seen by the customers too often

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Open to opinions.

Copy link
Contributor

Choose a reason for hiding this comment

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

In what case would the states file be empty? If it's because of a user misconfiguration of some sort, then yes I agree with making this a warning message. Otherwise, I'm not sure. What are the repercussions for the user if the states file is empty?

@codecov-io
Copy link

Codecov Report

Merging #466 (b3e6068) into master (433348d) will decrease coverage by 0.41%.
The diff coverage is 40.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #466      +/-   ##
==========================================
- Coverage   65.62%   65.21%   -0.42%     
==========================================
  Files         172      162      -10     
  Lines       13260    12918     -342     
==========================================
- Hits         8702     8424     -278     
+ Misses       4558     4494      -64     
Impacted Files Coverage Δ
smdebug/core/state_store.py 79.16% <40.00%> (-1.87%) ⬇️
smdebug/core/modes.py 55.00% <0.00%> (-20.00%) ⬇️
smdebug/xgboost/singleton_utils.py 0.00% <0.00%> (-20.00%) ⬇️
smdebug/trials/profiler_trial.py 24.61% <0.00%> (-18.47%) ⬇️
smdebug/mxnet/collection.py 73.33% <0.00%> (-16.67%) ⬇️
smdebug/exceptions.py 65.47% <0.00%> (-15.48%) ⬇️
smdebug/core/reader.py 85.18% <0.00%> (-7.41%) ⬇️
smdebug/tensorflow/callable_cache.py 78.26% <0.00%> (-6.53%) ⬇️
smdebug/core/locations.py 86.11% <0.00%> (-5.56%) ⬇️
smdebug/core/tensor.py 79.03% <0.00%> (-2.02%) ⬇️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 433348d...b3e6068. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants