Skip to content

Truncate spack concretize output in environments#44386

Closed
scheibelp wants to merge 2 commits intospack:developfrom
scheibelp:features/truncate-env-concretize-output
Closed

Truncate spack concretize output in environments#44386
scheibelp wants to merge 2 commits intospack:developfrom
scheibelp:features/truncate-env-concretize-output

Conversation

@scheibelp
Copy link
Copy Markdown
Member

If you have an environment speclist like:

spack:
  specs:
  - x
  - y
  - z

where x -> y -> z, spack concretize ... will print each of x, y, z completely. This PR reduces duplication by omitting a printout of any root spec that is a dependency of another root spec.

This does not eliminate all forms of duplication, e.g. if x->z and y->z, but ! x->y, then z would be printed for each of x, y.

@spackbot-app spackbot-app bot added core PR affects Spack core functionality environments tests General test capability(ies) labels May 25, 2024
@scheibelp scheibelp changed the title Truncate env concretize output Truncate spack concretize output in environments May 25, 2024
@haampie
Copy link
Copy Markdown
Member

haampie commented May 27, 2024

Bit surprised to see a PR since this has been discussed at various points over the last couple years.

I agree that output is too verbose, but I don't think this implementation is best exactly for the reasons mentioned: shared deps. What's the point of printing python and its dependencies 10 times if you have 10 python packages as roots.

To me it makes more sense to use traverse.traverse_tree(env.concrete_roots(), cover="nodes", depth_first=False) so every node is printed only once.

That's pretty trivial, except you need to have some callback to print section headers for abstract roots.

@scheibelp
Copy link
Copy Markdown
Member Author

What's the point of printing python and its dependencies 10 times if you have 10 python packages as roots.

I can handle shared deps as well, although:

  • I think if someone has an env with 10-20 py-* packages that they might not want to list them at all in the concretize output, at least one line at a time.
  • For x->z, y->z, ! x->y, I wonder if it would make sense to show z but not dependencies of z, or otherwise indicate that y is truncated

@scheibelp
Copy link
Copy Markdown
Member Author

@tgamblin ping since you mentioned an interest

@haampie
Copy link
Copy Markdown
Member

haampie commented May 31, 2024

That's pretty trivial, except you need to [...]

... and account for bugs ;)

Something like:

tree = traverse.traverse_tree(env.concrete_roots(), depth_first=False, key=traverse.by_dag_hash)
for (depth, edge) in tree:
  if depth == 0:
    # format corresponding abstract spec
  # format edge.spec

where key=traverse.by_dag_hash is sometimes needed (when specs come straight out of the concretizer they are separate instances)

@tgamblin
Copy link
Copy Markdown
Member

tgamblin commented Jun 2, 2024

@scheibelp take a look at #44489

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

Labels

core PR affects Spack core functionality environments tests General test capability(ies)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants