Skip to content

Feature/external#2507

Closed
mamelara wants to merge 16 commits intospack:developfrom
mamelara:feature/external
Closed

Feature/external#2507
mamelara wants to merge 16 commits intospack:developfrom
mamelara:feature/external

Conversation

@mamelara
Copy link
Copy Markdown
Member

@mamelara mamelara commented Dec 7, 2016

First working design for new spack external add/rm/list command. Would like some feedback on it.

Usage works as follows:
spack external add [package_spec] [path_or_module_for_external_pkg]
spack external rm [package_spec]
spack external list
All take an optional scope flag

external add
The external add command takes in a package spec (with or without a package version) and either a path or module name. This information is passed to the ExternalPackage class which then validates the path or module and attempts to detect a version. If a version is not detected and the user did not specify a version in the spec, a version is spit out. Otherwise, that version is appended to the spec. An external package object is created and is used to add an entry to packages.yaml.

example:

└┤[16:53] ➜ spack external add [email protected]%[email protected] cray-mpich/7.4.4
==> Added [email protected]%[email protected] to /global/homes/m/mamelara/.spack/cray/packages.yaml

external rm
The external rm command also takes as input a package_spec. It will remove the specified spec entry from a package. If that package entry is empty (no specs) then that entire package entry is removed.

example:

┌[mamelara::spack
└┤[16:54] ➜ spack external rm [email protected]%[email protected]
==> Removed package: [email protected]%[email protected]
==> Removed mpich

external list
Outputs the contents of a list. Similar to compiler list.

output:

┌[mamelara::spack
└┤[16:56] ➜ spack external list
==> Available external packages
-- petsc --------------------------------------------------------
[email protected]%[email protected]   cray-petsc/3.6.1.0

-- mkl ----------------------------------------------------------
[email protected]%[email protected]   /opt/intel/compilers_and_libraries_2016.3.210/linux/mkl

-- netcdf -------------------------------------------------------
[email protected]%[email protected]   cray-netcdf/4.4.1
[email protected]%[email protected]          cray-netcdf/4.4.1

-- hdf5 ---------------------------------------------------------
[email protected]%[email protected]          cray-hdf5/1.8.16
[email protected]%[email protected]   cray-hdf5/1.8.14
[email protected]%[email protected]   cray-hdf5/1.8.16

So far I've tested this on Cori and on my Mac. Please feel free to comment on it and I'm open to all kinds of suggestions and looking to improve functionality and design. Thanks!

Note: I'm not too excited about how I have been detecting versions from packages. Currently, I just look through the path for something that looks like a version and stick it on to the spec string. I also parse the output of module avail but not sure if my way is too NERSC specific.

Another thing, I added more tests and a mock modulefiles path to test modulecmd with fake modulefiles. Hopefully people will find that useful.

@mamelara
Copy link
Copy Markdown
Member Author

mamelara commented Dec 7, 2016

how do I label WIP?

@adamjstewart
Copy link
Copy Markdown
Member

@mamelara Add [WIP] to the start of the title and click on the gear next to labels to add WIP. If you have access that is. I'm not sure whether or not everyone can do the latter.

@mamelara mamelara changed the title Feature/external [WIP] Feature/external Dec 7, 2016
@adamjstewart
Copy link
Copy Markdown
Member

This is very interesting! I just got done ranting about how difficult it is to manually add external packages: #2504 (comment)

@davydden davydden added the WIP label Dec 7, 2016
@davydden
Copy link
Copy Markdown
Member

davydden commented Dec 7, 2016

First working design for new spack external add/rm/list command.

nice, it should certainly ease the pain of setting up external packages while still being precise in what is needed for each build! 👍

@davydden
Copy link
Copy Markdown
Member

davydden commented Dec 7, 2016

how do I label WIP?

i added the label

@citibeth
Copy link
Copy Markdown
Member

citibeth commented Dec 7, 2016

I like the general idea of this PR... Once the basic machinery is set up, I think the big challenge will be in detecting external packages and versions. That info could come from:

  1. Module files
  2. System repos (yum, apt-get, etc)
  3. Ad-hoc from the user

The next step would be a command that rifles through your system and finds all the external packages it can. This brings up questions of course. Spack would ideally want to construct a full spec for a package including variants and dependencies, not just its version number. Even just the version number could be tricky, a full spec even trickier...

And stuff that rifles through your system and finds versions (or even deduces versions from something the user gives) will be OS-specific. I would like to see this functionality broken out into a separate file with a clear API. Then we can start hanging more complexity into that file.

@becker33
Copy link
Copy Markdown
Member

becker33 commented Dec 8, 2016

@citibeth I agree that eventually this should be refactored into something that includes automatic external registration in Spack. I don't think that should hold up integration of this PR though. It's a useful feature, and I don't know what the timeframe will be for the fuller feature (it could come along with the full rework of compilers that models them as dependencies on virtual deps).

@mamelara
Copy link
Copy Markdown
Member Author

Could I get a review requested label on this? Thank you!

@davydden davydden added the RFC label Dec 16, 2016
@davydden
Copy link
Copy Markdown
Member

@tgamblin @alalazo @adamjstewart ping.

@davydden davydden changed the title [WIP] Feature/external Feature/external Dec 16, 2016
@alalazo alalazo requested a review from tgamblin December 16, 2016 08:38
@alalazo
Copy link
Copy Markdown
Member

alalazo commented Dec 16, 2016

@mamelara I added @tgamblin to the list of requested reviewers. Let me know if you want somebody more added to it.

@alalazo alalazo self-requested a review December 16, 2016 08:41
@alalazo
Copy link
Copy Markdown
Member

alalazo commented Dec 16, 2016

@mamelara @tgamblin After reading the description I also added myself: I really like the PR and would like to check it in the details. Don't consider my review "blocking" if this needs to be merged quickly.

Copy link
Copy Markdown
Member

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

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

This looks like a great start! We'll eventually want to add more tests for determining names and versions automatically (see #3181), but I think it would be good to merge this first and integrate that later.

P.S. A few files are missing licenses at the top. Other than that I couldn't see anything obviously broken.

@adamjstewart
Copy link
Copy Markdown
Member

Oh, documentation would be nice as well.

from spack.environment import EnvironmentModifications
from spack.external_package import ExternalPackage, SpecVersionMisMatch
import spack.spec
import spack.test.mock_packages_test as mock_test
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 line is causing the unit tests to fail.

@@ -0,0 +1,123 @@
import spack.architecture
import spack.test.mock_packages_test as mock_test
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 line is causing the unit tests to fail.

@alalazo alalazo self-assigned this Apr 19, 2017
mamelara added 13 commits May 22, 2017 12:05
Add new spack commands. Usage is spack external [cmd-option]. So far the
options include add, remove and list.
Committing work to update branch to llnl develop
Change attribute names, got rid of some property methods that are not
necessary.
Moved tty.msg output to cmd/external renamed some variables
Updated external_rm tests to follow new design and also updated
external_package.
Reworked external_rm so that it can display message when a spec
satisfies multiple entries. Similar to compiler rm, it will notify user
that multilple matches were found and tell them to use the optional -a,
--all flag. Changed some var names in external_package.
Made some flake8 changes and corrected some tests that failed on
TravisCI.

Fix sphinx doc tests.
Changed self.assertRaises tests to not use context manager.
Update tests to pytest

Squash commits to change tests

Squashing commits where I changed the tests to be updated to pytest
Update tests to pytest

Squash commits to change tests

Squashing commits where I changed the tests to be updated to pytest
Decided it was better design to have both add and remove functions
rather than using the external cmd have the main logic for removing.
@mamelara mamelara force-pushed the feature/external branch from 67cd029 to aa0b09d Compare May 22, 2017 20:37
mamelara added 3 commits May 25, 2017 16:21
Tests were failing and changed external remove also used external
package constructor instead of classmethod function.
@alalazo
Copy link
Copy Markdown
Member

alalazo commented Oct 19, 2017

@mamelara Are there any plans for this PR ? I think externals lack a decent CLI, so let me know if I can help.

@mamelara
Copy link
Copy Markdown
Member Author

mamelara commented Oct 19, 2017

This PR has grown stale. I would need to rebase and then maybe look through and adjust some of the methods since Spack has changed a lot since this was last worked on.

I was hoping to get some help with the design aspect of the code and also maybe improving the functionality. I was also working on detecting some defaults though I think that should be a separate PR and this should focus on the CLI interface instead. Any help is welcome!

I'll see if I can update this soon.

@pramodskumbhar
Copy link
Copy Markdown
Contributor

Wasn't aware of this PR. This will be of great help!

@Oximore
Copy link
Copy Markdown

Oximore commented Feb 2, 2018

This PR is really what we need to an easy use of Spack on cluster platforms.
As build openmpi, and lower libraries make is a poor choice in such envrionment.

I may be a little out topic but :

  1. How it integrate with module ?
  2. For external package detection have you think about using something like Find*.cmake ?

Have we an expected date for this PR to be merged ?

@amklinv
Copy link
Copy Markdown

amklinv commented Feb 8, 2018

I am also interested in this PR and whether it will be merged.

@luigi-calori
Copy link
Copy Markdown
Contributor

I would also be interested, would be good to at least rebase and resolve conflicts, so to ease the testing activity

@becker33
Copy link
Copy Markdown
Member

becker33 commented Feb 8, 2018

@Oximore @amklinv @luigi-calori This PR will be merged eventually. @mamelara and I will probably need to tweak the interface.

Eventually this should go along with automatic detection, but we don't have the technical solutions in place for that yet and it's a very hard problem.

@pramodk
Copy link
Copy Markdown
Contributor

pramodk commented Sep 23, 2018

@mamelara : This will be very helpful! I was looking for the functionality to "export" installed packages to packages.yaml. Is there any other way?

@tldahlgren
Copy link
Copy Markdown
Contributor

tldahlgren commented Aug 29, 2019

Closing to re-open to refresh check details since they are not available. (At least I was under the impression that would work but I guess not.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.