MRocklin
MRocklin

Reputation: 57281

Get host of running job with DRMAA interface

Using the DRMAA interface to Son of Grid Engine I would like to get the name of a host running a particular job. I would like something like the following (using the drmaa-python interface)

>>> import drmaa
>>> s = drmaa.Session()
>>> s.initialize()

>>> jt = s.createJobTemplate()
>>> jt.remoteCommand = 'sleep'
>>> jt.args = ['100']

>>> jobid = s.runJob(jt)
>>> jobid
'1'
>>> s.jobStatus(jobid)
'running'

>>> s.the_function_I_want(jobid)
'worker-host-123'

Questions

  1. Is this possible through the DRMAA interface? Looking at the spec it seems not, but I thought I'd ask anyway
  2. If so, how?

Upvotes: 0

Views: 164

Answers (1)

Peter Tröger
Peter Tröger

Reputation: 312

Short answer: You are right, this is not possible.

Long answer:

The drmaa-python library acts as wrapper for an underlying C implementation of the DRMAAv1 API (see https://www.ogf.org/documents/GFD.130.pdf). Such a C library usually comes together with your cluster framework. DRMAAv1 does not support a standardized monitoring of jobs, and therefore both the DRMAAv1 C and Python library can't get this information.

If you wonder about that lack of functionality, please note that the original API design is from 2004.

The second version of DRMAA (https://www.ogf.org/documents/GFD.231.pdf) does support monitoring. At the time of writing, the only known implementation comes with Univa GridEngine, and there is no existing Python wrapper implementation for it.

You could try to parse the job log file by yourself to extract the execution host name. If you need to pass special options to qsub for getting such a file, you can use the nativeSpecification field in the job template.

Upvotes: 0

Related Questions