Commit 9824a79e authored by delanoe's avatar delanoe

[PSQL] Install fix

parent 68771a16
...@@ -109,7 +109,7 @@ def compute_occs(corpus, overwrite_id = None, groupings_id = None,): ...@@ -109,7 +109,7 @@ def compute_occs(corpus, overwrite_id = None, groupings_id = None,):
.group_by("counted_form") .group_by("counted_form")
) )
#print(str(occs_q)) #print(str(occs_q.all()))
occ_sums = occs_q.all() occ_sums = occs_q.all()
# example result = [(1970, 1.0), (2024, 2.0), (259, 2.0), (302, 1.0), ... ] # example result = [(1970, 1.0), (2024, 2.0), (259, 2.0), (302, 1.0), ... ]
# ^^^^ ^^^ # ^^^^ ^^^
...@@ -190,7 +190,7 @@ def compute_ti_ranking(corpus, ...@@ -190,7 +190,7 @@ def compute_ti_ranking(corpus,
if type(corpus) == int: if type(corpus) == int:
corpus_id = corpus corpus_id = corpus
corpus = cache.Node[corpus_id] corpus = cache.Node[corpus_id]
elif type(corpus) == str and match(r'\d+$', corpus): elif type(corpus) == str and match(r'^\d+$', corpus):
corpus_id = int(corpus) corpus_id = int(corpus)
corpus = cache.Node[corpus_id] corpus = cache.Node[corpus_id]
else: else:
...@@ -330,7 +330,7 @@ def compute_ti_ranking(corpus, ...@@ -330,7 +330,7 @@ def compute_ti_ranking(corpus,
# result # result
print("%s : Starting Query tf_nd_query" % t()) print("%s : Starting Query tf_nd_query" % t())
print(str(tf_nd_query)) #print(str(tf_nd_query.all()))
tf_nd = tf_nd_query.all() tf_nd = tf_nd_query.all()
print("%s : End Query tf_nd_quer" % t()) print("%s : End Query tf_nd_quer" % t())
...@@ -399,7 +399,8 @@ def compute_tfidf_local(corpus, ...@@ -399,7 +399,8 @@ def compute_tfidf_local(corpus,
- overwrite_id: optional id of a pre-existing TFIDF-XXXX node for this corpus - overwrite_id: optional id of a pre-existing TFIDF-XXXX node for this corpus
(the Node and its previous NodeNodeNgram rows will be replaced) (the Node and its previous NodeNodeNgram rows will be replaced)
""" """
print("Compute TFIDF local")
# All docs of this corpus # All docs of this corpus
docids_subquery = (session docids_subquery = (session
.query(Node.id) .query(Node.id)
......
...@@ -5,13 +5,10 @@ apt-get install -y \ ...@@ -5,13 +5,10 @@ apt-get install -y \
apt-utils ca-certificates locales \ apt-utils ca-certificates locales \
sudo aptitude gcc g++ wget git vim \ sudo aptitude gcc g++ wget git vim \
build-essential make \ build-essential make \
postgresql-9.5 postgresql-client-9.5 postgresql-contrib-9.5 \ postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6 \
postgresql-server-dev-9.5 libpq-dev libxml2 \ postgresql-server-dev-9.6 libpq-dev libxml2 \
postgresql-9.5 postgresql-client-9.5 postgresql-contrib-9.5 \ postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6 \
nginx rabbitmq-server nginx rabbitmq-server uwsgi uwsgi-core uwsgi-plugin-python3
# WARNING: uwsgi is not on stretch any more (get it from unstable)
# uwsgi uwsgi-core uwsgi-plugin-python3
### Configure timezone and locale ### Configure timezone and locale
...@@ -32,15 +29,15 @@ update-locale LC_ALL=fr_FR.UTF-8 ...@@ -32,15 +29,15 @@ update-locale LC_ALL=fr_FR.UTF-8
### Install main dependencies and python packages based on Debian distrib ### Install main dependencies and python packages based on Debian distrib
echo "############# PYTHON DEPENDENCIES ###############" echo "############# PYTHON DEPENDENCIES ###############"
apt-get update && apt-get install -y \ apt-get update && apt-get install -y \
libxml2-dev xml-core libgfortran-5-dev \ libxml2-dev xml-core libgfortran-6-dev \
libpq-dev \ libpq-dev \
python3.5 \ python3.5 \
python3-dev \ python3-dev \
python3-six python3-numpy python3-setuptools \ python3-six python3-numpy python3-setuptools \
python3-numexpr \ python3-numexpr \
python3-pip \ python3-pip \
libxml2-dev libxslt-dev libxml2-dev libxslt-dev zlib1g-dev
#libxslt1-dev zlib1g-dev #libxslt1-dev
UPDATE AND CLEAN UPDATE AND CLEAN
apt-get update && apt-get autoclean apt-get update && apt-get autoclean
...@@ -70,7 +67,7 @@ update-locale LC_ALL=fr_FR.UTF-8 ...@@ -70,7 +67,7 @@ update-locale LC_ALL=fr_FR.UTF-8
## POSTGRESQL DATA (as ROOT) ## POSTGRESQL DATA (as ROOT)
####################################################################### #######################################################################
sed -iP "s%^data_directory.*%data_directory = \'\/srv\/gargandata\'%" /etc/postgresql/9.5/main/postgresql.conf sed -iP "s%^data_directory.*%data_directory = \'\/srv\/gargandata\'%" /etc/postgresql/9.6/main/postgresql.conf
echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.conf echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.6/main/pg_hba.conf
echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf echo "listen_addresses='*'" >> /etc/postgresql/9.6/main/postgresql.conf
...@@ -12,12 +12,12 @@ echo "::::: POSTGRESQL :::::" ...@@ -12,12 +12,12 @@ echo "::::: POSTGRESQL :::::"
su postgres -c 'pg_dropcluster 9.4 main --stop' su postgres -c 'pg_dropcluster 9.4 main --stop'
#done in docker but redoing it #done in docker but redoing it
rm -rf /srv/gargandata && mkdir /srv/gargandata && chown postgres:postgres /srv/gargandata rm -rf /srv/gargandata && mkdir /srv/gargandata && chown postgres:postgres /srv/gargandata
su postgres -c '/usr/lib/postgresql/9.5/bin/initdb -D /srv/gargandata/' su postgres -c '/usr/lib/postgresql/9.6/bin/initdb -D /srv/gargandata/'
su postgres -c '/usr/lib/postgresql/9.5/bin/pg_ctl -D /srv/gargandata/ -l /srv/gargandata/journal_applicatif start' su postgres -c '/usr/lib/postgresql/9.6/bin/pg_ctl -D /srv/gargandata/ -l /srv/gargandata/journal_applicatif start'
su postgres -c 'pg_createcluster -D /srv/gargandata 9.5 main ' su postgres -c 'pg_createcluster -D /srv/gargandata 9.6 main '
su postgres -c 'pg_ctlcluster -D /srv/gargandata 9.5 main start ' su postgres -c 'pg_ctlcluster -D /srv/gargandata 9.6 main start '
su postgres -c 'pg_ctlcluster 9.5 main start' su postgres -c 'pg_ctlcluster 9.6 main start'
service postgresql start service postgresql start
......
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