Commit 9e551c06 authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Imporved and fixed bug in task creation. Minor other fixes.

parent 5d90f24d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -307,6 +307,7 @@ print(port)
                logger.info('Setting task "{}" to ip "{}" and port "{}"'.format(task.uuid, task_ip, task_port))
                task.status = TaskStatuses.running
                task.ip     = task_ip
                if task.container.supports_dynamic_ports:
                    task.port = int(task_port)
                task.save()
                        
+2 −2
Original line number Diff line number Diff line
@@ -317,8 +317,8 @@ class SlurmComputingManager(ComputingManager):
        # Submit the job
        if task.container.type == 'singularity':

            if not task.container.supports_dynamic_ports:
                raise Exception('This task does not support dynamic port allocation and is therefore not supported using singularity on Slurm')
            #if not task.container.supports_dynamic_ports:
            #     raise Exception('This task does not support dynamic port allocation and is therefore not supported using singularity on Slurm')

            # Set pass if any
            if task.auth_pass:
+8 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ class Container(models.Model):
    image    = models.CharField('Container image', max_length=255, blank=False, null=False)
    type     = models.CharField('Container type', max_length=36, blank=False, null=False)
    registry = models.CharField('Container registry', max_length=255, blank=False, null=False)
    ports    = models.CharField('Container service ports', max_length=36, blank=True, null=True)
    ports    = models.CharField('Container ports', max_length=36, blank=True, null=True)

    # Capabilities
    supports_dynamic_ports = models.BooleanField(default=False)
@@ -106,6 +106,13 @@ class Container(models.Model):
        color_map_index = string_int_hash % len(color_map)
        return color_map[color_map_index]

    @property 
    def port(self):
        if not self.ports:
            return None
        return(int(self.ports.split(',')[0]))
            
            


#=========================
+1 −1
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@
        </div>
        
        <div style="margin-bottom:10px; text-align:center">
        <a href="/create_task?container_uuid={{ container.uuid }}" class="btn btn-light" style="border: #c0c0c0 1px solid">&nbsp;<i class="fa fa-play" style="color:green"></i></a>
        <a href="/create_task?task_container_uuid={{ container.uuid }}" class="btn btn-light" style="border: #c0c0c0 1px solid">&nbsp;<i class="fa fa-play" style="color:green"></i></a>
        </div>    
      
      
+20 −8
Original line number Diff line number Diff line
@@ -83,16 +83,23 @@
            {% else %}
            <!-- <a href=?uuid={{task.uuid}}&action=start>Start</a> |  -->
            <font color="#c0c0c0">Stop</font> | 
            
            {% endif %}
            <a href="?uuid={{task.uuid}}&action=delete&details=False">Delete</a>
            
            {% if task.port %}
            {% if task.status == "running" %}
             | <a href="?uuid={{task.uuid}}&action=connect">Connect</a>
            {% else %}
             | <font color="#c0c0c0">Connect</font>
            {% endif%}
            {% endif %}
            
            {% if task.status == "created" %}
             | <font color="#c0c0c0">View Log</font>
            {% else %}
             | <a href="/task_log/?uuid={{task.uuid}}&action=viewlog">View Log</a>             
            {% endif %}
            

            </td>
  
@@ -144,23 +151,28 @@
 
            <div style="margin-bottom:10px; text-align:center; padding:5px">
            
            <!-- Stop / Delete -->
            {% if task.status == "stopped" %}
            <!-- Stop / Delete / Cancel -->
            {% if task.status == "stopped" or task.status == "created" %}
            <a href="?uuid={{task.uuid}}&action=delete&fromlist=True" class="btn btn-action">Delete</a>
            {% else %}            
            <a href="?uuid={{task.uuid}}&action=stop&fromlist=True" class="btn btn-action">Stop</a>
            {% endif %}
            
            <!-- Connect -->
            {% if task.port %}
            {% if task.status == "running" %}
            <a href="?uuid={{task.uuid}}&action=connect" class="btn btn-connect">Connect</a>
            {% else %}
            <a href="" class="btn btn-disabled">Connect</a>  
            {% endif %}
            {% endif %}
                        
            <!-- View log -->
            {% if task.status == "created" %}
            <a href="" class="btn btn-disabled">Logs</a>  
            {% else %}
            <a href="/task_log/?uuid={{task.uuid}}&action=viewlog" class="btn btn-action">Logs</a>        

            {% endif %}
            </div>    
          
          
Loading