Skip to content

Added a new command to filter input specs based on their properties#7899

Closed
alalazo wants to merge 1 commit intospack:developfrom
epfl-scitas:features/filter_command
Closed

Added a new command to filter input specs based on their properties#7899
alalazo wants to merge 1 commit intospack:developfrom
epfl-scitas:features/filter_command

Conversation

@alalazo
Copy link
Copy Markdown
Member

@alalazo alalazo commented Apr 25, 2018

Added a new command that permits to filter specs based on their properties. The main use case is to help scripting continuous deployment pipelines.

Let me know if this can be of use outside our Jenkins pipeline. Otherwise I'll close the PR.

Example

$ spack find  hdf5 [email protected] [email protected] [email protected] flex
==> 3 installed packages.
-- linux-ubuntu14.04-x86_64 / [email protected] ---------------------------
[email protected]  [email protected]  [email protected]

$ spack filter --installed hdf5 [email protected] [email protected] [email protected] flex
[email protected]
[email protected]
flex

$ spack filter --installed --implicit hdf5 [email protected] [email protected] [email protected] flex
flex

$ spack filter --not-installed  hdf5 [email protected] [email protected] [email protected] flex
hdf5
[email protected]

also fixes #8033

Added a new command that permits to filter specs based on their
properties. The main use case is to help scripting continuous deployment
pipelines.
@adamjstewart
Copy link
Copy Markdown
Member

Why not simply add these features to spack find?

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Apr 25, 2018

@adamjstewart The two commands match arguments in different ways:

  • spack find matches constraints on what is installed and accepts anonymous specs.
  • this command accepts only non-anonymous specs and concretizes them the same way install does

Wouldn't it be confusing to have the functionality in the same command?

@healther
Copy link
Copy Markdown
Contributor

In the beginning I always got confused between spack list and spack find, maybe this is a reason to think about the general user interface again. Here you essentially say: There is a number of specs (most likely a "should be there"-list) and I want to see which of those are available and which need to be installed. Then there is spack list which gives you the packages that exist in spack, w/o regard to their installed status or concretisation and there is spack find which only operates on installed packages.

I'm not sure if this shouldn't all be done with one interface. I.e. only having a spack find that can either search the installed packages, the available packages, or concretise the input (as install would do) and then report the status of these specs.

Not sure if this should be done here, but this might serve as a starting point for this discussion

@citibeth
Copy link
Copy Markdown
Member

citibeth commented May 5, 2018

spack spec -Il or spack env <env> list -Ilr, in conjunction with grep, might also work.

@davydden
Copy link
Copy Markdown
Member

davydden commented May 7, 2018

I think a new name for the command (spack filter) to do the job is better than trying to add this functionality to the existing spack find. Also the output format appears to be tailored for scripting.

Wouldn't it be confusing to have the functionality in the same command?

👍

import spack
import spack.cmd

description = "filter specs based on their properties"
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.

Given your comment

spack find matches constraints on what is installed and accepts anonymous specs.
this command accepts only non-anonymous specs and concretizes them the same way install does

this command is principally different from spack find (which is good).
Can you elaborate description to include this discussion?

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.

p.s. you can also give users some hints where that command might be of use

@davydden
Copy link
Copy Markdown
Member

@alalazo anything prevents this PR from being merged? I would really like to use this nice feature, that is waiting to be merged since May 2018 ;-(

@adamjstewart @tgamblin could you guys review?

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Jan 16, 2019

@davydden Another option that works for me would be to push forward #8612 and provide this command externally in another repo, if its use is foreseen not to be widespread enough to justify being in the main line.

@alalazo alalazo closed this Aug 24, 2019
@alalazo alalazo deleted the features/filter_command branch August 24, 2019 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use spack find from bash to check if a spec is installed

5 participants