-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathCACHE.sh
More file actions
executable file
·50 lines (36 loc) · 990 Bytes
/
CACHE.sh
File metadata and controls
executable file
·50 lines (36 loc) · 990 Bytes
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
#!/bin/bash
# Run this script to trigger GitHub's data caching
# https://docs.github.com/en/rest/metrics/statistics?apiVersion=2022-11-28#best-practices-for-caching
exec &> ../LAST_CACHE_REQUEST.log
export GITHUB_DATA=../../visualize/github-data
DATELOG=../LAST_CACHE_REQUEST.txt
# On exit
function finish {
# Log end time
echo -e "END\t$(date -u)" >> $DATELOG
}
trap finish EXIT
# Stop and Log for failed scripts
function errorCheck() {
if [ $ret -ne 0 ]; then
echo "FAILED - $1"
echo -e "FAILED\t$1" >> $DATELOG
exit 1
fi
}
# Basic script run procedure
function runScript() {
echo "Run - $1"
python -u $1
ret=$?
errorCheck "$1"
}
# Check Python requirements
runScript python_check.py
echo "RUNNING CACHE REQUEST SCRIPT"
# Log start time
echo -e "$(date -u '+%F-%H')" > $DATELOG
echo -e "START\t$(date -u)" >> $DATELOG
# --- CHACHEABLE QUERIES ---
runScript cache_repos_activitycommits.py
echo "CACHE REQUEST COMPLETE"