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

Improved handling tunnel creation and removed the "connect" button for...

Improved handling tunnel creation and removed the "connect" button for non-http(s) interface protocol containers.
parent 53ae2ea4
No related branches found
No related tags found
No related merge requests found
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):
......
......@@ -46,6 +46,12 @@
<div style="margin-top:2px">
{% if task.status == "running" %}
<b>Status:</b> <font color="green">running</font>
{% if task.container.interface_protocol == 'http' or task.container.interface_protocol == 'https' %}
{% 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.container.interface_protocol == 'http' or task.container.interface_protocol == 'https' %}
{% 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" %}
......
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