Skip to content

Split 'module' into multiple commands#7098

Merged
tgamblin merged 13 commits intospack:developfrom
epfl-scitas:features/separate_module_commands
Jul 24, 2018
Merged

Split 'module' into multiple commands#7098
tgamblin merged 13 commits intospack:developfrom
epfl-scitas:features/separate_module_commands

Conversation

@alalazo
Copy link
Copy Markdown
Member

@alalazo alalazo commented Jan 28, 2018

fixes #2215
fixes #2570
fixes #4400
fixes #6676
fixes #7281
fixes #8646

closes #3827

Summary
$ spack module <action> -m <module_type>

has been turned into multiple

$ spack module <module_type> <action>

commands, each one tied to a specific module type. This permits the specialization of the new commands with features that are module type specific.

A few known bugs have been fixed in the process.

List of modifications
  • Split spack module command
  • Update references in docs
  • Add unit tests for new, module specific, subcommands
  • Add regression test for Only create module files for explicitly installed packages #4400 + a few lines in the docs on how to blacklist implicit packages
  • Return a non-zero value if spack load fails for any reason
  • Added the --dependencies option to spack help load
  • Update auto-completion for commands
  • Regenerate a Docker image for the modules tutorial, and point to that in the docs
  • Issue a warning for the deprecated use of the spack module command
Example: specify a default module to be loaded for lmod

As an example the possibility to specify a default module to be loaded for lmod has been implemented:

$ module av

---------------------------------------------------------------- /home/mculpo/PycharmProjects/spack/share/spack/lmod/linux-ubuntu14.04-x86_64/Core ----------------------------------------------------------------
   bzip2/1.0.6-wig75ws    libsigsegv/2.11-fotodb6    m4/1.4.18-r26rlmg    zlib/1.2.8-nfd5zfc    zlib/1.2.11-eksallf (D)

------------------------------------------------------------------------------------------- /usr/share/modules/versions -------------------------------------------------------------------------------------------
   3.2.10

----------------------------------------------------------------------------------------- /usr/share/modules/modulefiles ------------------------------------------------------------------------------------------
   dot    module-git    module-info    modules    null    use.own

  Where:
   D:  Default Module

Use "module spider" to find all possible modules.
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".

$ ls /home/mculpo/PycharmProjects/spack/share/spack/lmod/linux-ubuntu14.04-x86_64/Core/zlib/
1.2.11-eksallf.lua  1.2.8-nfd5zfc.lua

$ spack module lmod setdefault [email protected]
$ module av

---------------------------------------------------------------- /home/mculpo/PycharmProjects/spack/share/spack/lmod/linux-ubuntu14.04-x86_64/Core ----------------------------------------------------------------
   bzip2/1.0.6-wig75ws    libsigsegv/2.11-fotodb6    m4/1.4.18-r26rlmg    zlib/1.2.8-nfd5zfc (D)    zlib/1.2.11-eksallf

------------------------------------------------------------------------------------------- /usr/share/modules/versions -------------------------------------------------------------------------------------------
   3.2.10

----------------------------------------------------------------------------------------- /usr/share/modules/modulefiles ------------------------------------------------------------------------------------------
   dot    module-git    module-info    modules    null    use.own

  Where:
   D:  Default Module

Use "module spider" to find all possible modules.
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".

$ ls -l /home/mculpo/PycharmProjects/spack/share/spack/lmod/linux-ubuntu14.04-x86_64/Core/zlib/
total 8
-rw-rw-r-- 1 mculpo mculpo 1431 gen 28 14:36 1.2.11-eksallf.lua
-rw-rw-r-- 1 mculpo mculpo 1423 gen 28 14:36 1.2.8-nfd5zfc.lua
lrwxrwxrwx 1 mculpo mculpo   17 gen 28 18:39 default -> 1.2.8-nfd5zfc.lua

@alalazo alalazo added the WIP label Jan 28, 2018
@alalazo alalazo force-pushed the features/separate_module_commands branch from 7c5d756 to b8ab3e6 Compare January 28, 2018 18:44
@alalazo alalazo force-pushed the features/separate_module_commands branch from b8ab3e6 to 2fde417 Compare February 13, 2018 14:23
@alalazo alalazo force-pushed the features/separate_module_commands branch from 2fde417 to 54cdb8a Compare March 19, 2018 09:05
@alalazo alalazo force-pushed the features/separate_module_commands branch from 54cdb8a to 4b791ef Compare April 1, 2018 08:36
@alalazo alalazo force-pushed the features/separate_module_commands branch from 4b791ef to 623acef Compare April 11, 2018 20:53
@alalazo alalazo force-pushed the features/separate_module_commands branch from 2e349a5 to 87ccb12 Compare April 20, 2018 07:35
@alalazo alalazo added ready and removed WIP labels Apr 20, 2018
@alalazo alalazo force-pushed the features/separate_module_commands branch from ffd13eb to ade16fc Compare May 21, 2018 09:49
@alalazo alalazo requested review from becker33 and tgamblin May 21, 2018 10:29
@alalazo alalazo force-pushed the features/separate_module_commands branch from ade16fc to 07629b5 Compare July 5, 2018 12:22
@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Jul 5, 2018

@tgamblin @adamjstewart Do you have time to look at this PR? Despite the lot of lines changed, the PR only restructures the module command so that:

$ spack module <subcommand> -m <module_type> ...

becomes:

$ spack <module_type> <subcommand> ...

and adds a new feature specific to lmod:

$ spack lmod setdefault

The rationale is to differentiate the commands so that we could map features that are specific to each module type in a more natural manner.

@adamjstewart
Copy link
Copy Markdown
Member

I've never used spack module before, I've always used module load, so no opinions from me.

@tgamblin tgamblin self-assigned this Jul 6, 2018
@alalazo alalazo force-pushed the features/separate_module_commands branch 4 times, most recently from e8b7a6d to c011b96 Compare July 10, 2018 07:04
@alalazo alalazo removed the ready label Jul 10, 2018
@alalazo alalazo force-pushed the features/separate_module_commands branch from b3c8685 to c90c7e6 Compare July 10, 2018 15:39
@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Jul 10, 2018

@ax3l @davydden @healther and others, can you please give a test drive to this PR and see if it fixes the issues mentioned in the description in a way you like?

I went just through the module file tutorial and everything seems to work as expected.

Copy link
Copy Markdown
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

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

Just from reviewing the UI, it works great for me! Thank you so much!
Solves both the proper error on load of missing packages as well as loading only one package.

@healther
Copy link
Copy Markdown
Contributor

Not sure if I'll get to it today, but I'll try to have tested this by the end of tomorrow

@healther
Copy link
Copy Markdown
Contributor

Couple of things that I found (but I'm not sure whether I'm at fault or the current implementation):

Doing spack lmod refresh errors out with

==> Error: 'core_compilers' key not found in configuration file

while the other two (spack dotkit refresh and spack tcl refresh) don't produce errors (at least one of these commands touched my module files, but I didn't check which one). I'm uncertain whether all should work as I only have a spack-provided environment-module available (and I don't understand how the module systems relate to the module command)

I expected to have e.g. the perl module load its dependencies now. I.e. I expected autoload: direct to be the default, but maybe I misremembered.

On a more high level note: I think we should rearrange the help now, currently there is this section:

environment:
  dotkit                manipulate dotkit module files
  lmod                  manipulate hierarchical module files
  load                  add package to environment using `module load`
  tcl                   manipulate non-hierarchical module files
  unload                remove package from environment using `module unload`
  view                  produce a single-rooted directory view of packages

The module systems should be somehow group, shouldn't they?

alalazo added 11 commits July 23, 2018 07:48
'spack module' has been split into multiple commands, each one tied to a
specific module type. This permits the specialization of the new
commands with features that are module type specific (e.g. set the
default module file in lmod when multiple versions of the same package
are installed at the same time).
Added a subcommand that sets the default module to be loaded, if
multiple installations of the same package are present.
This just because the fixture has been moved one level above the one
it was originally defined. In this more general context there's more
than one configuration file that could be patched for tests.
fixes spack#4400

The feature requested in spack#4400 was already part of the module file
configuration, but it was neither tested nor documented. This
commit takes care of adding a few lines in the documentation and a
regression test.
fixes spack#2215
fixes spack#2570
fixes spack#6676
fixes spack#7281
closes spack#3827

This PR reverts the use of `spack module loads` in favor of
`spack module find` when loading module files via Spack. After this PR
`spack load` will accept a single spec at a time, and will be able
to interpret correctly the `--dependencies` option.
As requested in the review all the commands meant to manage module
files have been grouped under the `spack module` command.

Unit tests have been refactored to match the new command structure.
@alalazo alalazo force-pushed the features/separate_module_commands branch from bb7a505 to a9886b7 Compare July 23, 2018 06:13
@alalazo

This comment has been minimized.

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Jul 23, 2018

@tgamblin I uploaded spack/module-tutorial:latest on Dockerhub and made the requested changes. Let me know if there's anything else I need to do.

@tgamblin
Copy link
Copy Markdown
Member

Can we tweak this slightly:

$ spack module refresh --delete-tree -m tcl -m lmod -y cmake lmod ^python
==> Error: deprecated command. Try to use:

        $ spack module tcl refresh --delete-tree -y cmake lmod ^python
        $ spack module lmod refresh --delete-tree -y cmake lmod ^python

instead.

to look at the -m argument and print:

==> Error: `spack module -m tcl` has been moved. Try this instead:
        $ spack module tcl refresh --delete-tree -y cmake lmod ^python

We should either say it's moved (if it's broken) or warn and do the old thing until we finally remove it (if it's deprecated)

alalazo added 2 commits July 23, 2018 13:46
In case a deprecated form of the module command is used, the program
will exit non-zero and print an informative error message suggesting
which command should be used instead.
@alalazo alalazo force-pushed the features/separate_module_commands branch from a9886b7 to 4d5a985 Compare July 23, 2018 11:46
@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Jul 23, 2018

@tgamblin Latest commit

$ spack module refresh --delete-tree -m tcl -m lmod -y cmake lmod ^python
==> Error: `spack module refresh -m tcl -m lmod ...` has been moved. Try this instead:

        $ spack module tcl refresh --delete-tree -y cmake lmod ^python
        $ spack module lmod refresh --delete-tree -y cmake lmod ^python

Copy link
Copy Markdown
Member

@tgamblin tgamblin left a comment

Choose a reason for hiding this comment

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

@alalazo: this is looking very good to me. One last question on recursive loading below.

fi ;;
"load")
if _sp_full_spec=$(command spack $_sp_flags module loads --input-only $_sp_subcommand_args --module-type tcl "${_sp_spec[@]}"); then
if _sp_full_spec=$(command spack $_sp_flags module tcl find $_sp_subcommand_args "${_sp_spec[@]}"); then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@alalazo: doesn't this and the rest of d4b4be4 get rid of the loading of dependencies? Is this PR a decent place to fix that or is this something you want to save for later? I can't find the PR where we recently discussed this, but I do think the default module scheme should load transitive run dependencies by default.

@michaelkuhn: can you comment on this PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This keeps the existing behavior, that is, spack load spec only loads spec and spack load -r spec loads spec and all of its dependencies.

I agree that autoloading (at least) the run dependencies by default makes sense. I have been using autoload: 'all' for quite some time for our installation since users kept forgetting to use -r. Maybe a new autoload option would make sense for this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The issue where we discussed this was #8639.

Copy link
Copy Markdown
Member Author

@alalazo alalazo Jul 24, 2018

Choose a reason for hiding this comment

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

Is this PR a decent place to fix that or is this something you want to save for later?

If it is fine with you I'd save this for a later (and smaller) PR. In any case I plan to continue working on module issues in the next couple of weeks.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

doesn't this and the rest of d4b4be4 get rid of the loading of dependencies?

No, this keeps the current behavior, except that it prevents spack load from loading multiple versions of the same package (see #6676).

@tgamblin
Copy link
Copy Markdown
Member

I think the only thing this needs is more tests!

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Jul 24, 2018

I think the only thing this needs is more tests!

Do you have anything in particular in mind? I added regressions for #2215, #2570 and #4400

@tgamblin tgamblin merged commit 5b8b7a5 into spack:develop Jul 24, 2018
@tgamblin
Copy link
Copy Markdown
Member

It looks like spack module loads is not tested, so there should really be a test case for that. I think that can be a separate PR though.

@alalazo alalazo deleted the features/separate_module_commands branch July 25, 2018 08:24
alalazo added a commit to alalazo/spack that referenced this pull request Aug 13, 2021
The commands have been deprecated in spack#7098, and have
been failing with an error message since then.

Cleaning the code since it is unlikely that somebody
is still using them.
tgamblin pushed a commit that referenced this pull request Aug 13, 2021
The commands have been deprecated in #7098, and have
been failing with an error message since then.

Cleaning the code since it is unlikely that somebody
is still using them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

7 participants