diff --git a/src/glicid_spawner/form.py b/src/glicid_spawner/form.py index 143e228..56e6db4 100644 --- a/src/glicid_spawner/form.py +++ b/src/glicid_spawner/form.py @@ -11,6 +11,10 @@ TEMPLATES = Environment( autoescape=select_autoescape(), ) +GRES_CLUSTERS_LOWERCASE = [ + 'waves', +] + def options_attrs(username: str) -> dict: """Form options attributes.""" @@ -62,7 +66,10 @@ def options_from_form(formdata) -> dict: } if gpu != 'None': - options['gres'] = f'gpu:{gpu.lower()}' + if cluster in GRES_CLUSTERS_LOWERCASE: + gpu = gpu.lower() + + options['gres'] = f'gpu:{gpu}' if cluster: options['cluster'] = cluster diff --git a/tests/test_form.py b/tests/test_form.py index d04fafd..9fd17fb 100644 --- a/tests/test_form.py +++ b/tests/test_form.py @@ -283,7 +283,7 @@ def test_options_from_form(): 'nprocs': 2, 'memory': '16GB', 'runtime': '02:00:00', - 'gres': 'gpu:a40', + 'gres': 'gpu:A40', 'cluster': 'nautilus', } @@ -303,7 +303,7 @@ def test_options_from_form(): 'nprocs': 8, 'memory': '16GB', 'runtime': '01:00:00', - 'gres': 'gpu:t4', + 'gres': 'gpu:T4', 'partition': 'GPU-short', } @@ -314,6 +314,7 @@ def test_options_from_form(): 'cpu': ['128'], 'mem': ['4096'], 'gpu': ['A100'], + 'cluster': ['waves'], # Gres should be lowercased for this cluster 'node': ['cribbar001'], } @@ -324,5 +325,6 @@ def test_options_from_form(): 'memory': '4096GB', 'runtime': '00:00:00', 'gres': 'gpu:a100', + 'cluster': 'waves', 'node': 'cribbar001', }