bioidiap / gridtk

Parallel Job Manager - Mirrored from https://gitlab.idiap.ch/bob/gridtk
https://www.idiap.ch/software/bob
1 stars 1 forks source link

qsub -sync throws an error. #1

Open gilmorera opened 11 months ago

gilmorera commented 11 months ago

Hi @anjos et. al,

I'm using gridtk with UGE and it seems to work. The only problem I've had is when using qsub -sync it circumvents the -terse functionality (see below). I was also unable to make any comments or issues in the GitLab instance where this repo is mirrored, so sorry if I missed something (?).

from gridtk.tools import qsub
qsub([jobscript],
     sge_extra_args='-sync y -V')

The following has output like this:

123456
Job 123456 exited with exit code 0.

I tested the output in my python console with the code from the original traceback which pointed me here: https://github.com/bioidiap/gridtk/blob/82d328d5f9de18ac569a6856175ed071d20ba998/src/gridtk/tools.py#L258C12-L258C55

# my test
>>> jobid = '123456\nJob 123456 exited with exit code 0.'
>>> int(jobid.split("\n")[-1].split(".", 1)[0])

Traceback (most recent call last):
  File "/Users/gilmorera/Library/Caches/pypoetry/virtualenvs/gris-seqr-vcf-processing-3KNk8Ldu-py3.10/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3548, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-31-408eaadb10e5>", line 1, in <module>
    int(jobid.split("\n")[-1].split(".", 1)[0])
ValueError: invalid literal for int() with base 10: 'Job 123456 exited with exit code 0'
gilmorera commented 11 months ago

Here's the solution I've put in my local (https://github.com/bioidiap/gridtk/blob/82d328d5f9de18ac569a6856175ed071d20ba998/src/gridtk/tools.py#L258C12-L258C55)

#def qsub(......
#....
    if '-sync' in scmd:
        return int(jobid.split("\n")[-2].split(".", 1)[0])
    else:
        return int(jobid.split("\n")[-1].split(".", 1)[0])