-
Notifications
You must be signed in to change notification settings - Fork 117
[feat] Automatically create a Spack environment when not set #2031
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2031 +/- ##
==========================================
+ Coverage 86.23% 86.76% +0.52%
==========================================
Files 53 52 -1
Lines 9305 9276 -29
==========================================
+ Hits 8024 8048 +24
+ Misses 1281 1228 -53
Continue to review full report at Codecov.
|
|
Can I test this patch? |
66bbb14 to
c055407
Compare
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this PR with the following test and it works:
import reframe as rfm
import reframe.utility.sanity as sn
@rfm.simple_test
class reframe_spack_env_check(rfm.RegressionTest):
valid_systems = ['*']
valid_prog_environs = ['*']
build_system = 'Spack'
executable = 'bzip2'
executable_opts = ['--help']
@run_before('sanity')
def set_sanity(self):
self.sanity_patterns = sn.assert_found(r'Version 1.0.7', self.stderr)
@run_before('compile')
def setup_build_system(self):
self.build_system.specs = ['bzip2@1.0.7']However, when I run the test and then do spack find bzip2, I see 1.0.7 installed in my system. Is this expected? I'm not that familiar with Spack, so I might miss something. @victorusu can you also have a look?
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the problem with the automatically generated environment is that it doesn't set correctly the installation paths. Ideally, we want this to be installed in the stage directory of the test and not "pollute" the user's installation, unless explicitly required.
|
How is this different from an environment manually created from the user? I guess I'm missing something, but then we're back to the fact documentation isn't helpful at the moment and I'm trying to reverse engineer what I'm supposed to do 🙂 |
|
@giordano, I think the issue is that we haven't documented enough the current goals of this feature. AFAIK, what we wanted in the beginning is to test Spack packages and have them installed in the test's One of the reasons for this decision was that we did not know, in principle, which options of the
So, we postponed environment's inclusion/discussion. Now, as you have pointed out, the time to have this discussion has come!😄 @vkarak and @giordano, what do you think about adding a build system option to set the |
|
To be clear, what you're suggesting is to automatically run something like after activating the environment, where I'd love to have something as simple as this import reframe as rfm
import reframe.utility.sanity as sn
@rfm.simple_test
class Test(rfm.RegressionTest):
valid_systems = ['*']
valid_prog_environs = ['*']
build_system = 'Spack'
executable = 'myprogram'
@run_before('compile')
def set_compiler_flags(self):
self.build_system.specs = ['program@1.0']
@run_before('sanity')
def set_sanity_patterns(self):
self.sanity_patterns = sn.assert_found(r'SUCCESS', self.stdout)to work without anything extra needed. As far as I understand, at the moment this isn't possible, and that's why I'm trying to hack the Spack build system with this pull request 🙂 |
c055407 to
a18bca1
Compare
@giordano, that's exactly what I am saying. @vkarak what do you think? |
|
@giordano Yes, the rationale from @victorusu is correct about the initial purpose of the feature. We have been seeing it also as feature that would help in CI or to do parameter exploration on different builds. We never thought about it seriously as a means of deployment, because there can be too many parameters to consider there. Also I totally agree with what you'd like to see from a user's perspective. My initial objection was that, as a user, I would not like to see my global environment to be implicitly modified after running a reframe test. So by default the @victorusu For this PR, I would say that emitting the |
a18bca1 to
d62c897
Compare
|
Ok, I added an
|
d62c897 to
0034464
Compare
23fddb7 to
3457c2e
Compare
|
Ok, I finally got back to this pull request, rebased on latest |
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm. I just have some minor suggestions. I could also have a look at the tutorial to see if it needs to be adjusted.
3457c2e to
58e5c61
Compare
|
Hello @giordano, Thank you for updating! Cheers! There are no PEP8 issues in this Pull Request!Do see the ReFrame Coding Style Guide Comment last updated at 2021-08-09 21:08:14 UTC |
58e5c61 to
38baec2
Compare
|
I mentioned in the tutorial that the environment isn't required and it'll be automatically created by ReFrame if not provided. I didn't mention |
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned in the tutorial that the environment isn't required and it'll be automatically created by ReFrame if not provided. I didn't mention install_tree there, do you think it's necessary?
No, it's not necessary. It's enough the we mention it in the reference.
Lgtm now! Going in.
|
ok to test |
|
Thanks! |
Fix #2028.