Skip to content
Snippets Groups Projects
Commit 79a920f9 authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Added support for Slurm job options and setting their default values in the Computing conf.

parent 1e588e61
No related branches found
No related tags found
No related merge requests found
......@@ -314,23 +314,24 @@ class SlurmComputingManager(ComputingManager):
# Get webapp conn string
from.utils import get_webapp_conn_string
webapp_conn_string = get_webapp_conn_string()
# Initialize sbatch args (force 1 task for now)
sbatch_args = '-N1 '
# Get task computing parameters and set sbatch args
sbatch_args = ''
if task.computing_options:
task_partition = task.computing_options.get('partition', None)
task_cpus = task.computing_options.get('cpus', None)
task_memory = task.computing_options.get('memory', None)
# Set sbatch args
sbatch_args = ''
if task_partition:
sbatch_args += '-p {} '.format(task_partition)
#if task_cpus:
# sbatch_args += '-c {} '.format()
#if task_memory:
# sbatch_args += '-m {} '.format()
if task_cpus:
sbatch_args += '-c {} '.format(task_cpus)
if task_memory:
sbatch_args += '--mem {} '.format(task_memory)
# Set output and error files
sbatch_args += ' --output=\$HOME/{}.log --error=\$HOME/{}.log '.format(task.uuid, task.uuid)
......
......@@ -226,7 +226,7 @@ class Command(BaseCommand):
# Create demo slurm sys computing conf
ComputingSysConf.objects.create(computing = demo_slurm_computing,
data = {'master': 'slurmclustermaster-main'})
data = {'master': 'slurmclustermaster-main', 'default_partition': 'partition1'})
# Create demo slurm user computing conf
ComputingUserConf.objects.create(user = testuser,
......
......@@ -211,6 +211,14 @@ class Computing(models.Model):
return None
return param_value
@property
def conf_params(self):
class ConfParams():
def __init__(self, computing):
self.computing = computing
def __getitem__(self, key):
return self.computing.get_conf_param(key)
return ConfParams(self)
@property
def manager(self):
......
......@@ -185,9 +185,9 @@
<td><b>Computing options</b></td>
<td>
<table>
<tr><td>Partition</td><td><input type="text" name="computing_partition" value="" placeholder="" size="20" /></td></tr>
<tr><td>Cpus</td><td><input type="text" name="computing_cpus" value="" placeholder="" size="5" /></td></tr>
<tr><td>Memory</td><td><input type="text" name="computing_memory" value="" placeholder="" size="5" /></td></tr>
<tr><td>Partition</td><td><input type="text" name="computing_partition" value="{{ data.task_computing.conf_params.default_partition }}" placeholder="" size="20" /></td></tr>
<tr><td>Cpus</td><td><input type="text" name="computing_cpus" value="{{ data.task_computing.conf_params.default_cpus }}" placeholder="" size="5" /></td></tr>
<tr><td>Memory</td><td><input type="text" name="computing_memory" value="{{ data.task_computing.conf_params.default_memory }}" placeholder="" size="5" /></td></tr>
</table>
</td>
</tr>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment