-
Notifications
You must be signed in to change notification settings - Fork 22
/
run_categorisation.sh
executable file
·64 lines (52 loc) · 1.5 KB
/
run_categorisation.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
#!/bin/bash
# Run categorisation script for all dataset lists in inputs/ and generate a
# nice looking html page :)
# there is no need to have a local cache for this script
function my_markdown()
{
dir="../markdownpy-spytoc-template/"
if [ -d $dir ]
then
python3 $dir/spytoc.py $1
elif which markdown_py &> /dev/null
then
markdown_py -x tables $1
else
python3 -m markdown -x tables -o html $1
fi
}
today="$(date +"%Y-%m-%d")-categorisation"
now=$(date)
if [ ! -d $today ];
then
mkdir $today
fi
summary="$today/summary.md"
index="$today/index.html"
echo "# Categorisation Results" > $summary
echo "" >> $summary
echo "Page generated on $now" >> $summary
echo "" >> $summary
years=(2016)
for year in ${years[*]}
do
list="inputs/CMS-"$year"-mc-datasets.txt"
listname=$(basename $list .txt)
md="$today/$listname.md"
html="$today/$listname.html"
echo "Categorising $list"
python3 code/interface.py --print-categorisation \
--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/ \
$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