Commit 20adc5dd authored by Nicolas Joyard's avatar Nicolas Joyard

Update scripts

parent 08081f26
......@@ -2,7 +2,7 @@ if [ -n "$OPENSHIFT_HOMEDIR" ]; then
source ${OPENSHIFT_HOMEDIR}app-root/runtime/dependencies/python/virtenv/bin/activate
fi
function pipe_download_to_command() {
function parltrack_download_pipe() {
if [ -n "$OPENSHIFT_DATA_DIR" ]; then
cd $OPENSHIFT_DATA_DIR
fi
......@@ -18,3 +18,20 @@ function pipe_download_to_command() {
unxz -c ${OPENSHIFT_DATA_DIR}$1 | $2
[ -n "$CLEAN" ] && rm -rf $1
}
function francedata_download_pipe() {
if [ -n "$OPENSHIFT_DATA_DIR" ]; then
cd $OPENSHIFT_DATA_DIR
fi
[ -n "$CLEAN" ] && rm -rf $1
[ -f "$1" ] || wget https://francedata-njoyard.rhcloud.com/$1 || exit 1
if [ -n "$OPENSHIFT_REPO_DIR" ]; then
cd $OPENSHIFT_REPO_DIR
fi
export DJANGO_SETTINGS_MODULE=memopol.settings
gunzip -c ${OPENSHIFT_DATA_DIR}$1 | $2
[ -n "$CLEAN" ] && rm -rf $1
}
......@@ -2,11 +2,14 @@
bin/update_representatives
# grace time for pg
sleep 120
sleep 10
bin/update_dossiers
sleep 120
sleep 10
bin/update_proposals
sleep 10
bin/update_votes
......@@ -3,4 +3,8 @@ set -ex
source ${OPENSHIFT_REPO_DIR}bin/lib.sh
pipe_download_to_command ep_dossiers.json.xz parltrack_import_dossiers
parltrack_download_pipe ep_dossiers.json.xz parltrack_import_dossiers
sleep 10
francedata_download_pipe dossiers.json.gz francedata_import_dossiers
#!/bin/bash
set -ex
source ${OPENSHIFT_REPO_DIR}bin/lib.sh
# Nothing for parltrack - proposals imported with votes
francedata_download_pipe scrutins.json.gz francedata_import_scrutins
......@@ -3,4 +3,8 @@ set -ex
source ${OPENSHIFT_REPO_DIR}bin/lib.sh
pipe_download_to_command ep_meps_current.json.xz parltrack_import_representatives
parltrack_download_pipe ep_meps_current.json.xz parltrack_import_representatives
sleep 10
francedata_download_pipe parlementaires.json.gz francedata_import_representatives
......@@ -3,4 +3,8 @@ set -ex
source ${OPENSHIFT_REPO_DIR}bin/lib.sh
pipe_download_to_command ep_votes.json.xz parltrack_import_votes
parltrack_download_pipe ep_votes.json.xz parltrack_import_votes
sleep 10
francedata_download_pipe votes.json.gz francedata_import_votes
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment