Compare commits
No commits in common. "main" and "v1.1" have entirely different histories.
9 changed files with 14 additions and 34 deletions
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "glicid-spawner"
|
name = "glicid-spawner"
|
||||||
version = "1.2"
|
version = "1.1"
|
||||||
description = "JupyterHub Batch Spawner for GLiCID"
|
description = "JupyterHub Batch Spawner for GLiCID"
|
||||||
authors = ["Benoit Seignovert <benoit.seignovert@univ-nantes.fr>"]
|
authors = ["Benoit Seignovert <benoit.seignovert@univ-nantes.fr>"]
|
||||||
license = "BSD 3-Clause License"
|
license = "BSD 3-Clause License"
|
||||||
|
@ -90,7 +90,7 @@ exclude_lines = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.tbump.version]
|
[tool.tbump.version]
|
||||||
current = "1.2"
|
current = "1.1"
|
||||||
regex = '(?P<major>\d+)\.(?P<patch>\d+)'
|
regex = '(?P<major>\d+)\.(?P<patch>\d+)'
|
||||||
|
|
||||||
[tool.tbump.git]
|
[tool.tbump.git]
|
||||||
|
|
|
@ -9,7 +9,6 @@ GLOBAL_USER = 'operator'
|
||||||
|
|
||||||
MAMBA_ROOT_PREFIX = f'{MICROMAMBA_ROOT}/{GLOBAL_USER}'
|
MAMBA_ROOT_PREFIX = f'{MICROMAMBA_ROOT}/{GLOBAL_USER}'
|
||||||
MAMBA_EXE = f'{MAMBA_ROOT_PREFIX}/bin/micromamba'
|
MAMBA_EXE = f'{MAMBA_ROOT_PREFIX}/bin/micromamba'
|
||||||
MAMBA_USER_BASE = f'{MICROMAMBA_ROOT}/$USER'
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|
|
@ -69,7 +69,7 @@ class SlurmNode:
|
||||||
self.state = state.strip().lower()
|
self.state = state.strip().lower()
|
||||||
self.cpu = SlurmCpu(*re.findall(r'(\d+)/(\d+)/\d+/(\d+)', cpus_state)[0])
|
self.cpu = SlurmCpu(*re.findall(r'(\d+)/(\d+)/\d+/(\d+)', cpus_state)[0])
|
||||||
self.mem = int(memory_mb) // 1000 # in GB
|
self.mem = int(memory_mb) // 1000 # in GB
|
||||||
self.gpu = SlurmGpu(*re.findall(r'gpu:([\w\.]+):(\d+)', gres)[0] if 'gpu:' in gres else [])
|
self.gpu = SlurmGpu(*re.findall(r'gpu:(\w+):(\d+)', gres)[0] if 'gpu:' in gres else [])
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.hostname
|
return self.hostname
|
||||||
|
|
|
@ -9,7 +9,7 @@ from batchspawner import JobStatus, SlurmSpawner
|
||||||
from traitlets import Bool, Integer, Unicode, default
|
from traitlets import Bool, Integer, Unicode, default
|
||||||
|
|
||||||
from .form import options_form, options_from_form
|
from .form import options_form, options_from_form
|
||||||
from .micromamba import MAMBA_EXE, MAMBA_ROOT_PREFIX, MAMBA_USER_BASE
|
from .micromamba import MAMBA_EXE, MAMBA_ROOT_PREFIX
|
||||||
from .progress import ElapseTime, get_progress
|
from .progress import ElapseTime, get_progress
|
||||||
from .templates import get_template_src
|
from .templates import get_template_src
|
||||||
|
|
||||||
|
@ -24,19 +24,14 @@ class GlicidSpawner(SlurmSpawner):
|
||||||
help='Spawner singleuser command.',
|
help='Spawner singleuser command.',
|
||||||
).tag(config=True)
|
).tag(config=True)
|
||||||
|
|
||||||
req_mamba_exe = Unicode(
|
|
||||||
MAMBA_EXE,
|
|
||||||
help='Micromamba global exe',
|
|
||||||
).tag(config=True)
|
|
||||||
|
|
||||||
req_mamba_root_prefix = Unicode(
|
req_mamba_root_prefix = Unicode(
|
||||||
MAMBA_ROOT_PREFIX,
|
MAMBA_ROOT_PREFIX,
|
||||||
help='Micromamba global root prefix',
|
help='Micromamba global root prefix',
|
||||||
).tag(config=True)
|
).tag(config=True)
|
||||||
|
|
||||||
req_mamba_user_base = Unicode(
|
req_mamba_exe = Unicode(
|
||||||
MAMBA_USER_BASE,
|
MAMBA_EXE,
|
||||||
help='Micromamba user base prefix',
|
help='Micromamba global exe',
|
||||||
).tag(config=True)
|
).tag(config=True)
|
||||||
|
|
||||||
req_job_name = Unicode(
|
req_job_name = Unicode(
|
||||||
|
|
|
@ -33,7 +33,6 @@ echo "The {{job_name}} logs are located in: ${JUPYTER_LOG_DIR}"
|
||||||
{# Micromamba config -#}
|
{# Micromamba config -#}
|
||||||
export MAMBA_EXE={{mamba_exe}};
|
export MAMBA_EXE={{mamba_exe}};
|
||||||
export MAMBA_ROOT_PREFIX={{mamba_root_prefix}};
|
export MAMBA_ROOT_PREFIX={{mamba_root_prefix}};
|
||||||
export PYTHONUSERBASE={{ mamba_user_base }};
|
|
||||||
source $MAMBA_ROOT_PREFIX/etc/profile.d/micromamba.sh;
|
source $MAMBA_ROOT_PREFIX/etc/profile.d/micromamba.sh;
|
||||||
|
|
||||||
{# Activate micromamba env requested by the user -#}
|
{# Activate micromamba env requested by the user -#}
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
data-max-duration="{{max_duration}}"
|
data-max-duration="{{max_duration}}"
|
||||||
{%- if loop.first %} checked{% endif %}>
|
{%- if loop.first %} checked{% endif %}>
|
||||||
<label for="gpu_{{gpu}}" class="btn btn-default btn-block">
|
<label for="gpu_{{gpu}}" class="btn btn-default btn-block">
|
||||||
{{ gpu | replace("_"," ") | replace("."," ") | replace("gb","GB") }}
|
{{ gpu }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
|
|
|
@ -9,13 +9,13 @@ nautilus standard cnode001 completing
|
||||||
nautilus bigmem cnode002 planned 0/96/0/96 768000 (null)
|
nautilus bigmem cnode002 planned 0/96/0/96 768000 (null)
|
||||||
nautilus gpu gnode1 mixed 4/92/0/96 768000 gpu:A100:1(S:0-1)
|
nautilus gpu gnode1 mixed 4/92/0/96 768000 gpu:A100:1(S:0-1)
|
||||||
nautilus gpu gnode2 idle 0/96/0/96 256000 gpu:A100:2(S:0-1)
|
nautilus gpu gnode2 idle 0/96/0/96 256000 gpu:A100:2(S:0-1)
|
||||||
nautilus gpu gnode3 allocated 96/0/0/96 128000 gpu:A100_2g.10gb:6(S
|
nautilus gpu gnode3 allocated 96/0/0/96 128000 gpu:A100:4(S:0-1)
|
||||||
nautilus visu visu1 idle 0/96/0/96 768000 (null)
|
nautilus visu visu1 idle 0/96/0/96 768000 (null)
|
||||||
nautilus all cnode001 completing 0/96/0/96 384000 (null)
|
nautilus all cnode001 completing 0/96/0/96 384000 (null)
|
||||||
nautilus all cnode002 planned 0/96/0/96 768000 (null)
|
nautilus all cnode002 planned 0/96/0/96 768000 (null)
|
||||||
nautilus all gnode1 mixed 4/92/0/96 768000 gpu:A100:1(S:0-1)
|
nautilus all gnode1 mixed 4/92/0/96 768000 gpu:A100:1(S:0-1)
|
||||||
nautilus all gnode2 idle 0/96/0/96 256000 gpu:A100:2(S:0-1)
|
nautilus all gnode2 idle 0/96/0/96 256000 gpu:A100:2(S:0-1)
|
||||||
nautilus all gnode3 allocated 96/0/0/96 128000 gpu:A100_2g.10gb:6(S
|
nautilus all gnode3 allocated 96/0/0/96 128000 gpu:A100:4(S:0-1)
|
||||||
nautilus all visu1 idle 0/96/0/96 768000 (null)
|
nautilus all visu1 idle 0/96/0/96 768000 (null)
|
||||||
waves standard cribbar001 mixed 30/10/0/40 16000 (null)
|
waves standard cribbar001 mixed 30/10/0/40 16000 (null)
|
||||||
waves gpu budbud006 allocated 64/0/0/64 256000 gpu:a100:2,mps:a100:
|
waves gpu budbud006 allocated 64/0/0/64 256000 gpu:a100:2,mps:a100:
|
||||||
|
|
|
@ -161,17 +161,9 @@ def test_slurm_sinfo_reader():
|
||||||
'P100',
|
'P100',
|
||||||
'K80',
|
'K80',
|
||||||
'P100',
|
'P100',
|
||||||
'A100',
|
] + 8 * ['A100']
|
||||||
'A100',
|
|
||||||
'A100_2g.10gb',
|
|
||||||
'A100',
|
|
||||||
'A100',
|
|
||||||
'A100_2g.10gb',
|
|
||||||
'A100',
|
|
||||||
'A100',
|
|
||||||
]
|
|
||||||
|
|
||||||
assert [node.gpu.nb for node in nodes if node.gpu] == [2, 2, 2, 4, 1, 1, 2, 6, 1, 2, 6, 2, 2]
|
assert [node.gpu.nb for node in nodes if node.gpu] == [2, 2, 2, 4, 1, 1, 2, 4, 1, 2, 4, 2, 2]
|
||||||
|
|
||||||
|
|
||||||
def test_slurm_sinfo_filter(monkeypatch):
|
def test_slurm_sinfo_filter(monkeypatch):
|
||||||
|
@ -261,4 +253,4 @@ def test_slurm_gres():
|
||||||
gpus = gres(resources)
|
gpus = gres(resources)
|
||||||
|
|
||||||
# Sorted and without duplicates
|
# Sorted and without duplicates
|
||||||
assert gpus == ['A100', 'A100_2g.10gb', 'A40', 'None', 'P100', 'T4']
|
assert gpus == ['A100', 'A40', 'None', 'P100', 'T4']
|
||||||
|
|
|
@ -27,9 +27,8 @@ def test_spawner_config():
|
||||||
assert 'bin/glicid-spawner-singleuser' in cmd
|
assert 'bin/glicid-spawner-singleuser' in cmd
|
||||||
assert 'bin/jupyterhub-singleuser' in cmd
|
assert 'bin/jupyterhub-singleuser' in cmd
|
||||||
|
|
||||||
assert spawner.req_mamba_exe == '/micromamba/operator/bin/micromamba'
|
|
||||||
assert spawner.req_mamba_root_prefix == '/micromamba/operator'
|
assert spawner.req_mamba_root_prefix == '/micromamba/operator'
|
||||||
assert spawner.req_mamba_user_base == '/micromamba/$USER'
|
assert spawner.req_mamba_exe == '/micromamba/operator/bin/micromamba'
|
||||||
assert spawner.req_job_name == 'jupyterhub_glicid'
|
assert spawner.req_job_name == 'jupyterhub_glicid'
|
||||||
assert spawner.req_qos == 'short'
|
assert spawner.req_qos == 'short'
|
||||||
|
|
||||||
|
@ -71,12 +70,8 @@ def test_spawner_batch_script(monkeypatch):
|
||||||
|
|
||||||
assert 'export MAMBA_EXE=/micromamba/operator/bin/micromamba;' in script
|
assert 'export MAMBA_EXE=/micromamba/operator/bin/micromamba;' in script
|
||||||
assert 'export MAMBA_ROOT_PREFIX=/micromamba/operator;' in script
|
assert 'export MAMBA_ROOT_PREFIX=/micromamba/operator;' in script
|
||||||
assert 'export PYTHONUSERBASE=/micromamba/$USER;' in script
|
|
||||||
assert 'micromamba activate /micromamba/john-doe/envs/foo;' in script
|
assert 'micromamba activate /micromamba/john-doe/envs/foo;' in script
|
||||||
|
|
||||||
assert 'micromamba activate /micromamba/john-doe/envs/foo;' in script
|
|
||||||
assert 'export JUPYTER_PATH=/micromamba/john-doe/envs/foo/share/jupyter;' in script
|
|
||||||
|
|
||||||
assert re.search(r'.*/bin/glicid-spawner-singleuser .*/bin/jupyterhub-singleuser', script)
|
assert re.search(r'.*/bin/glicid-spawner-singleuser .*/bin/jupyterhub-singleuser', script)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue