drmaa error with sun grid engine - No active session

647 views Asked by At

Hi I've installed gridengine on a 4-node cluster using the following command:

sudo apt-get install gridengine-client gridengine-qmon gridengine-exec gridengine-master
sudo apt-get install gridengine-exec gridengine-client

And it returned:

SGE_ROOT: /var/lib/gridengine
SGE_CELL: bms

I've therefore done all the necessary step to configure the gridengine and it works.

However I want to run my job using python drmaa library and I've installed on the master node:

sudo apt-get install libdrmaa-dev
pip install drmaa

So if i query the system with following script:

#!/usr/bin/env python
import drmaa
def main():
    """Query the system."""
    s = drmaa.Session()
    s.initialize()
    print 'A DRMAA object was created'
    print 'Supported contact strings: ' + s.contact
    print 'Supported DRM systems: ' + str(s.drmsInfo)
    print 'Supported DRMAA implementations: ' + str(s.drmaaImplementation)
    print 'Version ' + str(s.version)
    print 'Exiting'
    s.exit()
if __name__=='__main__':
    main()

It returns:

 A DRMAA object was created
 Supported contact strings: session=NGS-1.9217.1679116461
 Supported DRM systems: GE 6.2u5
 Supported DRMAA implementations: GE 6.2u5
 Version 1.0
 Exiting

But if I try to run a job with the script suggested by the link: http://code.google.com/p/drmaa-python/wiki/Tutorial#Running_a_Job

It returns

drmaa.errors.NoActiveSessionException: code 5: No active session

Could anyone help me? What's wrong. The drmaa library looks like is able to communicate with gridengine but it cannot run a job. Why it raise this error? I would really appreciate any kind of help.

1

There are 1 answers

0
0x3bfc On

you will find that the example of running job using DRMAA does not initialize the session so just add s.initialize() after creating new session s = drmaa.Session() as following:

#!/usr/bin/env python

import drmaa
import os

def main():
   """Submit a job.
   Note, need file called sleeper.sh in current directory.
   """
   s = drmaa.Session()
   s.initialize()
   print 'Creating job template'
   jt = s.createJobTemplate()
   jt.remoteCommand = os.getcwd() + '/sleeper.sh'
   jt.args = ['42','Simon says:']
   jt.joinFiles=True

   jobid = s.runJob(jt)
   print 'Your job has been submitted with id ' + jobid

   print 'Cleaning up'
   s.deleteJobTemplate(jt)
   s.exit()

if __name__=='__main__':
    main()