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
859fb5c5
Commit
859fb5c5
authored
1 year ago
by
Ashwin Kumar Karnad
Browse files
Options
Downloads
Patches
Plain Diff
return toolchains after creating env and test them
parent
b5e7c510
No related branches found
No related tags found
2 merge requests
!19
Move linux-debian11 into main
,
!1
Resolve "First draft for user interface for top level install command"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
install-mpsd-software-environment.py
+14
-3
14 additions, 3 deletions
install-mpsd-software-environment.py
tests.py
+5
-1
5 additions, 1 deletion
tests.py
with
19 additions
and
4 deletions
install-mpsd-software-environment.py
+
14
−
3
View file @
859fb5c5
...
...
@@ -50,7 +50,7 @@ class os_chdir:
os
.
chdir
(
self
.
saved_dir
)
def
setup_log_cmd
(
shared_var
,
msg
=
None
):
def
setup_log_cmd
(
msg
=
None
,
*
args
,
**
kwargs
):
# Create log directory if it doesn't exist
if
not
os
.
path
.
exists
(
"
logs
"
):
os
.
makedirs
(
"
logs
"
)
...
...
@@ -65,7 +65,18 @@ def setup_log_cmd(shared_var, msg=None):
f
.
write
(
msg
+
"
\n
"
)
else
:
f
.
write
(
"
-
"
*
50
+
"
\n
"
)
# Gather data to log
# call statement:
cmd_line
=
"
"
.
join
(
sys
.
argv
)
# script branch and commit hash
script_branch
=
subprocess
.
run
([
"
git
"
,
"
rev-parse
"
,
"
--abbrev-ref
"
,
"
HEAD
"
],
stdout
=
subprocess
.
PIPE
).
stdout
.
decode
().
strip
()
script_commit_hash
=
subprocess
.
run
([
"
git
"
,
"
rev-parse
"
,
"
--short
"
,
"
HEAD
"
],
stdout
=
subprocess
.
PIPE
).
stdout
.
decode
().
strip
()
# spack-environments branch and commit hash from kwargs
spe_branch
=
kwargs
.
get
(
"
spe_branch
"
,
None
)
spe_commit_hash
=
kwargs
.
get
(
"
spe_commit_hash
"
,
None
)
# Write to log file
f
.
write
(
f
"
{
datetime
.
datetime
.
now
().
isoformat
()
}
,
{
cmd_line
}
\n
"
)
f
.
write
(
f
"
Software environment installer branch:
{
shared_var
[
'
script_branch
'
]
}
(commit hash:
{
shared_var
[
'
script_commit_hash
'
]
}
)
\n
"
...
...
@@ -112,8 +123,8 @@ def prepare_environment(mpsd_release, script_dir):
.
strip
()
)
available_toolchains
=
os
.
listdir
(
"
toolchains
"
)
setup_log_cmd
(
s
hared_var
)
return
shared_var
setup_log_cmd
(
s
pe_branch
=
spe_branch
,
spe_commit_hash
=
spe_commit_hash
)
return
available_toolchains
def
install_environment
(
...
...
This diff is collapsed.
Click to expand it.
tests.py
+
5
−
1
View file @
859fb5c5
...
...
@@ -35,7 +35,7 @@ def test_prepare_environment(tmp_path):
# check that the test directory does not exist
assert
not
script_dir
.
exists
()
mod
.
prepare_environment
(
result
=
mod
.
prepare_environment
(
mpsd_release
=
mpsd_release_to_test
,
script_dir
=
str
(
script_dir
)
)
# wait for 20 seconds for the git clone to finish
...
...
@@ -55,6 +55,10 @@ def test_prepare_environment(tmp_path):
.
split
(
"
\n
"
)[
0
]
==
f
"
*
{
mpsd_release_to_test
}
"
)
# check that result is a list and contains atleast ['global','foss2021a-mpi']
assert
isinstance
(
result
,
list
)
assert
"
global
"
in
result
assert
"
foss2021a-mpi
"
in
result
def
test_setup_log_cmd
(
tmp_path
):
...
...
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