This commit is contained in:
louwrentius 2011-09-01 01:35:18 +00:00
parent edb7c21683
commit b69e1e6d7b
2 changed files with 21 additions and 9 deletions

25
ppss
View File

@ -154,7 +154,7 @@ showusage_normal () {
echo echo
echo "|P|P|S|S| $SCRIPT_NAME $SCRIPT_VERSION" echo "|P|P|S|S| $SCRIPT_NAME $SCRIPT_VERSION"
echo echo
echo "PPSS is a Bash shell script that executes commands in parallel on a set" echo "|P|P|S|S| is a Bash shell script that executes commands in parallel on a set"
echo "of items, such as files in a directory, or lines in a file. The purpose" echo "of items, such as files in a directory, or lines in a file. The purpose"
echo "of PPSS is to make it simple to benefit from multiple CPUs or CPU cores." echo "of PPSS is to make it simple to benefit from multiple CPUs or CPU cores."
echo echo
@ -202,6 +202,8 @@ showusage_normal () {
echo -e "--email | -e PPSS sends an e-mail if PPSS has finished. It is also used if processing" echo -e "--email | -e PPSS sends an e-mail if PPSS has finished. It is also used if processing"
echo -e " of an item has failed (configurable, see -h). " echo -e " of an item has failed (configurable, see -h). "
echo echo
echo -e "--debug Enable debugging output to the |P|P|S|S| log file."
echo
echo -e "--help Extended help, including options for distributed mode." echo -e "--help Extended help, including options for distributed mode."
echo echo
echo -e "Example: encoding some wav files to mp3 using lame:" echo -e "Example: encoding some wav files to mp3 using lame:"
@ -217,7 +219,7 @@ showusage_long () {
echo echo
echo "|P|P|S|S| $SCRIPT_NAME $SCRIPT_VERSION" echo "|P|P|S|S| $SCRIPT_NAME $SCRIPT_VERSION"
echo echo
echo "PPSS is a Bash shell script that executes commands in parallel on a set " echo "|P|P|S|S| is a Bash shell script that executes commands in parallel on a set "
echo "of items, such as files in a directory, or lines in a file." echo "of items, such as files in a directory, or lines in a file."
echo echo
echo "Usage: $0 [ MODE ] [ options ]" echo "Usage: $0 [ MODE ] [ options ]"
@ -290,6 +292,10 @@ showusage_long () {
echo -e " PPSS strips al non [:alnum:] characters of an item string and this may" echo -e " PPSS strips al non [:alnum:] characters of an item string and this may"
echo -e " cause collisions. String ABC!@# and ABC^&* will become both ABC___" echo -e " cause collisions. String ABC!@# and ABC^&* will become both ABC___"
echo echo
echo -e "--debug Enable debugging output to the |P|P|S|S| log file."
echo
echo
echo
echo -e "The following options are used for distributed execution of PPSS." echo -e "The following options are used for distributed execution of PPSS."
echo echo
echo -e "--master | -m Specifies the SSH server that is used for communication between nodes." echo -e "--master | -m Specifies the SSH server that is used for communication between nodes."
@ -335,7 +341,6 @@ showusage_long () {
echo -e "--randomize | -R Randomise which items to process by the client in distributed mode." echo -e "--randomize | -R Randomise which items to process by the client in distributed mode."
echo -e " This makes sure that with many nodes, some clients spend their time" echo -e " This makes sure that with many nodes, some clients spend their time"
echo -e " trying to get a lock on an item." echo -e " trying to get a lock on an item."
echo
echo -e "Example: encoding some wav files to mp3 using lame:" echo -e "Example: encoding some wav files to mp3 using lame:"
echo echo
echo -e "$0 -c 'lame ' -d /path/to/wavfiles -j " echo -e "$0 -c 'lame ' -d /path/to/wavfiles -j "
@ -741,6 +746,10 @@ process_arguments () {
SCRIPT="$2" SCRIPT="$2"
add_var_to_config SCRIPT "$SCRIPT" add_var_to_config SCRIPT "$SCRIPT"
shift 2 ;; shift 2 ;;
--debug)
PPSS_DEBUG="1"
add_var_to_config PPSS_DEBUG "$PPSS_DEBUG"
shift 1 ;;
--download) --download)
DOWNLOAD_TO_NODE="1" DOWNLOAD_TO_NODE="1"
add_var_to_config DOWNLOAD_TO_NODE "$DOWNLOAD_TO_NODE" add_var_to_config DOWNLOAD_TO_NODE "$DOWNLOAD_TO_NODE"
@ -796,7 +805,7 @@ process_arguments () {
if [ "$SRC_DIR" == "." ] if [ "$SRC_DIR" == "." ]
then then
echo echo
echo "PPSS is not designed to process items from within the directory" echo "|P|P|S|S| is not designed to process items from within the directory"
echo "it is being run. PPSS will start to process its own files from" echo "it is being run. PPSS will start to process its own files from"
echo "its working directory $PPSS_DIR which is probably not wat you" echo "its working directory $PPSS_DIR which is probably not wat you"
echo "want. Are you sure you want to continue?" echo "want. Are you sure you want to continue?"
@ -1368,7 +1377,7 @@ deploy () {
then then
log DSPLY "PPSS installed on node $NODE." log DSPLY "PPSS installed on node $NODE."
else else
log DSPLY "PPSS failed to install on $NODE." log DSPLY "|P|P|S|S| failed to install on $NODE."
fi fi
kill $SSH_PID kill $SSH_PID
@ -1434,7 +1443,7 @@ start_ppss_on_node () {
ssh $SSH_KEY $USER@$NODE -o ConnectTimeout=5 -o GlobalKnownHostsFile=./known_hosts "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 -o GlobalKnownHostsFile=./known_hosts "cd $PPSS_HOME_DIR ; screen -d -m -S PPSS ~/$PPSS_HOME_DIR/$0 node --config ~/$PPSS_HOME_DIR/$CONFIG"
if [ ! "$?" == "0" ] if [ ! "$?" == "0" ]
then then
log ERROR "PPSS failed to start on node $NODE." log ERROR "|P|P|S|S| failed to start on node $NODE."
fi fi
} }
@ -2560,7 +2569,7 @@ terminate_listener () {
if [ ! -z "$EMAIL" ] if [ ! -z "$EMAIL" ]
then then
echo "PPSS job finished." | mail -s "$HOSTNAME - PPSS has finished." "$EMAIL" echo "|P|P|S|S| job finished." | mail -s "$HOSTNAME - PPSS has finished." "$EMAIL"
if [ ! "$?" = "0" ] if [ ! "$?" = "0" ]
then then
log ERROR "Sending os status mail failed." log ERROR "Sending os status mail failed."
@ -2806,7 +2815,7 @@ get_status_of_nodes () {
ssh -q $SSH_OPTS $SSH_KEY $USER@$SSH_SERVER cat "$PPSS_HOME_DIR/$PPSS_NODE_STATUS/*" > "$RESULT_FILE" 2>&1 ssh -q $SSH_OPTS $SSH_KEY $USER@$SSH_SERVER cat "$PPSS_HOME_DIR/$PPSS_NODE_STATUS/*" > "$RESULT_FILE" 2>&1
if [ ! "$?" == "0" ] if [ ! "$?" == "0" ]
then then
log DSPLY "PPSS has not been started yet on nodes." log DSPLY "|P|P|S|S| has not been started yet on nodes."
return 1 return 1
fi fi

View File

@ -7,5 +7,8 @@ NODES_FILE=nodes.txt
SSH_SERVER=10.0.1.110 SSH_SERVER=10.0.1.110
USER=ppss USER=ppss
SCRIPT=wav2mp3.sh SCRIPT=wav2mp3.sh
RANDOMIZE=1
DOWNLOAD_TO_NODE=1
PPSS_DEBUG=1
PPSS_LOCAL_TMPDIR=ppss_dir/PPSS_LOCAL_TMPDIR PPSS_LOCAL_TMPDIR=ppss_dir/PPSS_LOCAL_TMPDIR
PPSS_LOCAL_OUTPUT=ppss_dir/PPSS_LOCAL_OUTPUT PPSS_LOCAL_OUTPUT=ppss_dir/PPSS_LOCAL_OUTPUT