Previous Section - PHISH WWW Site - PHISH Documentation - Next Section

5. Examples

This is the list of PHISH input scripts provided in the example directory of the distribution. Many of them use minnows which come in 2 flavors in the minnow directory, written in C++ or Python. The scripts can thus be edited to use all C++ or all Python minnows or a mixture of the two in the same PHISH net. See the comment lines at the top of each script for instructions on what variables can be defined via command-line arguements to the bait.py tool.



in.filelist

This script simply prints a list of files. It uses the filegen and print minnows.

It can process a large corpus of files by specifying one or more directory names as arguments to the filegen minnow via the variable "files".

Here is an example of how to run the script with bait.py:

python ../bait/bait.py -v files in.* -p ../minnow < in.filelist 

in.hook

This script generates a diagram of the various styles of hook connections that can be made between schools of minnows via the bait.py hook command. It is not meant to be run as a parallel program, only processed by the bait.py tool.

Here is an example of how to run the script with bait.py:

python ../bait/bait.py -b graphviz < in.hook 

The resulting dot file can be visualized via the GraphViz tools.


in.slow

This script prints words from files while using a slowdown minnow to make it operate more slowly. It uses the filegen, file2words, slowdown, and print minnows.

See the input script for variables that can be set, including the delay invoked by the slowdown minnow via the variable "delta".

Here is an example of how to run the script with bait.py:

python ../bait/bait.py -v files in.* -v delta 1.0 -p ../minnow < in.slow 

in.wordcount

This script performs a word frequency count across a set of input text files, similar to a MapReduce operation. It uses the filegen, file2words, count, sort, and print minnows, connected as diagramed in this section of the Introduction.

See the input script for variables that can be set, including the number of file2words and count minnows for parallelism. The script can process a large corpus of files by specifying one or more directory names as arguments to the filegen minnow via the variable "files".

Here is an example of how to run the script with bait.py:

python ../bait/bait.py -v files in.* -p ../minnow < in.wordcount 

in.wrapsink

This script demonstrates the use of the wrapsink minnow which is used to wrap a non-PHISH application. Wrapsink passes string datums it receives to any program thru stdin. The script uses the reverse program in the minnow dir to reverse the name of each file generated by the filegen minnow.

Here is an example of how to run the script with bait.py:

python ../bait/bait.py -v files in.* -p ../minnow < in.wrapsink 

in.wrapsource

This script demonstrates the use of the wrapsource minnow which is used to wrap a non-PHISH application. Wrapsource invokes the application and reads its output from stdout, a line at a time. The line is converted to a string datum which is sent downstream to other minnows. The script uses the shell command "ls *" as its program and sends its output to the print minnow. Thus a list of filenames in the directory is generated.

Here is an example of how to run the script with bait.py:

python ../bait/bait.py -p ../minnow < in.wrapsource 

in.wrapsourcefile

This script demonstrates the use of the wrapsource minnow with its optional file input, which is used to wrap a non-PHISH application. Wrapsource takes filenames as received datums, and invokes the application for each one, then reads its output from stdout, a line at a time. The line is converted to a string datum which is sent downstream to other minnows. The script uses the shell command "wc %s" as its program, where the "%s" represents the filename that is substituted for each time the program is invoked. It sends its output to the print minnow. Thus a list of filename sizes is generated.

See the input script for variables that can be set, including the number of wrapsource minnows for parallelism. The script can process a large corpus of files by specifying one or more directory names as arguments to the filegen minnow via the variable "files".

Here is an example of how to run the script with bait.py:

python ../bait/bait.py -p ../minnow -v files in.* < in.wrapsourcefile 

in.wrapss

This script demonstrates the use of the wrapss minnow which is used to wrap a non-PHISH application. Wrapss takes string datums and passes them to the stdin as lines of input to a running application. It also polls the application for output written to stdout, which it reads a line at a time. The line is converted to a string datum which is sent downstream to other minnows. The script uses the echo or reverse programs in the minnow dir as the application. Thus a list of filenames is printed, in reverse order if desired.

The script can process a large corpus of files by specifying one or more directory names as arguments to the filegen minnow via the variable "files".

Here is an example of how to run the script with bait.py:

python ../bait/bait.py -v files in.* -p ../minnow < in.wrapss