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
84887f0f
Commit
84887f0f
authored
1 year ago
by
Ashwin Kumar Karnad
Browse files
Options
Downloads
Patches
Plain Diff
rename mpsd_microarch to sys_microarch
parent
0d1cbdf1
No related branches found
No related tags found
1 merge request
!40
Rename a few variables and function names for clarity
Pipeline
#370323
passed
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mpsd-software-environment.py
+13
-13
13 additions, 13 deletions
mpsd-software-environment.py
tests.py
+13
-13
13 additions, 13 deletions
tests.py
with
26 additions
and
26 deletions
mpsd-software-environment.py
+
13
−
13
View file @
84887f0f
...
...
@@ -46,7 +46,7 @@ config_vars = {
def
create_log_file_names
(
mpsd_release
:
str
,
mpsd
_microarch
:
str
,
sys
_microarch
:
str
,
action
:
str
,
date
:
str
=
call_date_iso
,
toolchain
:
str
=
None
,
...
...
@@ -66,7 +66,7 @@ def create_log_file_names(
----------
mpsd_release : str
MPSD software stack version
mpsd
_microarch : str
sys
_microarch : str
system architecture
date : str
date of the call ins iso format
...
...
@@ -89,13 +89,13 @@ def create_log_file_names(
# if toolchain is given, then we build the build_log_file_name
if
action
in
[
"
install
"
,
"
remove
"
]:
log_file_name
=
(
f
"
{
mpsd_release
}
_
{
mpsd
_microarch
}
_
{
date
}
_BUILD_
{
toolchain
}
_
{
action
}
.log
"
f
"
{
mpsd_release
}
_
{
sys
_microarch
}
_
{
date
}
_BUILD_
{
toolchain
}
_
{
action
}
.log
"
)
else
:
return
None
else
:
# if toolchain is not given, then we build the installer_log_file_name
log_file_name
=
f
"
{
mpsd_release
}
_
{
mpsd
_microarch
}
_
{
date
}
_APEX_
{
action
}
.log
"
log_file_name
=
f
"
{
mpsd_release
}
_
{
sys
_microarch
}
_
{
date
}
_APEX_
{
action
}
.log
"
return
log_file_name
...
...
@@ -151,11 +151,11 @@ def get_installer_log_file_path(mpsd_release: str, cmd: str, root_dir: str) -> s
"""
Get installer log file path.
"""
# Get machine configs
os
.
environ
.
get
(
"
MPSD_OS
"
,
"
UNKNOWN_OS
"
)
mpsd
_microarch
=
get_native_microarchitecture
()
sys
_microarch
=
get_native_microarchitecture
()
# parse logging first
# decide the log_file_name
installer_log_name
=
create_log_file_names
(
mpsd_release
=
mpsd_release
,
mpsd
_microarch
=
mpsd
_microarch
,
action
=
cmd
mpsd_release
=
mpsd_release
,
sys
_microarch
=
sys
_microarch
,
action
=
cmd
)
log_folder
=
root_dir
/
mpsd_release
/
"
logs
"
# if the log_folder dosent exist, dont log this message if
...
...
@@ -644,13 +644,13 @@ def prepare_environment(mpsd_release: str, root_dir: Path) -> List[str]:
def
get_native_microarchitecture
():
"""
Return native microarchitecture.
On MPSD machines, there should be an environment variable
"
MPSD_MICROARCH
"
.
On MPSD machines, there should be an environment variable
"
sys_microarch
"
.
We try to read that. If it fails, we use the
'
archspec cpu
'
command.
If that fails, we ask the user to install it.
Returns
-------
MPSD_MICROARCH
: str
sys_microarch
: str
Example
-------
...
...
@@ -660,13 +660,13 @@ def get_native_microarchitecture():
# attempt to get MICRO_ARCH from environment variable (should work on
# MPSD_HPC and MPSD linux laptops). If not defined, return
# "UNKNOWN_MICROARCH"
microarch
=
os
.
environ
.
get
(
"
MPSD_MICROARCH
"
,
"
UNKNOWN_MICROARCH
"
)
microarch
=
os
.
environ
.
get
(
"
sys_microarch
"
,
"
UNKNOWN_MICROARCH
"
)
# if we have not found the microarchitecture environment variable,
# try calling archspec
if
microarch
==
"
UNKNOWN_MICROARCH
"
:
logging
.
debug
(
"
Couldn
'
t find
MPSD_MICROARCH
environment variable. Will try archspec.
"
"
Couldn
'
t find
sys_microarch
environment variable. Will try archspec.
"
)
try
:
process
=
run
([
"
archspec
"
,
"
cpu
"
],
stdout
=
subprocess
.
PIPE
,
text
=
True
)
...
...
@@ -741,8 +741,8 @@ def install_environment(
# Set required variables
release_base_dir
=
root_dir
/
mpsd_release
mpsd
_microarch
=
get_native_microarchitecture
()
toolchain_dir
=
release_base_dir
/
mpsd
_microarch
sys
_microarch
=
get_native_microarchitecture
()
toolchain_dir
=
release_base_dir
/
sys
_microarch
toolchain_dir
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
spack_setup_script
=
release_base_dir
/
"
spack-environments
"
/
"
spack_setup.sh
"
install_flags
=
[]
...
...
@@ -781,7 +781,7 @@ def install_environment(
for
toolchain
in
toolchains
:
# Set the install log file name from create_log_file_names
build_log_file_name
=
create_log_file_names
(
mpsd_release
,
mpsd
_microarch
,
"
install
"
,
toolchain
=
toolchain
mpsd_release
,
sys
_microarch
,
"
install
"
,
toolchain
=
toolchain
)
build_log_folder
=
release_base_dir
/
"
logs
"
build_log_path
=
build_log_folder
/
build_log_file_name
...
...
This diff is collapsed.
Click to expand it.
tests.py
+
13
−
13
View file @
84887f0f
...
...
@@ -228,7 +228,7 @@ def test_install_environment_zlib():
mpsd_release_to_test
=
"
dev-23a
"
toolchain_to_test
=
"
global_generic
"
cmd_log_file
=
mod
.
config_vars
[
"
cmd_log_file
"
]
mpsd
_microarch
=
mod
.
get_native_microarchitecture
()
sys
_microarch
=
mod
.
get_native_microarchitecture
()
release_base_dir
=
root_dir
/
mpsd_release_to_test
create_mock_git_repository
(
target_directory
=
root_dir
,
create_directory
=
False
)
mod
.
prepare_environment
(
mpsd_release
=
mpsd_release_to_test
,
root_dir
=
(
root_dir
))
...
...
@@ -283,13 +283,13 @@ def test_install_environment_zlib():
)
# test that the build log is created correctly
# check that a file with glob build_globale_generic_dev-23a*.log exists at
# release_base_dir/
mpsd
_microarch
# release_base_dir/
sys
_microarch
# print("Debug here ")
# time.sleep(10)
build_log
=
list
(
(
release_base_dir
/
"
logs
"
).
glob
(
f
"
{
mpsd_release_to_test
}
_
{
mpsd
_microarch
}
_*_install.log
"
f
"
{
mpsd_release_to_test
}
_
{
sys
_microarch
}
_*_install.log
"
)
)
assert
len
(
build_log
)
==
2
...
...
@@ -312,11 +312,11 @@ def test_install_environment_zlib():
f
"
installing
{
toolchain_to_test
}
and logging at
{
str
(
build_log
)
}
"
in
lines
)
# assert that the module files are created correctly
assert
os
.
path
.
exists
(
release_base_dir
/
mpsd
_microarch
)
assert
os
.
path
.
exists
(
release_base_dir
/
mpsd
_microarch
/
"
lmod
"
)
assert
os
.
path
.
exists
(
release_base_dir
/
sys
_microarch
)
assert
os
.
path
.
exists
(
release_base_dir
/
sys
_microarch
/
"
lmod
"
)
# assert that lmod/module-index.yaml contains zlib
with
open
(
release_base_dir
/
mpsd
_microarch
/
"
lmod
"
/
"
module-index.yaml
"
,
"
r
"
release_base_dir
/
sys
_microarch
/
"
lmod
"
/
"
module-index.yaml
"
,
"
r
"
)
as
f
:
lines
=
f
.
read
()
assert
"
zlib
"
in
lines
...
...
@@ -338,7 +338,7 @@ def test_install_environment_zlib():
)
build_log
=
list
(
(
release_base_dir
/
"
logs
"
).
glob
(
f
"
{
mpsd_release_to_test
}
_
{
mpsd
_microarch
}
_*_install.log
"
f
"
{
mpsd_release_to_test
}
_
{
sys
_microarch
}
_*_install.log
"
)
)
assert
len
(
build_log
)
==
4
...
...
@@ -387,13 +387,13 @@ def test_create_log_file_names():
"""
Test that the log file names are created correctly.
"""
create_log_file_names
=
mod
.
create_log_file_names
mpsd_release
=
"
dev-23a
"
mpsd
_microarch
=
"
sandybridge
"
sys
_microarch
=
"
sandybridge
"
date
=
datetime
.
datetime
.
now
().
replace
(
microsecond
=
0
).
isoformat
()
action
=
"
install
"
toolchain
=
"
foss2021a
"
# test build_log_file_name generation
build_log_file_name
=
create_log_file_names
(
mpsd
_microarch
=
mpsd
_microarch
,
sys
_microarch
=
sys
_microarch
,
mpsd_release
=
mpsd_release
,
date
=
date
,
action
=
action
,
...
...
@@ -401,21 +401,21 @@ def test_create_log_file_names():
)
assert
(
build_log_file_name
==
f
"
{
mpsd_release
}
_
{
mpsd
_microarch
}
_
{
date
}
_BUILD_
{
toolchain
}
_
{
action
}
.log
"
==
f
"
{
mpsd_release
}
_
{
sys
_microarch
}
_
{
date
}
_BUILD_
{
toolchain
}
_
{
action
}
.log
"
)
installer_log_file_name
=
create_log_file_names
(
mpsd
_microarch
=
mpsd
_microarch
,
sys
_microarch
=
sys
_microarch
,
mpsd_release
=
mpsd_release
,
date
=
date
,
action
=
action
,
)
assert
(
installer_log_file_name
==
f
"
{
mpsd_release
}
_
{
mpsd
_microarch
}
_
{
date
}
_APEX_
{
action
}
.log
"
==
f
"
{
mpsd_release
}
_
{
sys
_microarch
}
_
{
date
}
_APEX_
{
action
}
.log
"
)
# test no build log file for incorrect action
build_log_file_name
=
create_log_file_names
(
mpsd
_microarch
=
mpsd
_microarch
,
sys
_microarch
=
sys
_microarch
,
mpsd_release
=
mpsd_release
,
date
=
date
,
action
=
"
status
"
,
...
...
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