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 WorkingDir of Driver.py #1870

Merged
merged 2 commits into from
Nov 17, 2022
Merged

Conversation

dylanjm
Copy link
Collaborator

@dylanjm dylanjm commented Jun 28, 2022


Pull Request Description

What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)

#1033
close #1687

What are the significant changes in functionality due to this change request?

No significant changes. RAVEN will now adjust its working directory to be wherever the input file is pointed.

For example, before this would break raven:

cd raven
./raven_framework tests/framework/user_guide/ravenTutorial/singleRun.xml

Now it doesn't.


For Change Control Board: Change Request Review

The following review must be completed by an authorized member of the Change Control Board.

  • 1. Review all computer code.
  • 2. If any changes occur to the input syntax, there must be an accompanying change to the user manual and xsd schema. If the input syntax change deprecates existing input files, a conversion script needs to be added (see Conversion Scripts).
  • 3. Make sure the Python code and commenting standards are respected (camelBack, etc.) - See on the wiki for details.
  • 4. Automated Tests should pass, including run_tests, pylint, manual building and xsd tests. If there are changes to Simulation.py or JobHandler.py the qsub tests must pass.
  • 5. If significant functionality is added, there must be tests added to check this. Tests should cover all possible options. Multiple short tests are preferred over one large test. If new development on the internal JobHandler parallel system is performed, a cluster test must be added setting, in XML block, the node <internalParallel> to True.
  • 6. If the change modifies or adds a requirement or a requirement based test case, the Change Control Board's Chair or designee also needs to approve the change. The requirements and the requirements test shall be in sync.
  • 7. The merge request must reference an issue. If the issue is closed, the issue close checklist shall be done.
  • 8. If an analytic test is changed/added is the the analytic documentation updated/added?
  • 9. If any test used as a basis for documentation examples (currently found in raven/tests/framework/user_guide and raven/docs/workshop) have been changed, the associated documentation must be reviewed and assured the text matches the example.

# If a user chooses to run RAVEN outside of the directory containing the
# xml input file, then we should should change the python working directory
# to the directory containing the input file to avoid confusion.
os.chdir(cwd)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this change just solve part of the problem. Take the test "raven/tests/framework/test_iostep_load.xml" for example (see the following attached screenshot), the files provided by Files using relative path, which I think currently based on the WorkingDir provided by the RunInfo. I think the confusion here is we do not have a consistent way to explain and use the path. The issue #1687 suggest we use the input file folder as the base directory. The following is my suggestion: I think the default behavior is use the input file folder as the base directory and search the files, if the files do not exist, then using the WorkingDir listed in RunInfo as the base directory, if the files are still not found, then use the running directory as the base directory. After trying search all these places, error will be raise if we can not find these files. @dylanjm @Jimmy-INL @joshua-cogliati-inl @PaulTalbot-INL @mandd please let me know what do you think.

image

@wangcj05
Copy link
Collaborator

@dylanjm Do you have a change to resolve this issue?

@dylanjm
Copy link
Collaborator Author

dylanjm commented Jul 21, 2022

@wangcj05 I'm having trouble finding where we read files in the code that still has access to the RunInfo node.

@wangcj05
Copy link
Collaborator

@dylanjm the path in the Code.py is assigned in initialize method, the 'subSubDirectory', is it the place that you are looking for?

image

@dylanjm
Copy link
Collaborator Author

dylanjm commented Jul 21, 2022

@wangcj05 This could be the place I need to add it. My only question is are there files that won't go into Models that we need to check different directories for? Seems like this code is only checking the files that are passed as inputs to a Models block.

@wangcj05
Copy link
Collaborator

@dylanjm do you by chance have time to fix this issue?

@dylanjm
Copy link
Collaborator Author

dylanjm commented Nov 15, 2022

@dylanjm do you by chance have time to fix this issue?

@wangcj05 Ahh, yes. This PR had skipped my mind. I'll tackle it right now.

@dylanjm
Copy link
Collaborator Author

dylanjm commented Nov 15, 2022

@wangcj05 A few things to note:

  1. This change fixes the error you were running into with raven/tests/framework/test_iostep_load.xml You can run this test from raven/tests or raven/tests/framework and it will pass.
  2. The GA test was not passing because the External Model path was not relative to the working directory specified in the input file. It's also weird to name the working directory the same as another directory you want to put the external model in. We should encourage users to place the file in a premade working directory next to the input file or have them specify the relative path from the input file.
  3. There is no central place in RAVEN (that I can find) that would allow us to check for the existence of files in multiple locations. We also allow users to specify files that don't even exist yet.

This fix allows users to run RAVEN from whichever directory they'd like but keeps the expected output the same no matter what. As long as users specify their files relative to the working directory.

I may be missing something, so I'm open to any feedback you have on the matter.

@wangcj05 wangcj05 added the RAVENv2.3 for RAVEN 2.3 Release label Nov 16, 2022
Copy link
Collaborator

@wangcj05 wangcj05 left a comment

Choose a reason for hiding this comment

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

PR looks good.

@wangcj05
Copy link
Collaborator

Checklist is good, and tests are green. PR can be merged. @dylanjm Thanks for your contribution.

@wangcj05 wangcj05 merged commit 74dbb5f into idaholab:devel Nov 17, 2022
@dylanjm dylanjm deleted the fix-working-dir-issue branch June 1, 2023 16:30
@wangcj05 wangcj05 mentioned this pull request Feb 16, 2024
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RAVENv2.3 for RAVEN 2.3 Release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DEFECT] Working directory relative to location of input file
2 participants