:@ 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 ALPHA HPC availability prediction (AVP) webservice programmatically, using SOAP.

Web service API

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

  • String avpGetMachines ()
  • String avpPredictProb (String machine, int nodes, long jobStartTime, long jobStopTime)

Input to each prediction routine is detailed here:

  • machine Internal tag indicating machine/site name (see avpGetMachines() to get a list of machines/queues)
  • nodes How many nodes the job will use
  • jobStartTime UNIX timestamp when job will start
  • jobStopTime UNIX timestamp when job will stop

The internal logic currently only uses the positive difference between jobStopTime and jobStartTime to make the prediction. Therefore, if you do not know the exact UNIX timestamp when your job will start and stop, you can artificially supply values such that the difference reflects the actual runtime of your job (jobStartTime=1, jobStopTime=3601 indicates that your job will run for 3600 seconds, or 1 hour).

The methods return results in the form of a string, which contains an XML document formatted according to the linked schema. For example, a result from avpGetMachines() 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>

Contained in this XML document is the 'tag' that is used as input to the prediction routines avpPredictProb(). For instance, following from the above example, setting the 'machine' input parameter to 'ncsateragrid' may result in XML documents of the following form as output from avpPredictProb()


<availabilityPrediction>
        <status>SUCCESS</status>
        <statusLong>Success</statusLong>
        <andPrediction>0.783249771628</andPrediction>
        <orPrediction>0.999987677469</orPrediction>
        <indepPrediction>0.940751824425</indepPrediction>
        <failratePrediction>1.69655306055E-05</failratePrediction>
</availabilityPrediction>

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), perform the following procedure:

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

This generates the stubs in edu/ucsb/cs/ which you then need to compile:

cd edu/ucsb/cs; javac *.java; cd ../../..

Next, compile the java client (make sure '.' is in your classpath) and move it into the package directory:

javac AvpClient.java; mv AvpClient.class edu/ucsb/cs/

Finally, run the program:

java edu/ucsb/cs/AvpClient ncsateragrid 4 1 3601

The following sample Java client AvpClient.java will query the service.

package edu.ucsb.cs;

public class AvpClient {
        public static void main(String[] args) throws Exception {
            AvpServiceLocator l = new AvpServiceLocator();
            AvpSoapBindingStub stub = (AvpSoapBindingStub) l.getAvp();

            String machine;
            int nodes, start, stop;

            machine = args[0];
            nodes = Integer.parseInt(args[1]);
            start = Integer.parseInt(args[2]);
            stop = Integer.parseInt(args[3]);
            
            System.out.println(stub.avpPredictProb(machine, nodes, start, stop));

        }
}

Alternatively, you can query the service with solutions based on the Perl SOAP::Lite library. Following is an example AvpClient.pl which queries the service:

#!/usr/bin/perl

use SOAP::Lite;

my $hostname = "pompone.cs.ucsb.edu";
my $port = 8180;

if (@ARGV < 4) {
    print "USAGE: AvpClient.pl <mach> <nodes> <starttime> <endtime>
";
    print "EXAMPLE: AvpClient.pl ucteragrid 1 1180000000 1180003600
";
    exit(1);
}

my $machine = shift @ARGV;
my $nodes = shift @ARGV;
my $start = SOAP::Data->type(long => shift @ARGV);
my $stop = SOAP::Data->type(long => shift @ARGV);

my $thirty_four = SOAP::Data->type(long => 3400);
my $zero = SOAP::Data->type(long => 0);
my $fzero = SOAP::Data->type(float => 0);

$stub = SOAP::Lite                                            
    -> uri('irrelevant')
    -> proxy("http://$hostname:$port/axis/services/Avp");

#$result = $stub -> avpGetMachines() -> result;
#print $result;


$result = $stub -> avpPredictProb($machine, $nodes, $start, $stop) -> result;
print "avpPredictProb:
$result

";