forked from ISTI-ansible-roles/ansible-roles
Merge branch 'master' of gitorious.research-infrastructures.eu:infrastructure-management/ansible-playbooks
This commit is contained in:
commit
c067086dba
|
@ -77,7 +77,7 @@ function init_env() {
|
|||
OLDPROC=$( cat $LOCK_FILE )
|
||||
OLDPROC_RUNNING=$( ps auwwx | grep -v grep | grep $OLDPROC | awk '{ print $2 }' )
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -eq 0 ] ; then
|
||||
if [ ! -z "$OLDPROC_RUNNING" ] ; then
|
||||
logger "update_r_packages: pid of the already running process: $OLDPROC_RUNNING"
|
||||
OLDPROC_RUNNING_TIME=$( ps -o etimes= -p ${OLDPROC_RUNNING} )
|
||||
if [ $OLDPROC_RUNNING_TIME -gt $UPDATER_PROCESS_MAX_RUNTIME ] ; then
|
||||
|
@ -92,6 +92,8 @@ function init_env() {
|
|||
logger "update_r_packages: lock file exist but the process not. Continuing."
|
||||
rm -fr $TMP_FILES_DIR
|
||||
fi
|
||||
else
|
||||
logger 'update_r_packages: no other jobs running, proceeding.'
|
||||
fi
|
||||
RETVAL=
|
||||
echo "$PROCNUM" > $LOCK_FILE
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
set -e
|
||||
set -o pipefail
|
||||
|
||||
PROCNUM=$$
|
||||
INFRA_REFERENCE={{ dataminer_infra_reference }}
|
||||
ADD_ALGORITHM_DIR={{ smartgears_user_home }}/algorithmInstaller
|
||||
ADD_ALGORITHM_PATH={{ smartgears_user_home }}/algorithmInstaller/addAlgorithm.sh
|
||||
|
@ -15,7 +16,10 @@ ALGORITHMS_INSTALLED_FILE=${LOG_DIR}/already_installed_algorithms.txt
|
|||
ALGORITHMS_INSTALLED_SORTED_FILE=${LOG_DIR}/already_installed_algorithms_sorted.txt
|
||||
LOCK_FILE=${LOG_DIR}/.algorithms_updater.lock
|
||||
ALGO_DIR={{ dataminer_wps_algorithms_dest }}/${INFRA_REFERENCE}
|
||||
RUNNING_JOB=
|
||||
# In seconds. 60*60*6=21600s (6h)
|
||||
UPDATER_PROCESS_MAX_RUNTIME=21600
|
||||
OLDPROC=
|
||||
OLDPROC_RUNNING=
|
||||
RUNNING_JOB_RETVAL=
|
||||
|
||||
trap "logger 'algorithms-updater: trap intercepted, exiting.' ; cleanup 1" SIGHUP SIGINT SIGTERM
|
||||
|
@ -38,13 +42,23 @@ function check_lock_file() {
|
|||
if [ -f $LOCK_FILE ] ; then
|
||||
set +o pipefail
|
||||
set +e
|
||||
RUNNING_JOB=$( /bin/pidof -s -x /usr/local/bin/algorithms-updater )
|
||||
OLDPROC=$( cat $LOCK_FILE )
|
||||
OLDPROC_RUNNING=$( ps auwwx | grep -v grep | grep $OLDPROC | awk '{ print $2 }' )
|
||||
RUNNING_JOB_RETVAL=$?
|
||||
if [ $RUNNING_JOB_RETVAL -eq 0 ] ; then
|
||||
logger 'algorithms-updater: another job still running, exiting.'
|
||||
rm -fr $OUT_DIR
|
||||
exit 0
|
||||
if [ ! -z "$OLDPROC_RUNNING" ] ; then
|
||||
logger "algorithms_updater: pid of the already running process: $OLDPROC_RUNNING"
|
||||
OLDPROC_RUNNING_TIME=$( ps -o etimes= -p ${OLDPROC_RUNNING} )
|
||||
if [ $OLDPROC_RUNNING_TIME -gt $UPDATER_PROCESS_MAX_RUNTIME ] ; then
|
||||
logger "algorithms_updater: process $OLDPROC_RUNNING was running for $OLDPROC_RUNNING_TIME seconds. Got stuck, killing it"
|
||||
kill -9 $OLDPROC_RUNNING
|
||||
rm -f $LOCK_FILE
|
||||
else
|
||||
logger "algorithms_updater: another process is running, exiting."
|
||||
rm -fr $OUT_DIR
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
logger "algorithms_updater: lock file exist but the process not. Continuing."
|
||||
rm -f $LOCK_FILE
|
||||
fi
|
||||
else
|
||||
|
@ -52,7 +66,7 @@ function check_lock_file() {
|
|||
fi
|
||||
set -o pipefail
|
||||
set -e
|
||||
echo "$$" > $LOCK_FILE
|
||||
echo "$PROCNUM" > $LOCK_FILE
|
||||
}
|
||||
|
||||
function update_svn_repo() {
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
# https://stanfordnlp.github.io/CoreNLP/
|
||||
stanford_corenlp_version: latest
|
||||
stanford_corenlp_name: stanford-corenlp
|
||||
stanford_corenlp_extension: war
|
||||
stanford_corenlp_file: '{{ stanford_corenlp_name }}-{{ stanford_corenlp_version }}.{{ stanford_corenlp_extension }}'
|
||||
stanford_corenlp_group_id: edu.stanford.nlp
|
||||
stanford_corenlp_languages:
|
||||
- arabic
|
||||
- chinese
|
||||
- english
|
||||
- english_kbp
|
||||
- french
|
||||
- german
|
||||
- spanish
|
||||
|
||||
stanford_corenlp_user: corenlp
|
||||
stanford_corenlp_base_dir: /opt/corenlp
|
||||
stanford_corenlp_dist_dir: '{{ stanford_corenlp_base_dir }}/stanford-corenlp'
|
||||
stanford_corenlp_log_dir: '{{ stanford_corenlp_base_dir }}/logs'
|
||||
stanford_corenlp_cmd: 'java -cp "*" -mx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -props StanfordCoreNLP-english.properties -port 9000 -timeout 60000'
|
||||
|
||||
tint_service_cmd: './tint-server.sh -p 9001'
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
- block:
|
||||
- name: Create the CoreNLP logs directory
|
||||
file: dest={{ stanford_corenlp_log_dir }} state=directory owner={{ stanford_corenlp_user }}
|
||||
|
||||
- name: Install the CoreNLP startup script
|
||||
template: src=stanford-corenlp.upstart.j2 dest=/etc/init/stanford-corenlp.conf owner=root group=root mode=0644
|
||||
|
||||
- name: Ensure that CoreNLP is enabled and running
|
||||
service: name=stanford-corenlp state=started enabled=yes
|
||||
|
||||
- name: Install the tint service startup script
|
||||
template: src=tint.upstart.j2 dest=/etc/init/tint.conf owner=root group=root mode=0644
|
||||
|
||||
- name: Ensure that the tint service is enabled and running
|
||||
service: name=tint state=started enabled=yes
|
||||
|
||||
tags: [ 'corenlp', 'stanford_corenlp' ]
|
|
@ -0,0 +1,13 @@
|
|||
description "Stanford CoreNLP"
|
||||
start on (local-filesystems and net-device-up IFACE!=lo)
|
||||
stop on runlevel [016]
|
||||
|
||||
respawn
|
||||
respawn limit 10 5
|
||||
setuid {{ stanford_corenlp_user }}
|
||||
setgid {{ stanford_corenlp_user }}
|
||||
chdir {{ stanford_corenlp_dist_dir }}
|
||||
|
||||
script
|
||||
exec {{ stanford_corenlp_cmd }} > {{ stanford_corenlp_log_dir }}/corenlp.log 2>&1
|
||||
end script
|
|
@ -0,0 +1,13 @@
|
|||
description "TINT service"
|
||||
start on (local-filesystems and net-device-up IFACE!=lo)
|
||||
stop on runlevel [016]
|
||||
|
||||
respawn
|
||||
respawn limit 10 5
|
||||
setuid {{ stanford_corenlp_user }}
|
||||
setgid {{ stanford_corenlp_user }}
|
||||
chdir {{ stanford_corenlp_dist_dir }}/tint
|
||||
|
||||
script
|
||||
exec {{ tint_service_cmd }} > {{ stanford_corenlp_log_dir }}/tint.log 2>&1
|
||||
end script
|
Loading…
Reference in New Issue