From 0869dc92accd1198987c5181b7241163a55fd11f Mon Sep 17 00:00:00 2001 From: Louwrentius Date: Sun, 31 Jan 2010 19:39:58 +0000 Subject: [PATCH] Current version of ppss --- ppss | 22 +++++++++++++++++++++- ppss-test.sh | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ppss b/ppss index 4702357..88abbe3 100755 --- a/ppss +++ b/ppss @@ -56,7 +56,7 @@ PAUSE_DELAY=60 # Polling every 1 minute STOP_SIGNAL="$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. JOB_LOG_DIR="$PPSS_DIR/job_log" # Directory containing log files of processed items. -LOGFILE="$PPSS_DIR/ppss-log-$$.txt" # General PPSS log file. Contains lots of info. +LOGFILE="$PPSS_DIR/ppss-log-$PID.txt" # General PPSS log file. Contains lots of info. STOP=0 # STOP job. MAX_DELAY=0 # MAX DELAY between jobs. MAX_LOCK_DELAY=9 # @@ -1317,6 +1317,12 @@ get_item () { start_single_worker () { + # + # This function sends an item to the fifo. This signals + # the listener process to execute a 'worker' on this + # item, using the 'commando' function. + # + get_item ERROR=$? if [ ! "$ERROR" == "0" ] @@ -1356,6 +1362,20 @@ elapsed () { commando () { + # + # This function will start a chain reaction of events. + # + # The commando executes a command on an item and, when finished, + # executes the start_single_worker. This function selects a new + # item and sends it to the fifo. The listener process receives + # the item and excutes this commando function on the item. + # So in essence, the commando function keeps calling itself + # indirectly until no items are left. This will form a single + # working queue. By executing multiple start_single_worker + # functions based on the CPU cores available, parallel processing + # is achieved, with a queue for each core. + # + ITEM="$1" if [ -e "$ITEM" ] diff --git a/ppss-test.sh b/ppss-test.sh index 8f5e57f..08a706a 100755 --- a/ppss-test.sh +++ b/ppss-test.sh @@ -1,7 +1,7 @@ #!/bin/bash DEBUG="$1" -VERSION=2.54 +VERSION=2.55 TMP_DIR="ppss" PPSS=ppss PPSS_DIR=ppss_dir