Merge branch 'gitlab_pages' into 'master'

ADD: Gitlab pages

See merge request Pmodules/dependency-checker!6
This commit is contained in:
germann_e 2023-02-08 08:42:32 +00:00
commit d4f3faf6a1
5 changed files with 49 additions and 10 deletions

View File

@ -1,4 +1,6 @@
stages: [check] stages:
- check
- pages
variables: variables:
COLUMNS: 9000 COLUMNS: 9000
@ -15,3 +17,29 @@ check:
- export COLUMNS=$COLUMNS - export COLUMNS=$COLUMNS
- export TERM=$TERM - export TERM=$TERM
- python3 pmodules_tools/pmodules_tools.py --deps-check - python3 pmodules_tools/pmodules_tools.py --deps-check
pages:
stage: pages
artifacts:
paths:
- public
image: ubuntu:20.04
script:
- apt update
- apt -y install pandoc
- mkdir -p /opt && pushd $_
- ln -s /afs/psi.ch/sys/psi.x86_64_el6 psi
- popd
- export PMODULES_VERSION=1.0.0rc14
- export COLUMNS=$COLUMNS
- export TERM=$TERM
- source /opt/psi/config/profile.bash
- module load Python
- mkdir public
- cd pmodules_tools/
- python3 pmodules_tools.py --db-check
- pandoc pmodules_changes.md -o index.html
- cp -v index.html $CI_PROJECT_DIR/public
when: always

View File

@ -1,8 +1,11 @@
# Pmodules tools # Pmodules tools
Dependency checker: <br>
[![Pipeline](https://git.psi.ch/Pmodules/dependency-checker/badges/master/pipeline.svg)](https://git.psi.ch/Pmodules/dependency-checker) [![Pipeline](https://git.psi.ch/Pmodules/dependency-checker/badges/master/pipeline.svg)](https://git.psi.ch/Pmodules/dependency-checker)
## Pages
[Pmodules Database Report](https://pmodules.gitpages.psi.ch/dependency-checker)
## Intro ## Intro
A python project to analyse Pmodules modules and their status changes. A python project to analyse Pmodules modules and their status changes.

View File

@ -32,12 +32,14 @@ def db_check_diff(current_pmodule_state, Pmodules_db_path, Pmodules_states):
print_pmodules_differences( print_pmodules_differences(
current_pmodule_state, old_pmodule_state, Pmodules_states current_pmodule_state, old_pmodule_state, Pmodules_states
) )
else:
print_to_markdown([], [], [])
# There is no database available or there are differences with the old pmodule state, writing current state. # There is no database available or there are differences with the old pmodule state, writing current state.
if no_current_db or compare_states_sha( if no_current_db or compare_states_sha(
current_pmodule_state, old_pmodule_state, current_sha current_pmodule_state, old_pmodule_state, current_sha
): ):
write_curent_state(current_pmodule_state, current_sha, Pmodules_db_path) write_current_state(current_pmodule_state, current_sha, Pmodules_db_path)
def compare_states_sha(current_pmodule_state, old_pmodule_state, current_sha): def compare_states_sha(current_pmodule_state, old_pmodule_state, current_sha):
@ -58,11 +60,11 @@ def print_to_markdown(new_module_list, deleted_module_list, changed_module_list)
for index in range(0, len(changed_module_list) - 1, 2): for index in range(0, len(changed_module_list) - 1, 2):
md_file.write( md_file.write(
changed_module_list[index] changed_module_list[index]
+ "<br>Changed state from " + "<br/>Changed state from "
+ changed_module_list[index + 1].split()[1] + changed_module_list[index + 1].split()[1]
+ " to ---> " + " to ---> "
+ changed_module_list[index].split()[1] + changed_module_list[index].split()[1]
+ "<br>" + "<br/>"
) )
standard_print(md_file, deleted_module_list, "Deleted modules:") standard_print(md_file, deleted_module_list, "Deleted modules:")
@ -143,10 +145,10 @@ def standard_print(file, module_list, string):
file.write("\n# " + string + " \n") file.write("\n# " + string + " \n")
for diff in module_list: for diff in module_list:
if diff != "": if diff != "":
file.write(diff + "<br>") file.write(diff + "<br/>")
def write_curent_state(current_pmodule_state, current_sha, Pmodules_db_path): def write_current_state(current_pmodule_state, current_sha, Pmodules_db_path):
# Emptying Pmodules database first # Emptying Pmodules database first
if os.path.exists(Pmodules_db_path): if os.path.exists(Pmodules_db_path):
shutil.rmtree(Pmodules_db_path) shutil.rmtree(Pmodules_db_path)

View File

@ -72,7 +72,11 @@ class PmodulePackage:
@staticmethod @staticmethod
@cache @cache
def Pmoduliser(pckg_name="", compiler="", mpi_provider=""): def Pmoduliser(pckg_name="", compiler="", mpi_provider=""):
default_module_cmd = "module search " + pckg_name + " -a --all-deps --no-header" default_module_cmd = (
"$PMODULES_HOME/bin/modulecmd bash search "
+ pckg_name
+ " -a --all-deps --no-header"
)
# try to precise the module search if compiler and/or mpi_provider are given # try to precise the module search if compiler and/or mpi_provider are given
module_cmd = default_module_cmd module_cmd = default_module_cmd

View File

@ -43,12 +43,14 @@ def main():
cli_args = parse_args() cli_args = parse_args()
# Global variables # Global variables
Pmodules_db_path = "/afs/psi.ch/sys/spack-rhel7/test/" Pmodules_db_path = "/opt/psi/var/cache/pmodules_db/"
Pmodules_states = ["deprecated", "stable", "unstable"] Pmodules_states = ["deprecated", "stable", "unstable"]
# Main search to analyse # Main search to analyse
module_cmd = ( module_cmd = (
"module search -a " + cli_args.select_module + " --all-deps --no-header" "$PMODULES_HOME/bin/modulecmd bash search -a "
+ cli_args.select_module
+ " --all-deps --no-header"
) )
module_cmd_process = subprocess_cmd(module_cmd) module_cmd_process = subprocess_cmd(module_cmd)