Create a Complex Flow
Everything done so far could have been done just as easily using make or a C-shell script. In this step you will build a flow which neither make nor a shell script could handle efficiently. This is a flow that spans multiple directories.
This example project will dynamically create a set of subdirectories. For each subdirectory, it will run four jobs within that context that process the same input file aa that comes from the top level main directory. The jobs are the ones we have been using to emulate useful work.
% cat Flow2.tcl
for {set i 1 } { $i < 20 } { incr i } {
indir -create subdir$i {
J vw cp ../aa bb
J vw cp bb cc
J vw cp cc dd1
J vw cp cc dd2
}
}
The for construct is standard Tcl, while the procedure
indir is a FlowTracer extension. In this case you want to
create the subdirectories subdirN
, so you will use the
option -create of indir.
-
Start the sequence with removal of files that might exist if the steps are done
again.
% vovforget -elements System:nodes % rm -rf aa subdir* % vovbuild -f Flow2.tcl ...................................... ...................................... ...................................... ...................................... % touch aa % vsr -all
Figure 1.
You have to use option -all of vsr because this flow spans multiple directories and the default target of vsr is just the current working directory.
-
As was done earlier, create a batch shell script to build the flow and run it.
% cat dowork2.sh vovforget -elements System:nodes rm -rf aa subdirs* sleep 5 vovbuild -f Flow2.tcl sleep 5 touch aa sleep 5 vsr -all % sh dowork2.sh
-
Rather than use a shell script to redo the commands to build and run the flow,
you can work with the flow as it is defined in FlowTracer,
and try touching aa to emulate a change in the primary
input file. This models an event that precedes running all the dependent jobs.
Run
vsr -all
to have FlowTracer schedule and dispatch all the dependent variant processes in the task paths. Watch the state of the nodes as the activity progresses.Figure 2.