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

Fix issue in create_temporary_directory (affecting XMLValidator with schematron) #4961

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Sep 5, 2023

Pull request overview

Fix issue found in hpxml CI testing. If you try to run create_tempora…ry_directory more than 1000 times it fails...

The static std::atomic was never reset to 0.

1001.times { OpenStudio::XMLValidator.new('./HPXMLtoOpenStudio/resources/hpxml_schematron/EPvalidator.xml') }
[openstudio.XMLValidator] <-1> Saved transformed XSLT Stylesheet at '/tmp/xmlvalidation-2b1f-69c6-900c-7b06-1693932780-998/EPvalidator_stylesheet.xslt'.
[openstudio.XMLValidator] <-1> Transformed Schematron to an XSLT Stylesheet and saved it at /tmp/xmlvalidation-2b1f-69c6-900c-7b06-1693932780-998/EPvalidator_stylesheet.xslt.
[openstudio.XMLValidator] <-1> Treating schema as a Schematron, converting to an XSLT StyleSheet.
[openstudio.XMLValidator] <-1> Saved transformed XSLT Stylesheet at '/tmp/xmlvalidation-4a67-fcb1-a651-fa6d-1693932780-999/EPvalidator_stylesheet.xslt'.
[openstudio.XMLValidator] <-1> Transformed Schematron to an XSLT Stylesheet and saved it at /tmp/xmlvalidation-4a67-fcb1-a651-fa6d-1693932780-999/EPvalidator_stylesheet.xslt.
[openstudio.XMLValidator] <-1> Treating schema as a Schematron, converting to an XSLT StyleSheet.
[openstudio.XMLValidator] <2> Failed to create a temporary directory for extracting the stylesheets needed to transform the Schematron './HPXMLtoOpenStudio/resources/hpxml_schematron/EPvalidator.xml'
Traceback (most recent call last):
        8: from /usr/local/bin/irb:23:in `<main>'
        7: from /usr/local/bin/irb:23:in `load'
        6: from /usr/local/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
        5: from (irb):70
        4: from (irb):70:in `times'
        3: from (irb):70:in `block in irb_binding'
        2: from (irb):70:in `new'
        1: from (irb):70:in `initialize'
RuntimeError (/srv/jenkins/openstudio/git/nightly/ubuntu_2004/src/utilities/xml/XMLValidator.cpp@180 : Failed to create a temporary directory for extracting the stylesheets needed to transform the Schematron './HPXMLtoOpenStudio/resources/hpxml_schematron/EPvalidator.xml')

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

…ry_directory more than 1000 times it fails...

The static std::atomic<int> was never reset to 0.

```
1001.times { OpenStudio::XMLValidator.new('./HPXMLtoOpenStudio/resources/hpxml_schematron/EPvalidator.xml') }

[openstudio.XMLValidator] <-1> Saved transformed XSLT Stylesheet at '/tmp/xmlvalidation-2b1f-69c6-900c-7b06-1693932780-998/EPvalidator_stylesheet.xslt'.
[openstudio.XMLValidator] <-1> Transformed Schematron to an XSLT Stylesheet and saved it at /tmp/xmlvalidation-2b1f-69c6-900c-7b06-1693932780-998/EPvalidator_stylesheet.xslt.
[openstudio.XMLValidator] <-1> Treating schema as a Schematron, converting to an XSLT StyleSheet.
[openstudio.XMLValidator] <-1> Saved transformed XSLT Stylesheet at '/tmp/xmlvalidation-4a67-fcb1-a651-fa6d-1693932780-999/EPvalidator_stylesheet.xslt'.
[openstudio.XMLValidator] <-1> Transformed Schematron to an XSLT Stylesheet and saved it at /tmp/xmlvalidation-4a67-fcb1-a651-fa6d-1693932780-999/EPvalidator_stylesheet.xslt.
[openstudio.XMLValidator] <-1> Treating schema as a Schematron, converting to an XSLT StyleSheet.
[openstudio.XMLValidator] <2> Failed to create a temporary directory for extracting the stylesheets needed to transform the Schematron './HPXMLtoOpenStudio/resources/hpxml_schematron/EPvalidator.xml'
Traceback (most recent call last):
        8: from /usr/local/bin/irb:23:in `<main>'
        7: from /usr/local/bin/irb:23:in `load'
        6: from /usr/local/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
        5: from (irb):70
        4: from (irb):70:in `times'
        3: from (irb):70:in `block in irb_binding'
        2: from (irb):70:in `new'
        1: from (irb):70:in `initialize'
RuntimeError (/srv/jenkins/openstudio/git/nightly/ubuntu_2004/src/utilities/xml/XMLValidator.cpp@180 : Failed to create a temporary directory for extracting the stylesheets needed to transform the Schematron './HPXMLtoOpenStudio/resources/hpxml_schematron/EPvalidator.xml')
```
@jmarrec jmarrec added component - Utilities Other Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. labels Sep 5, 2023
@jmarrec jmarrec self-assigned this Sep 5, 2023
Copy link
Contributor

@shorowit shorowit left a comment

Choose a reason for hiding this comment

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

Confirmed that this fixes an issue (and this issue appears to be the root cause of our CI failures). Thanks @jmarrec!

@jmarrec jmarrec merged commit 5dd736c into develop Sep 6, 2023
2 checks passed
@jmarrec jmarrec deleted the create_temporary_directory_again branch September 6, 2023 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - Utilities Other Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants