backup
This commit is contained in:
parent
b133b76ddf
commit
f85f7b6d03
51
ppss
51
ppss
@ -24,6 +24,7 @@
|
|||||||
# Handling control-c for a clean shutdown.
|
# Handling control-c for a clean shutdown.
|
||||||
#
|
#
|
||||||
trap 'kill_process' SIGINT
|
trap 'kill_process' SIGINT
|
||||||
|
|
||||||
SCRIPT_NAME="Distributed Parallel Processing Shell Script"
|
SCRIPT_NAME="Distributed Parallel Processing Shell Script"
|
||||||
SCRIPT_VERSION="2.70"
|
SCRIPT_VERSION="2.70"
|
||||||
|
|
||||||
@ -714,7 +715,7 @@ process_arguments () {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "$SRC_DIR" ]
|
if [ ! -e "$SRC_DIR" ] && [ -z "$MODE" ]
|
||||||
then
|
then
|
||||||
showusage_short
|
showusage_short
|
||||||
echo
|
echo
|
||||||
@ -897,13 +898,6 @@ init_vars () {
|
|||||||
#
|
#
|
||||||
# Create a remote homedir for PPSS
|
# Create a remote homedir for PPSS
|
||||||
#
|
#
|
||||||
does_file_exist "$PPSS_HOME_DIR"
|
|
||||||
if [ ! "$?" = "0" ] && [ ! -z "$SSH_SERVER" ]
|
|
||||||
then
|
|
||||||
log DEBUG "Remote PPSS home directory $PPSS_HOME_DIR does not exist. Creating."
|
|
||||||
exec_cmd "mkdir -p $PPSS_HOME_DIR/$PPSS_DIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo 1 > $GLOBAL_COUNTER_FILE
|
echo 1 > $GLOBAL_COUNTER_FILE
|
||||||
|
|
||||||
@ -1036,7 +1030,7 @@ erase_ppss () {
|
|||||||
then
|
then
|
||||||
for NODE in `cat $NODES_FILE`
|
for NODE in `cat $NODES_FILE`
|
||||||
do
|
do
|
||||||
log DSPLY "Erasing PPSS homedir $PPSS_DIR from node $NODE."
|
log DSPLY "Erasing PPSS homedir $PPSS_HOME_DIR from node $NODE."
|
||||||
ssh -q $SSH_KEY $SSH_OPTS $USER@$NODE "rm -rf $PPSS_HOME_DIR"
|
ssh -q $SSH_KEY $SSH_OPTS $USER@$NODE "rm -rf $PPSS_HOME_DIR"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
@ -1206,6 +1200,7 @@ start_ppss_on_node () {
|
|||||||
NODE="$1"
|
NODE="$1"
|
||||||
log DSPLY "Starting PPSS on node $NODE."
|
log DSPLY "Starting PPSS on node $NODE."
|
||||||
ssh $SSH_KEY $USER@$NODE -o ConnectTimeout=5 "cd $PPSS_HOME_DIR ; screen -d -m -S PPSS ~/$PPSS_HOME_DIR/$0 node --config ~/$PPSS_HOME_DIR/$CONFIG"
|
ssh $SSH_KEY $USER@$NODE -o ConnectTimeout=5 "cd $PPSS_HOME_DIR ; screen -d -m -S PPSS ~/$PPSS_HOME_DIR/$0 node --config ~/$PPSS_HOME_DIR/$CONFIG"
|
||||||
|
echo "ssh $SSH_KEY $USER@$NODE -o ConnectTimeout=5 cd $PPSS_HOME_DIR ; screen -d -m -S PPSS ~/$PPSS_HOME_DIR/$0 node --config ~/$PPSS_HOME_DIR/$CONFIG"
|
||||||
}
|
}
|
||||||
|
|
||||||
test_server () {
|
test_server () {
|
||||||
@ -1221,9 +1216,17 @@ test_server () {
|
|||||||
SSH_MASTER_PID="$!"
|
SSH_MASTER_PID="$!"
|
||||||
log DEBUG "SSH Master pid is $SSH_MASTER_PID"
|
log DEBUG "SSH Master pid is $SSH_MASTER_PID"
|
||||||
log DSPLY "Connected to server: $SSH_SERVER"
|
log DSPLY "Connected to server: $SSH_SERVER"
|
||||||
|
|
||||||
|
does_file_exist "$PPSS_HOME_DIR/$PPSS_DIR"
|
||||||
|
if [ ! "$?" = "0" ] && [ ! -z "$SSH_SERVER" ]
|
||||||
|
then
|
||||||
|
log DEBUG "Remote PPSS home directory $PPSS_HOME_DIR/$PPSS_DIR does not exist. Creating."
|
||||||
|
exec_cmd "mkdir -p $PPSS_HOME_DIR/$PPSS_DIR"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
log DEBUG "No remote server specified, assuming stand-alone mode."
|
log DEBUG "No remote server specified, assuming stand-alone mode."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_no_of_cpus () {
|
get_no_of_cpus () {
|
||||||
@ -1528,9 +1531,15 @@ upload_item () {
|
|||||||
lock_item () {
|
lock_item () {
|
||||||
|
|
||||||
ITEM="$1"
|
ITEM="$1"
|
||||||
LOCK_FILE_NAME=`echo "$ITEM" | $MD5 | awk '{ print $1 }'`
|
LOCK_FILE_NAME_MD5=`echo "$ITEM" | $MD5 | awk '{ print $1 }'`
|
||||||
ITEM_LOCK_FILE="$ITEM_LOCK_DIR/$LOCK_FILE_NAME"
|
if [ -z "$SSH_SERVER" ]
|
||||||
exec_cmd "mkdir $ITEM_LOCK_FILE >> /dev/null 2>&1"
|
then
|
||||||
|
ITEM_LOCK_FILE="$ITEM_LOCK_DIR/$LOCK_FILE_NAME_MD5"
|
||||||
|
else
|
||||||
|
ITEM_LOCK_FILE="$PPSS_HOME_DIR/$ITEM_LOCK_DIR/$LOCK_FILE_NAME_MD5"
|
||||||
|
fi
|
||||||
|
log DEBUG "Locking item $ITEM_LOCK_FILE"
|
||||||
|
exec_cmd "mkdir -p $ITEM_LOCK_FILE >> /dev/null 2>&1"
|
||||||
return "$?"
|
return "$?"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1703,7 +1712,7 @@ get_item () {
|
|||||||
else
|
else
|
||||||
((GLOBAL_COUNTER++))
|
((GLOBAL_COUNTER++))
|
||||||
echo $GLOBAL_COUNTER > $GLOBAL_COUNTER_FILE
|
echo $GLOBAL_COUNTER > $GLOBAL_COUNTER_FILE
|
||||||
if [ "$DISABLE_ITEM_LOCK" == "0" ]
|
if [ ! -z "$SSH_SERVER" ]
|
||||||
then
|
then
|
||||||
lock_item "$ITEM"
|
lock_item "$ITEM"
|
||||||
else
|
else
|
||||||
@ -2207,19 +2216,10 @@ show_status () {
|
|||||||
then
|
then
|
||||||
SSH_KEY="-i $SSH_KEY"
|
SSH_KEY="-i $SSH_KEY"
|
||||||
fi
|
fi
|
||||||
if [ -z "$INPUT_FILE" ]
|
|
||||||
then
|
|
||||||
if [ "$RECURSION" == "1" ]
|
|
||||||
then
|
|
||||||
ITEMS=`exec_cmd "find $SRC_DIR ! -type d 2>/dev/null | wc -l" 1`
|
|
||||||
else
|
|
||||||
ITEMS=`exec_cmd "ls -1 $SRC_DIR 2>/dev/null | wc -l" 1`
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
ITEMS=`exec_cmd "cat $PPSS_HOME_DIR/$LOCAL_INPUT_FILE 2>/dev/null | wc -l" 1`
|
|
||||||
fi
|
|
||||||
|
|
||||||
ITEMS=`echo $ITEMS | sed s/\ //g`
|
get_all_items
|
||||||
|
|
||||||
|
ITEMS=`wc -l $LOCAL_INPUT_FILE | awk '{ print $1 }'`
|
||||||
|
|
||||||
if [ ! -z "$ITEMS" ] && [ ! "$ITEMS" == "0" ]
|
if [ ! -z "$ITEMS" ] && [ ! "$ITEMS" == "0" ]
|
||||||
then
|
then
|
||||||
@ -2366,6 +2366,7 @@ main () {
|
|||||||
status )
|
status )
|
||||||
LOGFILE=/dev/null
|
LOGFILE=/dev/null
|
||||||
display_header
|
display_header
|
||||||
|
init_vars
|
||||||
get_all_items
|
get_all_items
|
||||||
show_status
|
show_status
|
||||||
exit 0
|
exit 0
|
||||||
|
34
ppss-test.sh
34
ppss-test.sh
@ -12,6 +12,9 @@ SPECIAL_DIR=$TMP_DIR/root/special
|
|||||||
|
|
||||||
cleanup () {
|
cleanup () {
|
||||||
|
|
||||||
|
unset RES1
|
||||||
|
unset RES2
|
||||||
|
|
||||||
for x in $REMOVEFILES
|
for x in $REMOVEFILES
|
||||||
do
|
do
|
||||||
if [ -e ./$x ]
|
if [ -e ./$x ]
|
||||||
@ -180,24 +183,35 @@ testGetItem () {
|
|||||||
done
|
done
|
||||||
EXPECTED=40
|
EXPECTED=40
|
||||||
assertEquals "Got wrong number of items." "$EXPECTED" "$i"
|
assertEquals "Got wrong number of items." "$EXPECTED" "$i"
|
||||||
|
|
||||||
|
rename-ppss-dir $FUNCNAME
|
||||||
|
cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
testEscaping () {
|
return_all_items () {
|
||||||
|
|
||||||
createSpecialFilenames
|
|
||||||
init_get_all_items $TMP_DIR/root 1
|
|
||||||
|
|
||||||
RES1=`find $TMP_DIR/root/ ! -type d`
|
|
||||||
|
|
||||||
while get_item
|
while get_item
|
||||||
do
|
do
|
||||||
RES2="$RES2$ITEM"$'\n'
|
RES2="$RES2$ITEM"$'\n'
|
||||||
done
|
done
|
||||||
RES1="$RES1"$'\n' # NASTY HACK YUCK
|
|
||||||
assertEquals "Input file and actual files not the same!" "$RES1" "$RES2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inotestNumberOfLogfiles () {
|
testNumberOfItems () {
|
||||||
|
|
||||||
|
createSpecialFilenames
|
||||||
|
init_get_all_items $TMP_DIR/root 1
|
||||||
|
|
||||||
|
RES1=`find $TMP_DIR/root/ ! -type d`
|
||||||
|
RES1="$RES1"$'\n' # NASTY HACK YUCK
|
||||||
|
|
||||||
|
return_all_items
|
||||||
|
|
||||||
|
assertEquals "Input file and actual files not the same!" "$RES1" "$RES2"
|
||||||
|
rename-ppss-dir $FUNCNAME
|
||||||
|
cleanup
|
||||||
|
}
|
||||||
|
|
||||||
|
testNumberOfLogfiles () {
|
||||||
|
|
||||||
createSpecialFilenames
|
createSpecialFilenames
|
||||||
init_get_all_items $TMP_DIR/root 1
|
init_get_all_items $TMP_DIR/root 1
|
||||||
@ -208,6 +222,8 @@ inotestNumberOfLogfiles () {
|
|||||||
done
|
done
|
||||||
RES=`ls -1 $PPSS_DIR/job_log/ | wc -l | awk '{ print $1}'`
|
RES=`ls -1 $PPSS_DIR/job_log/ | wc -l | awk '{ print $1}'`
|
||||||
assertEquals "Got wrong number of log files." 40 "$RES"
|
assertEquals "Got wrong number of log files." 40 "$RES"
|
||||||
|
rename-ppss-dir $FUNCNAME
|
||||||
|
cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
. ./shunit2
|
. ./shunit2
|
||||||
|
Loading…
Reference in New Issue
Block a user