[GE users] drmaa setWorkingDirectory

Daniel Templeton Dan.Templeton at Sun.COM
Thu Mar 17 10:38:42 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. ]

Have you tried it without -cwd?  The reason -cwd is disabled by default
is that it is not thread safe.  In order to figure out what the current
directory is, it has to do some cd'ing around.

Daniel

Ralf Sigmund wrote:

>hello,
>whenever I try to use the method setWorkingDirectory on an jobTemplate 
>instance the java-process hangs at the subsequent call to 
>session.submit(jobtemplate);
>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 {
>            session.init(null);
>        } catch (DrmaaException e1) {
>            logger.error("session init failed");
>        }
>        try {
>            submitTest(session,"","simple.sh","long");
>        } 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 );
>        
>            jt.setRemoteCommand(cmdPath);
>            
>            /* setWorking Directory -- with this line the job submission 
>fails:*/
>            //jt.setWorkingDirectory("$drmaa_hd_ph$" );
>            jt.setWorkingDirectory("/home/sigmund" );
>            String id = null;
>            try{
>                 id = session.runJob(jt);
>            } catch (Exception e) {
>                logger.error("runJob",e);
>                throw new RuntimeException("runJobFailed",e);
>            }
>            logger.info("submitted with id: "+id);
>            session.exit();
>            return id;
>            }
>}
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe at gridengine.sunsource.net
>For additional commands, e-mail: users-help at gridengine.sunsource.net
>
>  
>

-- 
***************************************************
*        Daniel Templeton   ERGB01 x60220         *
*       Staff Engineer, Sun N1 Grid Engine        *
***************************************************
* "Roads? Where we're going we don't need roads." *
*                    -Dr. Emmett Brown            *
*                     Back to the Future (1985)   *
***************************************************



---------------------------------------------------------------------
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