Enforce job_id as string
This commit is contained in:
parent
aaf16ee89d
commit
5cdee4d73d
2 changed files with 5 additions and 5 deletions
|
@ -80,7 +80,7 @@ class GlicidSpawner(SlurmSpawner):
|
|||
|
||||
slurm_job_id_re = Unicode(r'(\d+)(?:;(\w+))?').tag(config=True)
|
||||
|
||||
def parse_job_id(self, output):
|
||||
def parse_job_id(self, output) -> str:
|
||||
"""Parse job id with cluster name support.
|
||||
|
||||
If cluster name is present, `job_id` will be a string
|
||||
|
@ -88,10 +88,10 @@ class GlicidSpawner(SlurmSpawner):
|
|||
|
||||
"""
|
||||
for job_id, job_cluster in re.findall(self.slurm_job_id_re, output):
|
||||
return f'{job_id} -M {job_cluster}' if job_cluster else int(job_id)
|
||||
return f'{job_id} -M {job_cluster}' if job_cluster else job_id
|
||||
|
||||
self.log.error(f'GlicidSpawner unable to parse job ID from text: {output}')
|
||||
return None
|
||||
return ''
|
||||
|
||||
@default('options_form')
|
||||
def _options_form_default(self) -> str:
|
||||
|
|
|
@ -79,10 +79,10 @@ def test_spawner_parse_job_id():
|
|||
"""Test spawner job id parser."""
|
||||
spawner = GlicidSpawner()
|
||||
|
||||
assert spawner.parse_job_id('123') == 123
|
||||
assert spawner.parse_job_id('123') == '123'
|
||||
assert spawner.parse_job_id('456;nautilus') == '456 -M nautilus'
|
||||
|
||||
assert spawner.parse_job_id('') is None
|
||||
assert spawner.parse_job_id('') == ''
|
||||
|
||||
|
||||
def test_spawner_options_form(monkeypatch):
|
||||
|
|
Loading…
Add table
Reference in a new issue