-
Notifications
You must be signed in to change notification settings - Fork 0
/
env.sh
135 lines (102 loc) · 3.01 KB
/
env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
###############################################################################
# Author: Robert Bärhold
# Date: 18.05.2015
#
# Settings file for the XtreemFS farm script on slurm.
# This file serves as source file for the different scripts.
# It contains user specific and general variables and shared functions.
# Boolean variables should be use with "true" and "false"
#
###############################################################################
####
## System settings
####
__DEBUG=true
GENERATE_CONFIGS=true
SAME_DIR_AND_MRC_NODE=true
XTREEMFS_DIRECTORY="$HOME/xtreemfs"
LOCAL_PATH="/local/$USER/xtreemfs"
VOLUME_PARAMETER="" # e.g.: -a POSIX -p RAID0 -s 256 -w 1
KILLTERM="-SIGKILL" # or -SIGTERM
JOB_ID=$SLURM_JOB_ID # default the current ID
NUMBER_OF_NODES=$SLURM_JOB_NUM_NODES # or Number of OSD nodes + DIR ( + seperate MRC)
XTREEMFS_NODE_NAMES=`scontrol show hostnames` # flat list of node names seperated with space
MOUNT_OPTIONS=""
####
## Watchdog Settings
####
WATCHDOG_INTERVAL=5 # in seconds
WATCHDOG_SAVELOGS="" # "-savelogs"
####
## Generic name and path settings
####
CURRENT_JOB_FOLDER_GENERIC="$(pwd)/slurm-%JOBID%"
CURRENT_JOB_ENV_FILE_GENERIC="$CURRENT_JOB_FOLDER_GENERIC/job_env.sh"
LOCAL_DIR_GENERIC="$LOCAL_PATH/%JOBID%"
LOCAL_MOUNT_PATH_GENERIC="$LOCAL_PATH/%JOBID%/mnt"
SERVICE_PREFIX_GENERIC="xtreemfs-%JOBID%"
VOLUME_NAME_GENERIC="volume-%JOBID%"
CONFIG_FILENAME_GENERIC="%NAME%.config"
LOG_FILENAME_GENERIC="%NAME%.log"
PID_FILENAME_EXTENSION=".pid"
PID_FILENAME_GENERIC="%NAME%$PID_FILENAME_EXTENSION"
####
## DEBUG Settings
####
DEBUG_CLIENT_ACTIVE=false
DEBUG_CLIENT_LEVEL="DEBUG"
#Default for all servers: 6 & all
DEBUG_DIR_LEVEL=6
DEBUG_DIR_CATEGORIES="all"
DEBUG_MRC_LEVEL=6
DEBUG_MRC_CATEGORIES="all"
DEBUG_OSD_LEVEL=6
DEBUG_OSD_CATEGORIES="all"
####
## GITHUB CLONE
####
IS_CLONE_REPO=false
GITHUB_REPO=https://github.com/xtreemfs/xtreemfs.git
REPO_CLONE_LOCATION=$XTREEMFS_DIRECTORY/..
####
## Internal
####
SKIP_NODE_COUNT=0
if [[ "$SAME_DIR_AND_MRC_NODE" == false ]]; then
SKIP_NODE_COUNT=1
fi
XTREEMFS_NODES=($XTREEMFS_NODE_NAMES) # put into an array, easier access
####
## Java settings
####
if [[ -z "$JAVA_HOME" ]]; then
export JAVA_HOME=/usr
fi
JAVA_CLASSPATH="$XTREEMFS_DIRECTORY/java/xtreemfs-servers/target/xtreemfs.jar"
JAVA_PROPERTIES="" # e.g.: -Dfoo=bar
####
## Substitute functions for generic variables
####
# Substitudes %JOBID% inside argument $1 with the slurm environment job id
function substitudeJobID() {
echo "$1" | sed -e "s/%JOBID%/$JOB_ID/g"
}
# Substitudes %name% in argument $1 with argument $2
function substitudeName() {
echo "$1" | sed -e "s/%NAME%/$2/g"
}
# Searchs for the line containing $2 inside file $1 and replaces the line with $3,
# saving the new content back to file $1
function substitudeProperty() {
LINE_NUMBER=`grep -nr "$2" "$1" | cut -d : -f 1`
printf '%s\n' "${LINE_NUMBER}s#.*#$3#" w | ed -s $1
}
####
## Shared functions
####
function outputDebug() {
if [[ "$__DEBUG" == "true" ]]; then
echo $@
fi
}