First you have to understand that we implemented something called a finite statemachine. If you don't know what this is then take good books on theoretical computer science or ask some professors. Second you have to understand our implementation :) Ok, you have only to understand the configuration. A finite statemachine consists of states and state transition functions (German: Zustandsuebergangsfunktionen).
All known states are stored in
OPENCADIR/etc/bp/states.txt
. You can change
this filename like every other filename too in
OPENCADIR/etc/bp/bp.xml
. All known functions
are stored in OPENCADIR/etc/bp/functions.txt
.
The startconfiguration of states which causing a function to start
it's actions are stored in the directory
OPENCADIR/etc/bp/functions
. The filenames
are function_name.txt
. Every line contains
one state which is required to start the function. Every process
of a user has a configurationfile states.txt
which represents the actual state of the user. It has the same
format like the configurationfiles of the functions.
If you want to change the default workflow or create a complete new workflow then you have to do the following:
Visualize the state-transition graph.
Mark the changes in the graph.
Create OPENCADIR/etc/bp/states.txt
which
must include all possible states.
Create OPENCADIR/etc/bp/functions.txt
which includes all available batch functions.
Create the start configuration of the states for all batch
functions in OPENCADIR/etc/bp/functions
.
Check that the start configuration specified in
OPENCADIR/etc/bp/functions
are conflict
free.
Please perform the last step twice if you change an already running system to ensure that you don't remove a state which is already present in the system and that you are able to still handle all states.
Implement the new and change the old functions.
Test the new system before deploying it.
The implementation of a new function is not the simplest task but it is not very difficult. The biggest problem is the impact that a function can create if it is executed in a not expected situation. If it do something wrong then such a function do it usually wrong for every user. The steps to create a new function are the following ones:
Add the function to the list in
OPENCADIR/etc/bp/functions.txt
.
Create the file
OPENCADIR/etc/bp/functions/function_name.txt
and specify the start configuration of the states there.
Create the OPENCADIR/lib/bp/function_name.sub
by copy and paste from another batch function.
Change the function name in the file
function_name.sub
to
workflow_function_name.
Change the source code of the function to do what you want.
The function get two parameters - USER
and WORKFLOW
. You can use these
parameters to access the data in the batch system.
Finally you have to change the actual state configuration of the workflow.
Please allways log what you are doing. It is the only chance to discover the source of problems. Allways write an entry to the log message if you discover something unusual in a workflow.