Snakemake-Profiles / lsf

Snakemake profile for running jobs on an LSF cluster
MIT License
36 stars 22 forks source link

Group job ids are (now?) uuids #19

Closed funnell closed 4 years ago

funnell commented 4 years ago

Hello,

Group jobids seem to be string uuids which causes an error in lsf_submit.py https://snakemake.readthedocs.io/en/stable/_modules/snakemake/jobs.html

mbhall88 commented 4 years ago

Could you please provide the error?

leoisl commented 4 years ago

Just a reminder that grouped jobs is the only thing we are not testing currently in the job submitter, we should have tests covering it when closing this issue!

funnell commented 4 years ago

Yes, sorry I don't remember the exact error. But the gist is that casting a part of the uuid string to int fails in this bit of code:

def jobid(self) -> int:
        if self.is_group_jobtype:
            return int(self.job_properties.get("jobid", "").split("-")[0])
        return int(self.job_properties.get("jobid"))
mbhall88 commented 4 years ago

Ok. I'll see if I can reproduce this and at the same time add some unit tests because as @leoisl says, this is about the only thing we aren't testing at the moment.

mbhall88 commented 4 years ago

I was able to reproduce this. An example error (with a print statement showing the contents of the job properties dictionary pass from snakemake):

{'type': 'group', 'groupid': 'mygroup', 'local': False, 'input': [], 'output': ['b/4.out'], 'threads': 1, 'resources': {}, 'jobid': 'a9722c33-51ba-5ac4-9f17-bab04c68bc3d', 'cluster': {}}
Traceback (most recent call last):
  File "/homes/mbhall88/.config/snakemake/lsf-dev/lsf_submit.py", line 238, in <module>
    lsf_submit.submit()
  File "/homes/mbhall88/.config/snakemake/lsf-dev/lsf_submit.py", line 207, in submit
    self._remove_previous_logs()  # we could be very unlucky of having the same 64-length random string with the same jobid
  File "/homes/mbhall88/.config/snakemake/lsf-dev/lsf_submit.py", line 191, in _remove_previous_logs
    OSLayer.remove_file(self.outlog)
  File "/homes/mbhall88/.config/snakemake/lsf-dev/lsf_submit.py", line 143, in outlog
    jobid=self.jobid, random_string=self.random_string
  File "/homes/mbhall88/.config/snakemake/lsf-dev/lsf_submit.py", line 132, in jobid
    return int(self.job_properties.get("jobid", "").split("-")[0])
ValueError: invalid literal for int() with base 10: 'a9722c33'
mbhall88 commented 4 years ago

Ok, #23 has a fix. Could either/both of you take a look and see if there are any problems with it before I merge?