Chapter 59. How to use the OGSA-DAI activity progress monitor

The OGSA-DAI activity framework contains an infrastructure for monitoring activities currently being executed by OGSA-DAI. This includes the activity processing status, such as processing, completed or in error, and when activities consume and produce data blocks.

To monitor the activity processing status and the number of processed data blocks we provide a monitoring framework implementation uk.org.ogsadai.monitoring.activity.ActivityProgressMonitoringFramework. This counts the blocks passed between activities through the inter-activity pipes and keeps track of the activity processing status of all activities in a request. This information is published as a resource property with the name http://uk.org.ogsadai.ActivityStatus on the request resource and can be accessed by clients via the usual mechanisms for getting resource properties.

If you wish to use this monitoring framework to track the activity progress you will need to specify this implementation to OGSA-DAI. To declare the monitoring framework, you simply have to uncomment the following XML fragment within the OGSA-DAI context configuration file.

The server's context configuration file is located in:

The XML to uncomment is as follows:

<bean id="uk.org.ogsadai.MONITORING_FRAMEWORK"  
      class="uk.org.ogsadai.monitoring.activity.ActivityProgressMonitoringFramework"/>

An instance of the activity monitor will be available in the OGSA-DAI context on the server, and start monitoring requests, when OGSA-DAI starts up.

The resource property http://uk.org.ogsadai.ActivityStatus is published on the request resource. For each activity, it contains the current status, and the number of blocks that have been consumed and produced on each of its input or output pipes. See below for an example value of this resource property:

<?xml version="1.0" encoding="UTF-8"?>
<ActivityStatus xmlns="http://ogsadai.org.uk/">
    <activity instanceName="uk.org.ogsadai.DeliverToRequestStatus-ogsadai-12278d7b507" status="COMPLETED">
        <input blocksConsumed="4" name="input"/>
    </activity>
    <activity instanceName="uk.org.ogsadai.TupleToWebRowSetCharArrays-ogsadai-12278d7b503" status="COMPLETED">
        <input blocksConsumed="24" name="data"/>
        <output blocksProduced="25" name="result"/>
    </activity>
    <activity instanceName="uk.org.ogsadai.SQLQuery-ogsadai-12278d7b501" status="COMPLETED">
        <input blocksConsumed="1" name="expression"/>
        <output blocksProduced="24" name="data"/>
    </activity>
    <activity instanceName="uk.org.ogsadai.CharArraysResize-ogsadai-12278d7b505" status="COMPLETED">
        <input blocksConsumed="1" name="sizeInChars"/>
        <input blocksConsumed="25" name="data"/>
        <output blocksProduced="4" name="result"/>
    </activity>
</ActivityStatus>

Section 67.5, “How to get a resource property” shows how to use the command-line server client to get this resource property. You have to replace the argument RESOURCE-PROPERTY-NAME by http://uk.org.ogsadai.ActivityStatus.

If you are using the client toolkit from your own application, the resource property can be retrieved from the request resource using the usual client toolkit methods, i.e. by calling getResourceProperty() on the request resource object.

To access the values of the resource property we provide a client toolkit class uk.org.ogsadai.client.toolkit.property.convertor.ActivityProgressXMLConvertor which converts the resource property into a list of uk.org.ogsadai.client.toolkit.property.convertor.ActivityProgress objects or into a map which maps an activity instance name to an ActivityProgress object. The ActivityProgress objects provide access to the information in the resource property, that is: