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
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -315,21 +315,22 @@ class SlurmComputingManager(ComputingManager):
        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)
+1 −1
Original line number Diff line number Diff line
@@ -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,
+8 −0
Original line number Diff line number Diff line
@@ -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):
+3 −3
Original line number Diff line number Diff line
@@ -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>