forked from cernopendata/data-curation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
print_results.sh
executable file
·68 lines (56 loc) · 1.67 KB
/
print_results.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Run categorisation script for all dataset lists in inputs/ and generate a
# nice looking html page :)
# run make_local_cache.sh first!
function my_markdown()
{
dir="../markdownpy-spytoc-template/"
if [ -d $dir ]
then
python $dir/spytoc.py $1
elif which markdown_py &> /dev/null
then
markdown_py -x tables $1
else
python -m markdown -x tables -o html $1
fi
}
today="$(date +"%Y-%m-%d")-results"
now=$(date)
if [ ! -d $today ];
then
mkdir $today
fi
summary="$today/summary.md"
index="$today/index.html"
echo "# Categorisation Rich Results" > $summary
echo "" >> $summary
echo "Page generated on $now" >> $summary
echo "" >> $summary
years=(2010 2011 2012 2015 2016)
for year in ${years[*]}
do
list="inputs/CMS-"$year"-mc-datasets.txt"
doi="./inputs/doi-cms-mc-2012-released.txt"
recid="./inputs/recid-cms-mc-2012-datasets.py"
echo "Categorising $list"
listname=$(basename $list .txt)
md="$today/$listname.md"
html="$today/$listname.html"
python code/interface.py --print-results \
--eos-dir ./cache/$year/eos-file-indexes/ \
--das-dir ./cache/$year/das-json-store/ \
--mcm-dir ./cache/$year/mcm-store/ \
--conf-dir ./cache/$year/config-store/ \
--doi-file $doi \
--recid-file $recid \
$list > $md || exit $?
my_markdown $md > $html
echo "## $listname" >> $summary
head $md -n 41 | tail -n 32 >> $summary
echo "" >> $summary
echo "**Details** [here]($listname.html)" >> $summary
echo "" >> $summary
done
echo "Making $index"
my_markdown $summary > $index