From 4b639a5d8ae825c5347ccbe3d3ed420bd3078e9e Mon Sep 17 00:00:00 2001 From: Evgeny Metelkin Date: Wed, 29 May 2024 15:58:54 +0300 Subject: [PATCH] fix paths --- bash/make-description.sh | 38 ++++++++++++++++++++------------------ static/config.js | 3 ++- static/main.js | 10 +++++----- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/bash/make-description.sh b/bash/make-description.sh index cf595e34b..adce5f859 100644 --- a/bash/make-description.sh +++ b/bash/make-description.sh @@ -1,54 +1,56 @@ #!/bin/bash +base_dir="result/l2v5" + echo Create of file structure -mkdir -p result -rm -rf result/* +mkdir -p $base_dir +rm -rf $base_dir/* echo Collect compiler information -echo "{" > result/summary.json +echo "{" > $base_dir/summary.json hetaCompilerVersion=$(heta --version) -echo " \"hetaCompilerVersion\": \"$hetaCompilerVersion\"," >> result/summary.json +echo " \"hetaCompilerVersion\": \"$hetaCompilerVersion\"," >> $base_dir/summary.json started=$(date) -echo " \"started\": \"$started\"," >> result/summary.json +echo " \"started\": \"$started\"," >> $base_dir/summary.json dirs=$(find ./cases/semantic/ -type d -regex '.*/[0-9]+' -print0 | xargs -0 -n1 basename ) # find all directories with numbers #dirs=$(find ./cases/semantic/ -type f -name "*-sbml-l2v5.xml" -exec dirname {} \; | xargs -n1 basename ) totalCasesCount=$(echo "$dirs" | wc -l) -echo " \"totalCasesCount\": \"$totalCasesCount\"," >> result/summary.json +echo " \"totalCasesCount\": \"$totalCasesCount\"," >> $base_dir/summary.json echo Copy files from cases and build models -echo " \"cases\": [" >> result/summary.json +echo " \"cases\": [" >> $base_dir/summary.json counter=0 for dir in $dirs; do counter=$((counter+1)) [ $counter==$totalCasesCount ] && delimiter="" || delimiter="," - mkdir -p result/$dir - cp bash/index.heta result/$dir/index.heta + mkdir -p $base_dir/$dir + cp bash/index.heta $base_dir/$dir/index.heta # Extract line starting from "synopsis" until the end of line synopsis=$(sed -n '/(\*/,/*)/p' cases/semantic/$dir/$dir-model.m | sed '1d;$d') - echo "$synopsis" > result/$dir/synopsis.txt + echo "$synopsis" > $base_dir/$dir/synopsis.txt - cp cases/semantic/$dir/$dir-sbml-l2v5.xml result/$dir/model-sbml-l2v5.xml > /dev/null 2>&1 + cp cases/semantic/$dir/$dir-sbml-l2v5.xml $base_dir/$dir/model-sbml-l2v5.xml > /dev/null 2>&1 if [ $? -ne 0 ]; then - echo " {\"id\": \"$dir\", \"retCode\": 9}$delimiter" >> result/summary.json + echo " {\"id\": \"$dir\", \"retCode\": 9}$delimiter" >> $base_dir/summary.json echo "$dir has no SBML file" continue fi # supress logs - heta build --skip-updates --dist-dir . --log-mode error result/$dir > /dev/null 2>&1 + heta build --skip-updates --dist-dir . --log-mode error $base_dir/$dir > /dev/null 2>&1 retCode=$(echo $?) - echo " {\"id\": \"$dir\", \"retCode\": $retCode}$delimiter" >> result/summary.json + echo " {\"id\": \"$dir\", \"retCode\": $retCode}$delimiter" >> $base_dir/summary.json echo "$dir finished with $retCode" done -echo " ]," >> result/summary.json +echo " ]," >> $base_dir/summary.json finished=$(date) -echo " \"finished\": \"$finished\"" >> result/summary.json -echo "}" >> result/summary.json +echo " \"finished\": \"$finished\"" >> $base_dir/summary.json +echo "}" >> $base_dir/summary.json # Save list of directories in JSON file # sudo apt-get install jq -# echo "$dirs" | jq -R . | jq -s . > result/dirs.json +# echo "$dirs" | jq -R . | jq -s . > $base_dir/summary.json diff --git a/static/config.js b/static/config.js index 58a6bb509..220aa4967 100644 --- a/static/config.js +++ b/static/config.js @@ -1,5 +1,6 @@ window.config = { results: './results.json', figPath: './cases/output', - summaryPath: '/result/summary.json', + //summaryPath: '/result/summary.json', + path: '/l2v5', }; diff --git a/static/main.js b/static/main.js index 29a36c8c6..d4df784c0 100644 --- a/static/main.js +++ b/static/main.js @@ -2,7 +2,7 @@ $(window).ready(() => { $('#modal .close').click(() => { $('#modal').hide(); }); - $.get(config.summaryPath, (data) => { + $.get(`${config.path}/summary.json`, (data) => { // general statistics $('#heta_version').html(data.hetaCompilerVersion); $('#started').html(data.started); @@ -15,21 +15,21 @@ $(window).ready(() => { item.on('click', () => { $('#caseId').html(x.id); $('#caseId').removeClass().addClass('retCode_' + x.retCode); - $('#casePath').html(`/result/${x.id}/`); + $('#casePath').html(`${config.path}/${x.id}/`); $('#retCode').html(x.retCode); $('#modal').show(); - $.get(`/result/${x.id}/heta-code/output.heta`, (data) => { + $.get(`${config.path}/${x.id}/heta-code/output.heta`, (data) => { $('#modal #heta-code pre code').html(data); }).fail(() => { $('#modal #heta-code pre code').html('No heta-code/output.heta file found'); }); - $.get(`/result/${x.id}/synopsis.txt`, (data) => { + $.get(`${config.path}/${x.id}/synopsis.txt`, (data) => { $('#modal #synopsis pre code').html(data); }).fail(() => { $('#modal #synopsis pre code').html('No synopsis.txt file found'); }); - $.get(`/result/${x.id}/build.log`, (data) => { + $.get(`${config.path}/${x.id}/build.log`, (data) => { $('#modal #logs pre code').html(data); }).fail(() => { $('#modal #logs pre code').html('No build.log file found');