Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mpsd-software-manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MPSD Computational Science
mpsd-software-manager
Commits
f10e95db
Commit
f10e95db
authored
1 year ago
by
Ashwin Kumar Karnad
Browse files
Options
Downloads
Patches
Plain Diff
use . instead of source to be POSIX compliant
parent
79fcc02b
Branches
Branches containing commit
No related tags found
1 merge request
!82
Remove cmd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mpsd_software_manager/mpsd_software.py
+32
-7
32 additions, 7 deletions
src/mpsd_software_manager/mpsd_software.py
tests/test_mpsd_software.py
+2
-1
2 additions, 1 deletion
tests/test_mpsd_software.py
with
34 additions
and
8 deletions
src/mpsd_software_manager/mpsd_software.py
+
32
−
7
View file @
f10e95db
...
@@ -1079,17 +1079,41 @@ def install_environment(
...
@@ -1079,17 +1079,41 @@ def install_environment(
def
remove_environment
(
mpsd_release
,
root_dir
,
package_sets
=
"
NONE
"
,
force_remove
=
False
):
def
remove_environment
(
mpsd_release
,
root_dir
,
package_sets
=
"
NONE
"
,
force_remove
=
False
):
"""
Remove release from installation.
"""
"""
Remove release from installation.
Handle 3 situations :
1. remove dosent specify what to remove
-> warn and exit
2. remove all package_sets from release
-> remove release folder except logs
3. remove specific package_sets from release
-> remove spack environments via spack commands
Parameters
----------
mpsd_release : str
A string representing the MPSD release version.
root_dir : pathlib.Path
A Path object representing the path to the directory where
the release and package_sets will be installed.
package_sets : list of str
A list of strings representing the package_sets to install
(e.g.,
"
foss2021a-mpi
"
,
"
global_generic
"
,
"
ALL
"
).
force_remove : bool, optional
A boolean indicating whether to force remove the release.
If False, the user will be prompted to confirm the removal.
Defaults to False.
Raises
------
ValueError
"""
msg
=
(
msg
=
(
f
"
Removing release
{
mpsd_release
}
"
f
"
Removing release
{
mpsd_release
}
"
f
"
with package_sets
{
package_sets
}
from
{
root_dir
}
"
f
"
with package_sets
{
package_sets
}
from
{
root_dir
}
"
)
)
logging
.
warning
(
msg
)
logging
.
warning
(
msg
)
# Handle 3 situations :
# 1. remove dosent specify what to remove -> warn and exit
# 2. remove all package_sets from release -> remove release folder except logs
# 3. remove specific package_sets from release
# -> remove spack environments via spack commands
if
package_sets
==
"
NONE
"
:
if
package_sets
==
"
NONE
"
:
logging
.
warning
(
logging
.
warning
(
...
@@ -1133,7 +1157,8 @@ def remove_spack_environment(spack_dir, environment_name):
...
@@ -1133,7 +1157,8 @@ def remove_spack_environment(spack_dir, environment_name):
logging
.
warning
(
f
"
Removing spack environment
{
environment_name
}
"
)
logging
.
warning
(
f
"
Removing spack environment
{
environment_name
}
"
)
spack_env
=
spack_dir
/
"
share
"
/
"
spack
"
/
"
setup-env.sh
"
spack_env
=
spack_dir
/
"
share
"
/
"
spack
"
/
"
setup-env.sh
"
commands_to_execute
=
[
commands_to_execute
=
[
f
"
source
{
spack_env
}
"
,
f
"
export SPACK_DIR=
{
spack_dir
}
"
,
f
"
.
{
spack_env
}
"
,
f
"
spack env activate
{
environment_name
}
"
,
f
"
spack env activate
{
environment_name
}
"
,
f
"
for spec in $(spack -e
{
environment_name
}
find
"
# this line continues
f
"
for spec in $(spack -e
{
environment_name
}
find
"
# this line continues
r
'
--format
"
{name}@{version}%{compiler.name}@{compiler.version}
"
);do
'
r
'
--format
"
{name}@{version}%{compiler.name}@{compiler.version}
"
);do
'
...
...
This diff is collapsed.
Click to expand it.
tests/test_mpsd_software.py
+
2
−
1
View file @
f10e95db
...
@@ -778,7 +778,8 @@ def test_remove_package_sets(tmp_path, simple_toolchain):
...
@@ -778,7 +778,8 @@ def test_remove_package_sets(tmp_path, simple_toolchain):
# check that zlib@1.2 is still installed
# check that zlib@1.2 is still installed
# spack location -i <package> exit 0 if installed and 1 if not installed
# spack location -i <package> exit 0 if installed and 1 if not installed
source_spack
=
(
source_spack
=
(
f
'
source
{
release_dir
/
"
spack
"
/
"
share
"
/
"
spack
"
/
"
setup-env.sh
"
}
'
f
"
export SPACK_DIR=
{
release_dir
}
&&
"
f
'
.
{
release_dir
/
"
spack
"
/
"
share
"
/
"
spack
"
/
"
setup-env.sh
"
}
'
)
)
mod
.
run
(
f
"
{
source_spack
}
&& spack location -i zlib
"
,
shell
=
True
,
check
=
True
)
mod
.
run
(
f
"
{
source_spack
}
&& spack location -i zlib
"
,
shell
=
True
,
check
=
True
)
# check that zstd@1.5 is not installed
# check that zstd@1.5 is not installed
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment