drmaa-python icon indicating copy to clipboard operation
drmaa-python copied to clipboard

jobEnvironment dropping content after = in value

Open cancan101 opened this issue 10 years ago • 6 comments

I am running this script:

   with drmaa.Session() as s:
       jt = s.createJobTemplate()
       jt.remoteCommand = "python"
       jt.args = ['env.py']
       jt.jobEnvironment = {'ALEX':'alex=2'}
       jt.joinFiles=True
       jobid = s.runJob(jt)
       s.deleteJobTemplate(jt)

with this script env.py:

import os
print os.environ

When I look at my environment, I see:

'ALEX': 'alex', 

cancan101 avatar Jul 22 '15 23:07 cancan101

For reference, this works fine: $ qsub -v ALEX=alex=2 -b y -j y python env.py.

cancan101 avatar Jul 22 '15 23:07 cancan101

That's very strange. From looking at where we handle setting DictAttribute values, I don't see anything that jumps out as wrong.

Could you try changing {'ALEX': 'alex=2'} to {'ALEX': '"alex=2"'} (with extra inner double-quotes around the value)? I'm wondering if the DRMAA C implementation you're using is doing something stupid on its end.

dan-blanchard avatar Jul 23 '15 13:07 dan-blanchard

I believe I was able to get this bug reproduced using your travis setup: https://github.com/pygridtools/drmaa-python/commit/c8a9c5e42425760421dff1611ecd89718a435e7d results: https://travis-ci.org/cancan101/drmaa-python/jobs/72308774

cancan101 avatar Jul 23 '15 15:07 cancan101

Wrapping with " still leads to the same truncation after the =: '"alex

cancan101 avatar Jul 23 '15 15:07 cancan101

FYI, this bug is in the C implementation of DRMAA, see http://gridengine.org/pipermail/users/2016-April/009042.html

nicoulaj avatar Jun 16 '17 12:06 nicoulaj

It's worth noting that users may be able to hack around this by using nativeSpecification. In any event, this is an issue with the particular DRMAA implementation itself and not drmaa-python. As such, this probably should be closed. Possibly could add a note in the docs about this issue and the (proposed) workaround.

jakirkham avatar Mar 12 '18 14:03 jakirkham