Thursday, February 7, 2013

Getting started with ProActive REST Clients

Getting started with ProActive REST Clients.

REST APIs of the Scheduler and Resource Manager of ProActive Parallel Suite is one its most versatile features offered. They are as nearly as powerful as their Java counterparts, not bound to any programming language and accessible across heterogeneous networks and corporate firewalls.

REST Clients of ProActive Scheduler and Resource Manager are Java client applications which mimic the native clients and use REST APIs for communication. They persist session identifiers, cache user credentials when specified and use them to authenticate only when it required. They preserve command history and support both interactive and non-interactive modes.

Latest official ProActive REST Client distribution, ProActiveSchedulingREST-1.3.0_CLI, can be downloaded from here

Now lets have a look at how to submit a sample job and get the results when it finishes.

Submit a job file:

Command syntax:
 
$ sh scheduler-client.sh -u <https-rest-rul> -k -l <user> -s <job-file-pathname>
password:********
Eg:
 
bash-4.2$ sh scheduler-client.sh -u https://portal.cloud.sophia.inria.fr/SchedulingRest/rest -k -l ssamaran -s  ../../scheduling/samples/jobs_descriptors/Job_PI.xml
password:********
Job('../../scheduling/samples/jobs_descriptors/Job_PI.xml') successfully submitted: job('8354')
If the SSL server certificate is not installed into Java default trust store (e.g. /lib/security/cacerts), REST Clients will throw SSLPeerUnverifiedException type error. As a workaround, you can specify ‘-k’ option which disables SSL certificate verification.

Retrieve job state:

Command syntax:
 
$ sh scheduler-client.sh  -u <https-rest-url> -k -l ssamaran -js <job-id>
Eg:
 
bash-4.2$ sh scheduler-client.sh  -u https://portal.cloud.sophia.inria.fr/SchedulingRest/rest -k -l ssamaran -js 8354

job('8352')    NAME: job_PI    OWNER: ssamaran    STATUS: RUNNING    #TASKS: 9

     ID           NAME             ITER     DUP     STATUS       HOSTNAME                                            EXEC DURATION     TOT DURATION     #NODES USED     #EXECUTIONS     #NODES KILLED    

     83520008     Computation2                      RUNNING      node30.cloud.sophia.inria.fr (SSH-CNSlice1-143)     Not yet           Not yet          1               1/1             0/2              

     83520004     Computation4                      RUNNING      node7.cloud.sophia.inria.fr (SSH-CNSlice1-221)      Not yet           Not yet          1               1/1             0/2              

     83520005     Computation5                      RUNNING      node21.cloud.sophia.inria.fr (SSH-CNSlice1-228)     Not yet           Not yet          1               1/1             0/2              
..
Retrieve job result:

Command syntax:
 
$ sh scheduler-client.sh -u <https-rest-url> -k -l <user> -jr <job-id>
Eg:
 
bash-4.2$ sh ./scheduler-client.sh  -u https://portal.cloud.sophia.inria.fr/SchedulingRest/rest -k -l ssamaran -jr 8354

job('8354') result:
LastAverage : 3.1416703733333335
Computation2 : 3.14192544
Computation1 : 3.14179904
Computation4 : 3.14134824
Computation3 : 3.1417646
Computation6 : 3.14153496
Average1 : 3.1418296933333334
Average2 : 3.1415110533333332
Computation5 : 3.14164996

You can always find out other supported operations using their help option.
 
$ sh scheduler-client.sh  -h