[GE users] drmaa setWorkingDirectory

Ralf Sigmund sigmund at ipk-gatersleben.de
Fri Mar 11 12:28:10 GMT 2005

    [ The following text is in the "ISO-8859-1" character set. ]
    [ Your display is set for the "ISO-8859-10" character set.  ]
    [ Some special characters may be displayed incorrectly. ]

whenever I try to use the method setWorkingDirectory on an jobTemplate 
instance the java-process hangs at the subsequent call to 
I am using the "-cwd" in the nativeSpecification. Any hints what I might 
do wrong here? SGE 6.0u2 precompiled on fedora core 3.
cheers ralf

here is my sample unit-test class:

package de.ipk.agbi.jdrCl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ggf.drmaa.DrmaaException;
import org.ggf.drmaa.JobTemplate;
import org.ggf.drmaa.Session;
import org.ggf.drmaa.SessionFactory;
import junit.framework.TestCase;

public class Test1 extends TestCase {
    private static final Log logger = LogFactory.getLog(Test1.class);
    private Session session;
    private String beanName ="s";

    public void testSimple() {
        SessionFactory factory = SessionFactory.getFactory();
        session = factory.getSession();
        try { session.exit();} catch 
(org.ggf.drmaa.NoActiveSessionException e ) {
            logger.info("Bean [" + beanName  + "] No Active Session 
found to exit before initializing singleton");
        } catch (DrmaaException e) {
            logger.error("session exit failed",e);
        try {
        } catch (DrmaaException e1) {
            logger.error("session init failed");
        try {
        } catch (DrmaaException e2) {
            logger.error("submit failed",e2);
    /** submit a jobscript to sge
     * @param s - an initialized drmaa session
     * @param workingDirectory - an absolute path to the intended 
working dir
     * @param cmdPath - the path to the execution script
     * @param queueName - an optional queue
     * @return the drmaa jobId
     * @throws DrmaaException
    public static String submitTest(Session session,
            String workingDirectory ,
            String cmdPath,
            String queueName) throws DrmaaException{
            JobTemplate jt = session.createJobTemplate();
            String nativeSpecification = "";
            if (queueName != null && queueName.length() > 0)
                nativeSpecification = "-q " + queueName+ " ";
            // we want to use a shell script
            // additionally the environment variable SGE_DRMAA_ALLOW_CWD 
has to be set!
            nativeSpecification += "-cwd -shell y -b n";
            jt.setNativeSpecification( nativeSpecification );
            /* setWorking Directory -- with this line the job submission 
            //jt.setWorkingDirectory("$drmaa_hd_ph$" );
            jt.setWorkingDirectory("/home/sigmund" );
            String id = null;
                 id = session.runJob(jt);
            } catch (Exception e) {
                throw new RuntimeException("runJobFailed",e);
            logger.info("submitted with id: "+id);
            return id;

To unsubscribe, e-mail: users-unsubscribe at gridengine.sunsource.net
For additional commands, e-mail: users-help at gridengine.sunsource.net

More information about the gridengine-users mailing list