:@ Network Weather Service


NWS site
Edit...

NWS Sponsors

nsf_logo.gif

sdsclogo-black.gif

UCSBlogo.gif

Edit...

Collaborators

SDSC

Edit...

These are instructions for querying our batch queue prediction (BQP) Web service programmatically, using SOAP. (To make manual queries, you may want to try our Web interface instead.)

NOTICE: there is a mailing list for the NWS web service at http://pompone.cs.ucsb.edu/cgi-bin/mailman/listinfo/webservice. On that mailing list we'll notify when the service will be down for maintenance.

Web service API

The BPQ Web service is fully specified by WSDL. The following methods are supported (shown here in Java syntax):

  • String getMachines ()
  • String getMachinesXML ()
  • long predict (long timeStamp, String machine, String queue, int nodes, long wallTime, float quantile, float confidence)
  • String predictXML (long timeStamp, String machine, String queue, int nodes, long wallTime, float quantile, float confidence)
  • float predictInvert (long timeStamp, String machine, String queue, int nodes, long wallTime, float confidence, long startDeadline)
  • String predictInvertXML (long timeStamp, String machine, String queue, int nodes, long wallTime, float confidence, long startDeadline)

The *XML methods return results in the form of a string, which contains an XML document formatted according to the following schema. For example, a result from getMachinesXML call may contain:

<machines>
<machine>
        <tag>ncsateragrid</tag>
        <queues>
                <queue default="true">dque</queue>
                <queue default="false">big</queue>
                <queue default="false">long</queue>
        </queues>
        <loginHosts>
                <host>tg-login.ncsa.teragrid.org</host>
                <host>tg-login1.ncsa.teragrid.org</host>
        </loginHosts>
        <label>NCSA TeraGrid Cluster</label>
</machine>
</machines>

On the other hand, the plain getMachines returns an array of tag/queue pairs:

ncsateragrid dque
ncsateragrid big
ncsateragrid long

These pairs of names can then be used to generate a prediction using predict* and predictInvert* calls. All prediction calls return a number, except that the *XML versions wrap that number into XML and return a string.

Sample Web service clients

We recommend that you use the WSDL to generate client stubs for your environment (although that is not strictly necessary). For example, on a properly configured Axis installation (i.e. your classpath contains Tomcat), the following command

java org.apache.axis.wsdl.WSDL2Java -o . -dSession -s -Strue
     -N"urn:edu.ucsb.cs.nws"="edu.ucsb.cs.nws"  NwsBatchq.wsdl

generates the stubs in edu/ucsb/cs/nws which you then need to compile. Then, the following sample Java client will query the service:

package edu.ucsb.cs.nws;

public class NwsBatchqClient {
        public static void main(String[] args) throws Exception {

                NwsBatchqServiceLocator l = 
                    new NwsBatchqServiceLocator();
                NwsBatchqSoapBindingStub stub = 
                    (NwsBatchqSoapBindingStub) l.getNwsBatchq();

                System.out.println(stub.getMachines());
                System.out.println(stub.predict(0, 
                                                "datastar", 
                                                "normal", 
                                                4, 
                                                34l, 
                                                0, 0));
        }
}

Alternatively, you can also query the service with "quick-and-dirty" solutions such as Perl's SOAP::Lite library:

use SOAP::Lite;

$stub = SOAP::Lite                                            
    -> uri('irrelevant')
    -> proxy('http://nws.cs.ucsb.edu:8180/axis/services/NwsBatchq');

print $stub -> getMachines() -> result;

# SOAP is strict with types, so 
# they must be explicit for long and float
my $timestamp = SOAP::Data->type(long => 0);
my $walltime = SOAP::Data->type(long => 34);
my $quantile = SOAP::Data->type(float => 0);
my $confidence = SOAP::Data->type(float => 0);

print $stub -> predict(
     $timestamp, 
     "ncsateragrid", 
     "dque", 
     4, 
     $walltime, 
     $quantile, $confidence) -> result;