Skip to content

Parsing a shortened host list (2*host1) of LSF #294

Open
@htakamur

Description

@htakamur

Proposed change

I want to share a brief feedback regarding working with LSF. batchspawner works fine for me with LSF; however, I noticed one thing. Usually, bjobs command returns a host list using ":" as a separator as follows:
RUN host1:host1
Meanwhile, if LSB_SHORT_HOSTLIST=1 is defined in lsf.conf, bjobs returns the list using a shorter format as follows:
RUN 2*host1
which makes a wrong URL, i.e., http://2*host1. So, to avoid this problem and accept both cases correctly, I modified the return statement in state_gethost() in LsfSpawner using re.sub() as follows:

     def state_gethost(self):
         if self.job_status:
-            return self.job_status.split(" ")[1].strip().split(":")[0]
+            return re.sub(r"^[1-9].*\*","",self.job_status.split(" ")[1].strip().split(":")[0])

Even though this change (removing the n* before the hostname) works for me, a better way may be inheriting and overriding regex(exechost_re) in the class LsfSpawner as well as TorqueSpawner. I hope this helps those with a problem regarding the host list in LSF.

Alternative options

Inheriting and overriding regex(exechost_re) in the class LsfSpawner

Who would use this feature?

LSF users

(Optional): Suggest a solution

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions