gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-grid5k] 142/189: update persistance, possible to remove previous


From: gnunet
Subject: [taler-grid5k] 142/189: update persistance, possible to remove previous data
Date: Thu, 28 Apr 2022 10:48:32 +0200

This is an automated email from the git hooks/post-receive script.

marco-boss pushed a commit to branch master
in repository grid5k.

commit d4299a468089ff46b1dae760e54299fe7acfe7dc
Author: Boss Marco <bossm8@bfh.ch>
AuthorDate: Tue Apr 12 16:05:31 2022 +0200

    update persistance, possible to remove previous data
---
 experiment/env                |  5 +++++
 experiment/scripts/monitor.sh | 24 ++++++++++++++++++++++--
 experiment/scripts/setup.sh   | 20 ++++----------------
 3 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/experiment/env b/experiment/env
index 546cafb..c505728 100644
--- a/experiment/env
+++ b/experiment/env
@@ -130,3 +130,8 @@ GRAFANA_HOST=https://147.87.255.221:3000
 # Needs admin level since datasources need to be updated.
 # This can be generated by a grafana admin in 'Configuration->API keys->Add 
API key'
 GRAFANA_API_KEY=
+
+# If the data persisted from prometheus and loki from a
+# previous experiment should be removed before starting
+# a new one
+REMOVE_PREVIOUS_EXPERIMENT_DATA=true
diff --git a/experiment/scripts/monitor.sh b/experiment/scripts/monitor.sh
index 80719ee..b85810c 100755
--- a/experiment/scripts/monitor.sh
+++ b/experiment/scripts/monitor.sh
@@ -82,6 +82,27 @@ function configure_prometheus_and_exporters() {
           /etc/default/prometheus-postgres-exporter
 }
 
+# Create the directory which will be used to store recovery data
+# for the experiment (prometheus + loki)
+function setup_data_dir() {
+
+  EXPERIMENT_DATA_DIR="/home/${G5K_USER}/exp-data"
+  if [ ! -d /home/${G5K_USER} ]; then 
+    EXPERIMENT_DATA_DIR=/tmp/exp-data 
+  fi
+
+  if [[ "${REMOVE_PREVIOUS_EXPERIMENT_DATA}" == "true" ]]; then
+    rm -rf ${EXPERIMENT_DATA_DIR} || true
+  fi
+
+  mkdir ${EXPERIMENT_DATA_DIR} || true
+
+  echo "EXPERIMENT_DATA_DIR=${EXPERIMENT_DATA_DIR}" >> ~/.env
+
+  sed -i "s|<EXPERIMENT_DATA_PATH_HERE>|${EXPERIMENT_DATA_DIR}|g" \
+         /etc/monitor/loki.yaml
+}
+
 # Add wallet nodes to be monitored
 # Requires no argument since wallet nodes are retrieved from the DNS
 function add_wallet_nodes_to_prometheus() {
@@ -190,8 +211,7 @@ function init_monitor() {
 
   update_grafana
 
-  sed -i "s|<EXPERIMENT_DATA_DIR_HERE>|${EXPERIMENT_DATA_DIR}|g" \
-         /etc/monitor/loki.yaml
+  setup_data_dir
   
   systemctl restart loki \
                     promtail
diff --git a/experiment/scripts/setup.sh b/experiment/scripts/setup.sh
index f1d9d13..a86e81b 100644
--- a/experiment/scripts/setup.sh
+++ b/experiment/scripts/setup.sh
@@ -64,26 +64,15 @@ function setup_log_dir() {
     # If multiple nodes want to delete the same dir we run into errors
     # Let it fail safely with || true
     rm -rf ${LOG_DIR}/* || true
-  elif [ -d /home/${G5K_USER} ]; then 
-    mkdir ${LOG_DIR} | true
-  else
-    LOG_DIR=/tmp/taler && mkdir ${LOG_DIR}
+  elif [ ! -d /home/${G5K_USER} ]; then 
+    LOG_DIR=/tmp/taler
   fi
+
+  mkdir ${LOG_DIR} || true
   
   echo "LOG_DIR=${LOG_DIR}" >> ~/.env
 }
 
-# Create the directory which will be used to store recovery data
-# for the experiment (prometheus + loki)
-function setup_data_dir() {
-  EXPERIMENT_DATA_DIR="${LOG_DIR}/exp-data"
-  if [ -f ${EXPERIMENT_DATA_DIR} ]; then
-    rm -rf ${EXPERIMENT_DATA_DIR}
-  fi
-  mkdir ${EXPERIMENT_DATA_DIR}
-  echo "EXPERIMENT_DATA_DIR=${EXPERIMENT_DATA_DIR}" >> ~/.env
-}
-
 # Setup the environment configuration
 function setup_environment() {
   set +x
@@ -195,7 +184,6 @@ function clean_previous_setup() {
 clean_previous_setup
 parse_experiment_nodes
 setup_log_dir
-setup_data_dir
 setup_environment
 setup_config
 setup_dns

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]