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

Minor: Change YAML FullLoader to Loader #223

Closed
wants to merge 1 commit into from
Closed

Conversation

oscarwumit
Copy link
Contributor

@oscarwumit oscarwumit commented Oct 14, 2019

In PyYaml version 5.x above, the FullLoader is not backward compatible with previous PyYaml versions. This results in ARC crash in some restart jobs. The Loader function, instead, is backward compatible.

-- legacy comments
PyYaml version 3.12 works well with the current ARC codebase. New versions of PyYaml leads to restart issues.

When I restart an ARC job, it crashed because PyYaml complains that
"yaml.constructor.ConstructorError: while constructing a Python instance
expected a class, but found <class 'builtin_function_or_method'>"

After traceback the code, I find PyYaml crashed because of the following code in ARC
yaml.load(stream=f, Loader=yaml.FullLoader)

This seems to be a common PyYaml issue, especially for new versions:
facebookresearch/Detectron#840

Take advice online, I changed the PyYaml version to 3.12. Because in this version, FullLoader is not available, I changed it to Loader. Now we have in ARC
pyyaml = 3.12
yaml.load(stream=f, Loader=yaml.Loader)

After these changes, my restart job works fine :-)

@codecov
Copy link

codecov bot commented Oct 14, 2019

Codecov Report

Merging #223 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #223   +/-   ##
=======================================
  Coverage   46.13%   46.13%           
=======================================
  Files          30       30           
  Lines        8868     8868           
  Branches     2598     2598           
=======================================
  Hits         4091     4091           
+ Misses       4134     4126    -8     
- Partials      643      651    +8
Impacted Files Coverage Δ
arc/common.py 85.13% <100%> (ø) ⬆️
arc/reaction.py 37.79% <0%> (ø) ⬆️
arc/scheduler.py 16.8% <0%> (ø) ⬆️
arc/processor.py 52.36% <0%> (ø) ⬆️

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 71b4960...8cdcff5. Read the comment docs.

In PyYaml version 5.x above, the FullLoader is not backward compatible with previous PyYaml versions. This results ARC crash in some restart jobs. The `Loader` function, instead, is backward compatible.
@oscarwumit oscarwumit changed the title Minor: Change PyYaml version to 3.12 to fix a restart issue Minor: Change FullLoader to Loader Oct 24, 2019
@alongd
Copy link
Member

alongd commented Oct 24, 2019

@oscarwumit, could you upload a minimal YAML file that crashes on master? We should make a test out of it on this branch

@alongd alongd changed the title Minor: Change FullLoader to Loader Minor: Change YAML FullLoader to Loader Nov 5, 2019
@alongd
Copy link
Member

alongd commented Jan 3, 2020

I prefer to keep the version 5.x, if possible, see https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation
@oscarwumit, do you still have a copy of the restart file that crushed?

alongd added a commit that referenced this pull request Jan 15, 2020
Convert negative frequencies troubleshooted to a list when dumping a species as a dictionary, see #223 and #279
@alongd alongd closed this in #280 Jan 15, 2020
amarkpayne pushed a commit to amarkpayne/ARC that referenced this pull request Jan 15, 2020
Convert negative frequencies troubleshooted to a list when dumping a species as a dictionary, see ReactionMechanismGenerator#223 and ReactionMechanismGenerator#279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants