jupyterhub / jupyterhub/batchspawner

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

Open
#294 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
207
Forks
136
PR merge metrics
No merged PRs in 30d

Description

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.