Monday, September 18, 2006

Submitting Globus job through Condor SOAP API

(1) Download and install condor 6.8 from http://www.cs.wisc.edu/condor/

(2) Setup condor for SOAP by adding following lines in etc/condor_config file
WEB_ROOT_DIR=$(RELEASE_DIR)/web
ENABLE_SOAP = TRUE
ALLOW_SOAP = */*
ENABLE_WEB_SERVER = TRUE
QUEUE_ALL_USERS_TRUSTED = TRUE

(3) All condor's WSDL files are located under condor_installation_directory/lib/webservices. Now generate condor client library by using following commnads
java org.apache.axis.wsdl.WSDL2Java condorSchedd.wsdl and
java org.apache.axis.wsdl.WSDL2Java condorCollector.wsdl
Do not forget to include axis jar files into classpath for running above commands. Execution of this commands will generate condor folder under lib/webservices folder.

(4)Now compile all the classes generated under lib/webservices/condor folder by using follwoing command
javac condor/*.java

(5) Make birdbath1.jar file from lib/webservices/condor folder

(6)Also download birdbath.jar file from http://www.cs.wisc.edu/condor/birdbath/birdbath.jar.

(7) include birdbath.jar and birdbath1.jar file to classpath. My classpath looks like following
:/usr/local/axis/axis-1_4/lib/axis-ant.jar:/usr/local/axis/axis-1_4/lib/axis.jar:
/usr/local/axis/axis-1_4/lib/commons-discovery-0.2.jar:/usr/local/axis/axis-1_4/lib/commons-logging-1.0.4.jar:
/usr/local/axis/axis-1_4/lib/jaxrpc.jar:/usr/local/axis/axis-1_4/lib/log4j-1.2.8.jar:
/usr/local/axis/axis-1_4/lib/saaj.jar:/usr/local/axis/axis-1_4/lib/wsdl4j-1.5.1.jar:
/home/condor/condor/lib/webservice/birdbath1.jar:/home/condor/condor/lib/webservice/birdbath.jar:

(8)Now I have created following class SubmitExample3.java to submit globus job
import condor.ClassAdStructAttr;
import condor.ClassAdAttrType;
import condor.UniverseType;
import birdbath.*;
import java.rmi.*;
import java.io.*;
import java.net.*;
import javax.xml.rpc.*;

class SubmitExample3
{
public static void main(String[] arguments)
throws RemoteException, ServiceException, MalformedURLException, IOException
{
Schedd schedd = new Schedd(new URL(arguments[0]));
Transaction xact = schedd.createTransaction();
xact.begin(30);
int cluster = xact.createCluster();
int job = xact.createJob(cluster);
ClassAdStructAttr[] extraAttributes =
{
new ClassAdStructAttr("Out", ClassAdAttrType.value3,"/home/condor/temp.out"),
new ClassAdStructAttr("GridResource", ClassAdAttrType.value3,"gt2 login-co.ncsa.teragrid.org/jobmanager"),
new ClassAdStructAttr("x509userproxy", ClassAdAttrType.value3,"/tmp/x509up_u501")};
xact.submit(cluster, job,"condor",UniverseType.GLOBUS,"/home/condor/test.sh",null,"(TRUE)",extraAttributes,null);
xact.commit();
}
}
This example runs test.sh file located under /home/condor directory using globus universe at ncsa teragrid. It is necessary to specify GridResource and x509userproxy attributes to run globus job.
My test.sh file is simple
#!/bin/sh
echo $HOSTNAME
After execution of test.sh the output will generate under /home/condor/temp.out file

(9) Now compile this class using
javac SubmitExample3.java

(10) To run this example You need to specify Condor's schedd URL as an argument like this
java SubmitExample3 http://Schedd's IP Address:Schedd's Port Number

(11) you can check the status of job using condor_q command like this
condor_q
-- Submitter: 156-56-104-135.dhcp-bl.indiana.edu : <156.56.104.135:32773> : 156-56-104-135.dhcp-bl.indiana.edu
ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD
67.0 condor 9/18 10:02 0+00:00:00 I 0 9.8 test.sh

1 jobs; 1 idle, 0 running, 0 held

condor_q
-- Submitter: 156-56-104-135.dhcp-bl.indiana.edu : <156.56.104.135:32773> : 156-56-104-135.dhcp-bl.indiana.edu
ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD
67.0 condor 9/18 10:06 0+00:00:13 R 0 9.8 test.sh

1 jobs; 0 idle, 1 running, 0 held

condor_q
-- Submitter: 156-56-104-135.dhcp-bl.indiana.edu : <156.56.104.135:32773> : 156-56-104-135.dhcp-bl.indiana.edu
ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD
67.0 condor 9/18 10:06 0+00:02:53 C 0 9.8 test.sh

0 jobs; 0 idle, 0 running, 0 held

(12) After execution result will be displayed in temp.out file
co-login1.ncsa.uiuc.edu

6 comments:

Sirisha said...

Marlon,

When I try to execute the java program I get an error: 'beginTransaction' not implemented: method name or namespace not recognized.

Do you know how to resolve it ?

Regards,
Sirisha

Marlon Pierce said...

I can't really debug it from you message, but my guess is that you are using incompatible versions of the Birdbath client and service. The notes by Sima apply only to Condor 6.8. Older versions don't work with the Condor 6.8 WSDL and vice versa.

Li said...

Hi Dr.Marlon,

Thank you for the message. I got the same problem.

Li said...

Dr.Marlon,

I got the same problem these days. One reason is that schedd and collector are two daemons with different port. You can specify the port number in the condor_config file, the specify the url in the client end code.

Regards,
Hui

Li said...

Dr.Marlon,

I got the same problem these days. One reason is that schedd and collector are two daemons with different port. You can specify the port in the condor_config file, then specify the url in the client end code.

Regards,
Hui

Li said...

Dr.Marlon,

I got the same problem these days. One reason is that schedd and collector are two daemons with different port. You can specify the port in the condor_config file, then specify the url in the client end code.

Regards,
Hui