From 68e71f17c5e191f992b882b64999c16ca18889a4 Mon Sep 17 00:00:00 2001
From: Michael <m.langguth@fz-juelich.de>
Date: Mon, 28 Feb 2022 19:30:16 +0100
Subject: [PATCH] Add template identifers to no_HPC-runscripts.

---
 .../data_extraction_era5_template.sh           |  7 ++++++-
 .../preprocess_data_era5_step1_template.sh     | 18 +++++++++++++++---
 .../preprocess_data_era5_step2_template.sh     | 10 +++++++++-
 .../train_model_era5_template.sh               | 12 ++++++++++--
 .../visualize_postprocess_era5_template.sh     | 10 ++++++++++
 5 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/video_prediction_tools/no_HPC_scripts/data_extraction_era5_template.sh b/video_prediction_tools/no_HPC_scripts/data_extraction_era5_template.sh
index ed42d552..4e3c4d3a 100644
--- a/video_prediction_tools/no_HPC_scripts/data_extraction_era5_template.sh
+++ b/video_prediction_tools/no_HPC_scripts/data_extraction_era5_template.sh
@@ -1,6 +1,11 @@
 #!/bin/bash -x
 
-#User's input : your virtual enviornment name
+######### Template identifier (don't remove) #########
+echo "Do not run the template scripts"
+exit 99
+######### Template identifier (don't remove) #########
+
+# Name of virtual environment
 VIRT_ENV_NAME=venv_test
 
 echo "Activating virtual environment..."
diff --git a/video_prediction_tools/no_HPC_scripts/preprocess_data_era5_step1_template.sh b/video_prediction_tools/no_HPC_scripts/preprocess_data_era5_step1_template.sh
index fec9b381..8519569a 100644
--- a/video_prediction_tools/no_HPC_scripts/preprocess_data_era5_step1_template.sh
+++ b/video_prediction_tools/no_HPC_scripts/preprocess_data_era5_step1_template.sh
@@ -1,10 +1,22 @@
 #!/bin/bash -x
 
-#User's input : your virtual enviornment name
+######### Template identifier (don't remove) #########
+echo "Do not run the template scripts"
+exit 99
+######### Template identifier (don't remove) #########
+
+# Name of virtual environment
 VIRT_ENV_NAME=venv_test
 
-echo "Activating virtual environment..."
-source ../virtual_envs/${VIRT_ENV_NAME}/bin/activate
+if [ -z ${VIRTUAL_ENV} ]; then
+   if [[ -f ../virtual_envs/${VIRT_ENV_NAME}/bin/activate ]]; then
+      echo "Activating virtual environment..."
+      source ../virtual_envs/${VIRT_ENV_NAME}/bin/activate
+   else
+      echo "ERROR: Requested virtual environment ${VIRT_ENV_NAME} not found..."
+      exit 1
+   fi
+fi
 
 #select years and variables for dataset and define target domain 
 years=( "2007" )
diff --git a/video_prediction_tools/no_HPC_scripts/preprocess_data_era5_step2_template.sh b/video_prediction_tools/no_HPC_scripts/preprocess_data_era5_step2_template.sh
index 36fd18d1..441924e7 100644
--- a/video_prediction_tools/no_HPC_scripts/preprocess_data_era5_step2_template.sh
+++ b/video_prediction_tools/no_HPC_scripts/preprocess_data_era5_step2_template.sh
@@ -1,6 +1,14 @@
 #!/bin/bash -x
 
-#User's input : your virtual enviornment name
+######### Template identifier (don't remove) #########
+echo "Do not run the template scripts"
+exit 99
+######### Template identifier (don't remove) #########
+
+# auxiliary variables
+WORK_DIR="$(pwd)"
+BASE_DIR=$(dirname "$WORK_DIR")
+# Name of virtual environment
 VIRT_ENV_NAME=venv_test
 
 # declare directory-variables which will be modified by config_runscript.py
diff --git a/video_prediction_tools/no_HPC_scripts/train_model_era5_template.sh b/video_prediction_tools/no_HPC_scripts/train_model_era5_template.sh
index 6a2ed2b5..2d0c6d34 100644
--- a/video_prediction_tools/no_HPC_scripts/train_model_era5_template.sh
+++ b/video_prediction_tools/no_HPC_scripts/train_model_era5_template.sh
@@ -1,7 +1,15 @@
 #!/bin/bash -x
 
-#your virtual enviornment name
-VIRT_ENV_NAME=venv_test
+######### Template identifier (don't remove) #########
+echo "Do not run the template scripts"
+exit 99
+######### Template identifier (don't remove) #########
+
+# auxiliary variables
+WORK_DIR="$(pwd)"
+BASE_DIR=$(dirname "$WORK_DIR")
+# Name of virtual environment
+VIRT_ENV_NAME="my_venv"
 
 # declare directory-variables which will be modified by generate_runscript.py
 source_dir=/my/path/to/tfrecords/files
diff --git a/video_prediction_tools/no_HPC_scripts/visualize_postprocess_era5_template.sh b/video_prediction_tools/no_HPC_scripts/visualize_postprocess_era5_template.sh
index b7748ab0..24ecbb6f 100644
--- a/video_prediction_tools/no_HPC_scripts/visualize_postprocess_era5_template.sh
+++ b/video_prediction_tools/no_HPC_scripts/visualize_postprocess_era5_template.sh
@@ -1,5 +1,15 @@
 #!/bin/bash -x
 
+######### Template identifier (don't remove) #########
+echo "Do not run the template scripts"
+exit 99
+######### Template identifier (don't remove) #########
+
+# auxiliary variables
+WORK_DIR="$(pwd)"
+BASE_DIR=$(dirname "$WORK_DIR")
+#your virtual enviornment name
+
 #User's input : your virtual enviornment name
 VIRT_ENV_NAME=venv_test
 # !!! ADAPAT DEPENDING ON USAGE OF CONTAINER !!!
-- 
GitLab