Bootstrap environment-modules#3057
Conversation
davydden
left a comment
There was a problem hiding this comment.
I am not the best guy to review this, but I like the feature! On my mac I always install environment-modules myself anyway. Same with ubuntu.
|
Nice idea, but I think this is the wrong place to do it. We've tossed around the idea of Spack bootstrapping before. If we start down that path, I expect the bootstrapping procedure will grow to be more sophisticated (and slower) over time. See #2020. I don't think it should be run, in general, in the user's I would be amenable to a new Would you be interested in adding a |
|
Part of the problem I see with the code I introduced being moved to a However, that said, a How about this:
This effectively separates the process of setting up any basic stuff that spack needs along with giving |
|
How about this:
1. I can add a basic spack bootstrap which handles installing
environment-modules and others as necessary
2. I cut out the stuff which installs environment-modules from
spack-env.sh, but keep the stuff that detects whether module is
missing and attempts to use one inside spack, then produces a warning
message if module wasn't available and wasn't installed along with the
suggestion that they run spack bootstrap to make it available and run
spack-env.sh again to get module.
I think this means that `spack-env.sh` would detect if
`environment-modules` is missing, but not try to build it. Sounds good to
me.
Remember also that not everyone uses `environment-modules`. Some use
`lmod`. Any changes to `spack-env.sh` would have to be compatible with
both.
|
|
@krafczyk Did you consider building |
|
...and requires the installation of Lua, for which we don't really have
proper Spack support.
…On Tue, Feb 7, 2017 at 4:09 PM, Massimiliano Culpo ***@***.*** > wrote:
@krafczyk <https://github.com/krafczyk> Did you consider building lmod
instead of environment-modules? It's completely backward compatible with
TCL module files and is currently maintained.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#3057 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB1cd2ypKj1Ex8fvJ2sG27ynHJUH0txVks5raN19gaJpZM4L5_l5>
.
|
|
@alalazo, I didn't, but simply because I'm more familiar with |
|
Thank you a lot: I needed exactly that for bootstrap on my laptop Mint, tested, it seems to work. my deployment script could then be: |
|
@luigi-calori What I was considering was more like this:
Would that be reasonable to you? |
|
@krafczyk Sure,
At this point, module is available, and it will be for all the following session where |
|
As it turns out, |
|
@tgamblin Does anyone even use |
|
I second @adamjstewart here. Let's rename the old `spack bootstrap` and
reuse the name.
|
|
Alright, how about |
|
Sounds fine with me. I doubt the old command is used much, so it doesn't
really matter what it's called.
…On Wed, Feb 8, 2017 at 1:36 PM, Matthew Scott Krafczyk < ***@***.***> wrote:
Alright, how about spack clone for a new name for the old spack bootstrap?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3057 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB1cd4ZZ9lrokGny9OjA8g55_ZzJzwpAks5rags4gaJpZM4L5_l5>
.
|
0343388 to
3a632b1
Compare
|
Alright folks, I've moved bootstrap functionality to clone, and I've turned bootstrap into a command to install necessary packages. I've also changed the logic of spack-env.sh so that it doesn't automatically install the missing packages and only activates module if you don't already have it available and you have the right package already installed. As far as spack bootstrap goes, I've decided to go the simple route for now and just install a list of specs which we deem all spack repos ought to have. I tried to figure out how to determine if module was defined in the containing shell environment but it seems like there's no way to do that. If someone can come up with a better way in the future that'd be great. For now I think this is all the functionality I really want so I'd love to get this merged. |
|
In addition, I duplicated a few arguments and functionality from install. I'd like to get comments on how I've implemented it and whether there might be a better way. |
lib/spack/spack/cmd/bootstrap.py
Outdated
| description = "create a new installation of spack in another prefix" | ||
| from spack.util.executable import which | ||
|
|
||
| description = "bootstrap packages needed for spack to run smoothly." |
There was a problem hiding this comment.
Descriptions should not end in a period to match what argparse prints by default.
citibeth
left a comment
There was a problem hiding this comment.
One big question: Once environment-modules has been installed, how will Spack change its configuration to use it?
| help="do not check packages against checksum") | ||
| subparser.add_argument( | ||
| '-v', '--verbose', action='store_true', dest='verbose', | ||
| help="display verbose build output while installing") |
There was a problem hiding this comment.
Should these be shared with spack install?
There was a problem hiding this comment.
We need to move them into common_arguments since they're used in diy as well. I'd like to do that in a separate PR though to keep complexity down.
There was a problem hiding this comment.
Once the user has executed spack bootstrap They need to run spack-env.sh again in order to allow that script to define the module function. I've found that what I have in spack-env.sh seems to work perfectly.
There was a problem hiding this comment.
We need to move them into common_arguments since they're used in diy as well.
OK, let's just leave it as-is. Common arguments should probably go with #2664.
4d1dbd2 to
570b215
Compare
|
CI tests passed, but one coverage test failed. Can someone tell me what the problem is? If nobody has any objections, I'd like to get this merged. |
|
I'm an experienced Linux user (since 1998) and I was pretty confused initially about how to make use of the software I had installed via spack. I like the idea of having a module solution automatically bootstrapped and activated along with shell support, but another option would be to update the installation doc to recommend installation of either lmod or environment-modules (currently it's buried fairly deep and it was not easy for me to find). A doc update is worth considering in either case I think. |
I've included suggestions from scheibelp.
Make bootstrap command accept a list of packages which may satisfy requirements.
- Make comments more clear - Add user suggestions about modules - Make searching for required packages about modules smarter.
|
@scheibelp I've tried to incorporate your changes with some new commits. Please have a look. |
scheibelp
left a comment
There was a problem hiding this comment.
Thanks a lot for the updates. I have a few additional requests:
- I have a suggestion for simplifying the check for
environment-modulesinbootstrap(I apologize for not concretely explaining my original request - the comment includes a concrete example) - There are 2 documentation update requests
lib/spack/docs/getting_started.rst
Outdated
| try the following procedure: | ||
|
|
||
| #. Install with: | ||
| * Consider using system tcl (as long as your system has Tcl version 8.0 or later): |
There was a problem hiding this comment.
It has occurred to me that this consideration would apply whether you install environment-modules with spack install or spack bootstrap. IMO it makes sense to reorganize like:
- Install environment-modules (with
spack installorspack bootstrap). You may need to use system tcl... - Update path to use spack-installed environment-modules (manually or with
setup-env.sh)
There was a problem hiding this comment.
So, my comment about tcl is simply because tcl takes the longest to build and install in environment-module's dependency stack. So since it is a common package to have already installed, I mention that you can get spack to use it instead of rebuilding it.
However.. Maybe this isn't a good idea to suggest because spack currently does not have a good method of interacting with native installed packages. Maybe I should just strike that bit about tcl entirely, thoughts?
There was a problem hiding this comment.
It looks like the comment about using system tcl was originally added by @citibeth. IMO it is worth keeping, but I think it should be added at the end of the section (especially if the only purpose is to speed up the installation):
You can speed up installation of
environment-modulesby referring Spack to use a system-installed tcl if it is available...
I'm not sure what you mean by:
Maybe this isn't a good idea to suggest because spack currently does not have a good method of interacting with native installed packages.
Are you saying in your experience that specifying externals in packages.yaml has caused problems for you?
There was a problem hiding this comment.
No, the mechanics of adding externals seems to be okay for now.
What I worry about is a system /usr/lib contaminating the link line somewhere and linking against system packages on accident where spack packages should be used. I don't yet have a specific example when this has caused problems yet, but I feel that perhaps for stuff we're claiming will work well for all spack users we shouldn't loudly proclaim this functionality when it may cause some problems in some cases.
There was a problem hiding this comment.
There has been work to prevent system paths like /usr/lib from making their way into link paths. External packages are already linked in the guide on getting started. So I think it's worth keeping this. I do think it should be put at the end of the section though (not as part of the 3 steps), since it is easier (if longer) not to point Spack to the system tcl.
| $ source $SPACK_ROOT/share/spack/setup-env.csh | ||
|
|
||
| Executing ``spack bootstrap`` will install the ``environment-modules`` package | ||
| and ``bash`` and ``ksh`` users sourcing the appropriate setup file will have |
There was a problem hiding this comment.
I'd prefer:
When
bashandkshusers update their environment withsetup-env.sh, it will check for spack-installed environment modules and add themodulecommand to their environment; this only occurs if the module command is not already available. You can installenvironment-moduleswithspack-bootstrapas described in (link to section)
This deals with a number of minor issues. For example it doesn't draw the user's attention to spack bootstrap unless they are using bash or ksh, which I think is worthwhile, since csh users don't benefit from spack bootstrap.
Also, from what I can tell everything in the following section "spack load / unload" applies just the same when setup-env.sh is invoked after spack bootstrap, but I wanted to confirm that with you.
There was a problem hiding this comment.
Yes that is correct.
I like what you wrote better, I'm changing it.
lib/spack/spack/cmd/bootstrap.py
Outdated
| for req in requirement_list: | ||
| spec_req = spack.Spec(req) | ||
| spec_req.concretize() | ||
| installed_specs = spack.store.db.query(spec_req) |
There was a problem hiding this comment.
I apologize but I did not thoroughly explain myself. This achieves what I was looking for but I think it can be done simpler: you should be able to db.query(requirement). For example you can db.query('environment-modules') and it will match any installation of environment modules regardless of variant settings; you don't have to query for both possible settings of the X variant. So to make it concrete the dict would look like:
requirement_dict = {'environment-modules': 'environment-modules~X'}
and the idea would be that you query for environment-modules but if no such installed package is available, you install environment-modules~X.
Let me know if that is unclear.
There was a problem hiding this comment.
Okay, that makes more sense. I'll update the code to take this into account.
I assume that my use of spack.Spec is correct?
|
@scheibelp I've committed some changes taking your review into account. Have a look. |
| build it for you! | ||
|
|
||
| #. Consider using system tcl (as long as your system has Tcl version 8.0 or later): | ||
| What follows are three steps describing how to install and use environment-modules with spack. |
There was a problem hiding this comment.
This is two steps now isn't it (with your most recent changes)?
There was a problem hiding this comment.
The third step is to test that the module command works properly.
Do you think I should do away with that step?
There was a problem hiding this comment.
Sorry I missed that - nope I see 3 and I like the 3rd step for verification.
|
@scheibelp I've restored the |
lib/spack/docs/getting_started.rst
Outdated
| #. Install ``environment-modules``. | ||
|
|
||
| .. code-block:: yaml | ||
| * Spack can build and install ``environment-modules`` for you. |
There was a problem hiding this comment.
IMO this wording is slightly awkward since spack is building environment-modules for you in both cases. Perhaps:
spack bootstrapwill build environment-modules for you (and may build other packages that are useful to the operation of Spack).
Other than that LGTM - make that change and I'll merge this.
|
@scheibelp I've gone and made that change |
|
Thanks! Sorry but it appears there was a spurious test failure - could you close and reopen this? |
NM I can do it myself: I'll merge it in the morning. |
|
Thanks! I appreciate all the edits |
|
@scheibelp Thanks a lot for your help here! I'm so glad this is finally merged. |
This branch adds the ability to automatically build and enable environment-modules as part of
spack-env.sh. The added code detects whether either dotkit or modules is available, and if neither is available,environment-modulesis built and module function is introduced.This change makes spack more portable as module support is automatically setup.