CounterDemo     For copyright, licence and warranty details, see LICENCE.
-----------

This directory contains a demo job (CounterDemo.pl) that runs for twice 
the number of seconds equal to the first input argument.

Use CDregisterJob script to register this job type into BOSS.

The job consists of two nested counters. The inner loop increments a minor 
counter, known as a "tick", every 0.2 s from a value of 0 up to 20.

The outer loop, "majorcount", is repeated as many times as requested in 
the command line arguments - this is initially specified as 50 in the 
class ad file. If monitoring the BOSS database these counters may not 
appear to increment smoothly, as there is some buffering built into BOSS 
itself.

After every increment of majorcount, there is a 60% chance that the script 
will generate a comment (randomly chosen from a fixed list of silly 
messages). These can be used to reinforce the notion that BOSS/R-GMA 
represents a flexible transport layer - the ordering and contents of the 
messages are not pre-determined.

This material was prepared to demonstrate using R-GMA for the monitoring 
of jobs within BOSS. 

Use "boss s -scheduler fork -classad CounterDemo.clad" to test.

Use "boss q -running -specific -type counterdemo" to monitor the job 
execution.

If you are using an R-GMA enabled BOSS, then you should be able to 
monitor the output in real time using Pulse, by looking at the 
bossJobExOutMessage table. You may want to increase the number of 
iterations in the class ad, to give Pulse time to start (and members of 
the audience to follow along on their laptops!) - for this there is also a 
10 s pause at the start of the script after the JOB info is output but 
before the counters are started.

Output files:
	out & err - stdout and stderr from the script. Notice they can 
	contain output not parsed by the filters.
	BOSSJournal<JobId> - Journal file produced by the BOSS job wrapper 
	at the remote worker node. Contains all updates to be made to DB 
	on behalf of that job, so that if real-time updating falls over the 
	DB can be updated after the job finishes.
	CounterDemo.log - log file from remote worker node. Includes 
	output from BOSS wrapper and dbUpdator as well as from the script 
	itself.
	fork.log - log file for jobs run locally (BOSS' "fork" scheduler).

To do:
	Smarter runtime filtering of comments; in particular SQL escaping 
	(' -> '') and space removal (" " -> "_") should be done on the fly.
	Update: SQL comments now handled a bit better in R-GMA.

History:
v1.0	Formal release.
	Add switch default, just in case...
v0.9999 Add "show message:" message
v0.999	New message 5.
v0.99	Rename "minorcount" to "tick" to help distinguish during demos.
	Add 10 s sleep at start, to allow Pulse to connect to producer and 
	show JOB details before the scrolling starts...
	Rename register script.
v0.9	First use (RAL).

Notice:
This product includes software developed by GridPP (http://www.gridpp.ac.uk/).

