From 9d92350f4b8ec73e5810dab0e865204f2b60b599 Mon Sep 17 00:00:00 2001 From: Louwrentius Date: Fri, 14 May 2010 22:13:54 +0000 Subject: [PATCH] Major rework, no longer using arrays. Arrays don't scale and require enormous amounts of memmory when processing large input files. Will be released as 2.70. --- ppss | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/ppss b/ppss index 7203c39..d6c7561 100755 --- a/ppss +++ b/ppss @@ -71,8 +71,6 @@ GLOBAL_LOCK="$PPSS_DIR/PPSS-GLOBAL-LOCK-$PID" # Global lock file used PAUSE_SIGNAL="$PPSS_HOME_DIR/$PPSS_DIR/pause_signal" # Pause processing if this file is present. PAUSE_DELAY="60" # Polling every 1 minutes by default. STOP_SIGNAL="$PPSS_HOME_DIR/$PPSS_DIR/stop_signal" # Stop processing if this file is present. -ARRAY_POINTER_FILE="$PPSS_DIR/ppss-array-pointer-$PID" # Pointer for keeping track of processed items. -ARRAY="" GLOBAL_COUNTER="" GLOBAL_COUNTER_FILE="$PPSS_DIR/ppss-input-counter-$PID" LOCAL_INPUT_FILE="$PPSS_DIR/INPUT_FILE-$PID" @@ -92,7 +90,7 @@ KILL_KEY="$RANDOM$RANDOM$RANDOM" # This is a signal to st RECURSION="1" # all running processes. START_PPSS=`get_time_in_seconds` STOP_PPSS="" -SIZE_OF_ARRAY="" +SIZE_OF_INPUT="" SSH_SERVER="" # Remote server or 'master'. SSH_KEY="" # SSH key for ssh account. @@ -1603,9 +1601,8 @@ get_item () { get_global_lock SIZE_OF_INPUT=$(wc -l "$LOCAL_INPUT_FILE" | awk '{ print $1 }') - log DEBUG "sizeofinput $SIZE_OF_INPUT" # - # Return error if the array is empty. + # Return error if the list is empty. # if [ "$SIZE_OF_INPUT" -le "0" ] then @@ -1614,10 +1611,9 @@ get_item () { fi # - # This variable is used to walk thtough all array items. + # This variable is used to walk thtough all input file items. # GLOBAL_COUNTER=$(cat $GLOBAL_COUNTER_FILE) - log DEBUG "globalcounter $GLOBAL_COUNTER" # # Check if all items have been processed. @@ -1629,7 +1625,6 @@ get_item () { fi ITEM="$(sed -n $GLOBAL_COUNTER\p $LOCAL_INPUT_FILE)" - log DEBUG "item dus is $ITEM" if [ -z "$ITEM" ] then @@ -1977,9 +1972,8 @@ listen_for_job () { # In daemon mode, start all over again. # DIED=0 - export ARRAY="" get_all_items - log DEBUG "Found $SIZE_OF_ARRAY items." + log DEBUG "Found $SIZE_OF_INPUT items." start_all_workers sleep 10 else