-
Couldn't load subscription status.
- Fork 214
Extract dependency graph for package in stack #2784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ocaisa
wants to merge
10
commits into
easybuilders:develop
Choose a base branch
from
ocaisa:tolerate_edges
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c8ea243
Tolerate existing edges in digraph
46808d9
Merge branch 'develop' into tolerate_edges
70f99cc
Add explanatory comment and logging
19d797e
Add script that extracts node from large dotfile
5ac33e7
Add execution permission to new script
556428e
Address comments
b9153f1
Merge branch 'develop' into tolerate_edges
601f586
Update extract_node_from_dotfile.sh
ocaisa 7c86f8e
Update extract_node_from_dotfile.sh
ocaisa d2852a6
Update extract_node_from_dotfile.sh
ocaisa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| #!/bin/bash | ||
ocaisa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ## | ||
| # Copyright 2012-2019 Ghent University | ||
| # | ||
| # This file is part of EasyBuild, | ||
| # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), | ||
| # with support of Ghent University (http://ugent.be/hpc), | ||
| # the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), | ||
| # Flemish Research Foundation (FWO) (http://www.fwo.be/en) | ||
| # and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). | ||
| # | ||
| # https://github.com/easybuilders/easybuild | ||
| # | ||
| # EasyBuild is free software: you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation v2. | ||
| # | ||
| # EasyBuild is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. | ||
| ## | ||
|
|
||
| # @author: Alan O'Cais (Juelich Supercomputing Centre) | ||
|
|
||
| ## | ||
| # Use case: | ||
| # | ||
| # A large dotfile that contains all software installed with EasyBuild can be generated with a command line such as: | ||
| # eb --dep-graph=depgraph.dot $EASYBUILD_INSTALLPATH/software/*/*/easybuild/*.eb | ||
| # Such a dotfile is (typically) too large to deal with directly. This script can extract a particular node from such a | ||
| # dotfile, e.g., | ||
| # ./<script> <input dot file> <output dot file> "Compiler/GCCcore/7.3.0/h5py/2.8.0-serial-Python-3.6.6" | ||
| # which can be used to help evaluate the impact of uninstalling that particular software package | ||
| ## | ||
|
|
||
| find_children () { | ||
| local input_dotfile=$1 | ||
| local output_dotfile=$2 | ||
| local node_to_search_for=$3 | ||
| # The fact that we put the semicolon straight after means we exclude anywhere the module | ||
| # is only required as a build dependency (since these cases have extra formatting the | ||
| # semicolon comes later); | ||
| # the sed command makes sure we ignore whether the module is hidden or not | ||
| grep ' "'${node_to_search_for}'";' ${input_dotfile} | sed s#/\\.#/#g >> ${output_dotfile} | ||
| grep ' "'${node_to_search_for}'";' ${input_dotfile} | awk '{print $1}'| \ | ||
| xargs -i bash -c "map_dep ${input_dotfile} ${output_dotfile} {}" | ||
| } | ||
|
|
||
| map_dep () { | ||
| local input_dotfile=$1 | ||
| local output_dotfile=$2 | ||
| local node_to_search_for=$3 | ||
| # Search for a node that matches the string and add a comment marker at the end | ||
| # to leverage with grep later | ||
| # (if non-installed software had additional formatting they would be ignored) | ||
| # the sed command makes sure we ignore whether the module is hidden or not | ||
| grep "^"'"'${node_to_search_for}'";' ${input_dotfile} | awk '{print $1" // xxnodexx"}' | \ | ||
| sed s#/\\.#/#g >> ${output_dotfile} | ||
| if [ $? ] | ||
| then | ||
| find_children ${input_dotfile} ${output_dotfile} ${node_to_search_for} | ||
| fi | ||
| } | ||
|
|
||
| export -f find_children | ||
| export -f map_dep | ||
|
|
||
| # Check command line | ||
| if [ "$#" -ne 3 ]; then | ||
| echo -e "Expected command line:\n\t<script> <input dot file> <output dot file> <node to search for>" | ||
| exit 1 | ||
| fi | ||
|
|
||
ocaisa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| input_dotfile=$1 | ||
| output_dotfile=$2 | ||
| node_to_search_for=$3 | ||
|
|
||
| # Begin digraph in output file | ||
| echo digraph graphname \{ > ${output_dotfile} | ||
|
|
||
| # Use a temporary file to store nodes and edges | ||
| tmpfile=`mktemp` | ||
| # initialise the file | ||
| > ${tmpfile} | ||
|
|
||
| # Gather nodes and edges related to ${node_to_search_for} | ||
| map_dep ${input_dotfile} ${tmpfile} ${node_to_search_for} | ||
|
|
||
| # There is potential duplication due to nodes being followed multiple times so let's | ||
| # remove it: | ||
| # put nodes first (we used a marker to identify them), make sure they are unique | ||
| cat ${tmpfile} | sort | uniq | grep xxnodexx >> ${output_dotfile} | ||
| # Then edges, also make sure they are unique | ||
| cat ${tmpfile} | sort | uniq | grep -v xxnodexx >> ${output_dotfile} | ||
|
|
||
| # Clean up | ||
| rm ${tmpfile} | ||
| echo \} >> ${output_dotfile} | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.