diff --git a/services/webapp/code/rosetta/core_app/computing_managers.py b/services/webapp/code/rosetta/core_app/computing_managers.py index 8894ad6c008e21d5b0c4c36e05f62bcf9b45a01b..06a017f1451f13a710b7db152e426f1fdf9f7ce8 100644 --- a/services/webapp/code/rosetta/core_app/computing_managers.py +++ b/services/webapp/code/rosetta/core_app/computing_managers.py @@ -1,6 +1,6 @@ import os from .models import TaskStatuses, KeyPair, Task, Storage -from .utils import os_shell, get_ssh_access_mode_credentials, sanitize_container_env_vars, booleanize +from .utils import os_shell, get_ssh_access_mode_credentials, sanitize_container_env_vars, booleanize, setup_tunnel_and_proxy from .exceptions import ErrorMessage, ConsistencyException from django.conf import settings @@ -179,6 +179,10 @@ class InternalStandaloneComputingManager(StandaloneComputingManager): # Save task.save() + + # Setup the tunnel if using a custom protocol (otherwise it will get set up via the "connect" button) + if task.container.interface_protocol not in ['http', 'https']: + setup_tunnel_and_proxy(task) def _stop_task(self, task): @@ -382,6 +386,10 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana # Save task.save() + # Setup the tunnel if using a custom protocol (otherwise it will get set up via the "connect" button) + if task.container.interface_protocol not in ['http', 'https']: + setup_tunnel_and_proxy(task) + def _stop_task(self, task, **kwargs): @@ -585,6 +593,9 @@ class SlurmSSHClusterComputingManager(ClusterComputingManager, SSHComputingManag # Save task.save() + # Setup the tunnel if using a custom protocol (otherwise it will get set up via the "connect" button) + if task.container.interface_protocol not in ['http', 'https']: + setup_tunnel_and_proxy(task) def _stop_task(self, task, **kwargs): diff --git a/services/webapp/code/rosetta/core_app/templates/components/task.html b/services/webapp/code/rosetta/core_app/templates/components/task.html index c3ac7f05f359ae25ed29b54e22cdd2b1805c7322..6ed502bfb3562131249b67ae5602d70167359def 100644 --- a/services/webapp/code/rosetta/core_app/templates/components/task.html +++ b/services/webapp/code/rosetta/core_app/templates/components/task.html @@ -46,6 +46,12 @@ <div style="margin-top:2px"> {% if task.status == "running" %} <b>Status:</b> <font color="green">running</font> + {% if task.interface_protocol == 'http' or task.interface_protocol == 'http' %} + {% else %} + @ port {{ task.tcp_tunnel_port }} + {% endif %} + + {% else %} <b>Status:</b> {{ task.status }} {% endif %} @@ -63,12 +69,14 @@ <!-- Connect --> {% if task.interface_port %} + {% if task.interface_protocol == 'http' or task.interface_protocol == 'http' %} {% if task.status == "running" %} <a href="/task_connect/?uuid={{task.uuid}}" class="btn btn-connect">Connect</a> {% else %} <a href="" class="btn btn-disabled">Connect</a> {% endif %} {% endif %} + {% endif %} <!-- View log --> {% if task.status == "running" %}