Replies: 4 comments 13 replies
-
I have an issue with adding tests that cannot be run outside of the ncar environment. In fact we had a forum user just yesterday who was very upset that one of the tests in the ctsm provided test suite was failing for them. But after examining the test I concluded that it had not been tested outside of the ncar systems. |
Beta Was this translation helpful? Give feedback.
-
That said - I think that the issue you are seeing is because create_test is run on the login node and environment and the run phase is from a compute node. I suspect that the conda environment is not being carried forward. |
Beta Was this translation helpful? Give feedback.
-
Great question @samsrabin. I think the underlying problem is that the run phase is normally sent to the batch system in cime. So you'd probably need to change the run method so that it bypasses the batch submit part. This would be doing something similar to the --no-batch option for CIME scripts. Although I'm not sure if --no-batch doesn't still do a subprocess.run call? Maybe it could be triggered by setting the no-batch option for these particular cases. We can't run all tests with --no-batch, but these python tests can certainly be done that way. This just means the python tests will take place as part of the build time so will add a bit to the build time, since I don't think any of these are extraordinarily long that should be fine, and normally they are run under qcmd anyway. My answer is essentially a longer version of what @jedwards4b, but he got his in first.... |
Beta Was this translation helpful? Give feedback.
-
@jedwards4b I liked the PRERUN_SCRIPT/POSTRUN_SCRIPT idea. Unfortunately the script I'm calling doesn't work as PRERUN_SCRIPT. If I try the Annoyingly, if I call the prerun script from a login shell it works fine. |
Beta Was this translation helpful? Give feedback.
-
In CTSM, we have a couple of SystemTests—
FSURDATMODIFYCTSM
andRXCROPMATURITY
—that call non-CIME Python scripts to do things like manipulate input files. These scripts need access to certain modules that we access using ourctsm_pylib
conda environment. This is currently being handled by calling them withconda run -n ctsm_pylib python3 script ...
orconda activate ctsm_pylib && python3 script ...
insubprocess.run()
, but that doesn't work for some users. (We think it's something to do with their Cheyenne environments, but it's pretty tricky to track down exactly why.)To fix the issue for those users and improve robustness generally, I decided to call the external scripts directly rather than using
subprocess.run()
. This works forFSURDATMODIFYCTSM
, which calls its external script in theSHAREDLIB_BUILD
phase, as long as the user doesconda activate ctsm_pylib
before callingcreate_test
. However, it doesn't work forRXCROPMATURITY
, which calls its external scripts in the run phase. It seems that the conda environment isn't active in the run phase.Is there any way—without using
subprocess.run()
—to make the run phase take place within the same conda environment ascreate_test
was called from?Beta Was this translation helpful? Give feedback.
All reactions