diff --git a/services/webapp/code/rosetta/core_app/computing_managers.py b/services/webapp/code/rosetta/core_app/computing_managers.py index 2bad86f340de41c66d12989b1fa4fde5606a0949..37d1406adcdb05e0e20623595832fce3f1a9b7c4 100644 --- a/services/webapp/code/rosetta/core_app/computing_managers.py +++ b/services/webapp/code/rosetta/core_app/computing_managers.py @@ -111,7 +111,7 @@ class InternalStandaloneComputingManager(StandaloneComputingManager): #run_command += ' -v {}/user-{}:/data'.format(settings.LOCAL_USER_DATA_DIR, task.user.id) # Host name, image entry command - run_command += ' -h task-{} -d -t {}/{}:{}'.format(task.uuid, task.container.registry, task.container.image_name, task.container.image_tag) + run_command += ' -h task-{} -d -t {}/{}:{}'.format(task.short_uuid, task.container.registry, task.container.image_name, task.container.image_tag) # Debug logger.debug('Running new task with command="{}"'.format(run_command)) @@ -294,7 +294,7 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana run_command += '/bin/bash -c \'"rm -rf /tmp/{}_data && mkdir /tmp/{}_data && chmod 700 /tmp/{}_data && '.format(task.uuid, task.uuid, task.uuid) run_command += 'wget {}/api/v1/base/agent/?task_uuid={} -O /tmp/{}_data/agent.py &> /dev/null && export TASK_PORT=\$(python /tmp/{}_data/agent.py 2> /tmp/{}_data/task.log) && '.format(webapp_conn_string, task.uuid, task.uuid, task.uuid, task.uuid) run_command += '{} docker run -p \$TASK_PORT:{} {} {} '.format(prefix, task.container.interface_port, authstring, binds) - run_command += '-h task-{} -d -t {}/{}:{}'.format(task.uuid, task.container.registry, task.container.image_name, task.container.image_tag) + run_command += '-h task-{} -d -t {}/{}:{}'.format(task.short_uuid, task.container.registry, task.container.image_name, task.container.image_tag) run_command += '"\'' else: diff --git a/services/webapp/code/rosetta/core_app/models.py b/services/webapp/code/rosetta/core_app/models.py index 1415994bc67fa7bf09549025adc816328ac506f8..f98c409341308670e52021a959663c9ef52215db 100644 --- a/services/webapp/code/rosetta/core_app/models.py +++ b/services/webapp/code/rosetta/core_app/models.py @@ -331,6 +331,10 @@ class Task(models.Model): def __str__(self): return str('Task "{}" of user "{}" running on "{}" in status "{}" created at "{}"'.format(self.name, self.user.email, self.computing, self.status, self.created)) + @property + def short_uuid(self): + return str(self.uuid)[0:8] + @property def color(self): string_int_hash = hash_string_to_int(self.name) @@ -339,7 +343,7 @@ class Task(models.Model): @property def sharable_link(self): - return 'https://{}/t/{}'.format(settings.ROSETTA_HOST, str(self.uuid)[0:8]) + return 'https://{}/t/{}'.format(settings.ROSETTA_HOST, self.short_uuid) @property def tcp_tunnel_host(self): diff --git a/services/webapp/code/rosetta/core_app/templates/components/computing.html b/services/webapp/code/rosetta/core_app/templates/components/computing.html index 0ad13b5d71d7090ba89a27cadec6fd23690986b1..1e6935f480c647664433b1805d61aa7f0cc6fc28 100644 --- a/services/webapp/code/rosetta/core_app/templates/components/computing.html +++ b/services/webapp/code/rosetta/core_app/templates/components/computing.html @@ -93,8 +93,8 @@ <br/> {% endif %} <div class="image-version-box"> - <b>Type:</b> {{ computing.type }}<br/> - <b>Arch:</b> {{ computing.arch }} + <b>Type:</b> {{ computing.type }} <font style="font-size:0.9em">({{ computing.arch }})</font> + <!-- <br/><b>Arch:</b> {{ computing.arch }} --> <br/> <b>Storages:</b> {% if not computing.storages.all %} 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 effe0f1ccb5a21bf3e92b3ae3cc1456546993aa0..f7d83fb1a0a28c9cbf39a324df511b5441784fbc 100644 --- a/services/webapp/code/rosetta/core_app/templates/components/task.html +++ b/services/webapp/code/rosetta/core_app/templates/components/task.html @@ -107,9 +107,14 @@ <td>{{ task.name }}</td> </tr> --> - <tr> + <!-- <tr> <td><b>ID</b></td> <td>{{ task.id }}</td> + </tr> --> + + <tr> + <td><b>Short ID</b></td> + <td>{{ task.short_uuid }}</td> </tr> <tr> @@ -143,6 +148,13 @@ <td>{{ task.auth_token }}</td> </tr> {% endif %} + + {% if task.computing_options %} + <tr> + <td><b>Computing options</b></td> + <td>{{ task.computing_options }}</td> + </tr> + {% endif %} <!-- <tr><td style="padding-right:0"><b>Direct link</b> diff --git a/services/webapp/code/rosetta/core_app/templates/new_task.html b/services/webapp/code/rosetta/core_app/templates/new_task.html index 807e554010b057c255154ef7cf15a7d243bf77fd..991c902cb115d1ba9c8a4b01ac0a08f9964d8875 100644 --- a/services/webapp/code/rosetta/core_app/templates/new_task.html +++ b/services/webapp/code/rosetta/core_app/templates/new_task.html @@ -91,7 +91,12 @@ </tr> <tr> - <td valign="top"><b>Task password</b></td> + <td valign="top"> + {% if request.user.profile.is_power_user %} + <b>Task password</b></td> + {% else %} + <b>Auth token</b></td> + {% endif %} <td> <input type="hidden" name="task_auth_token" value="{{data.task_auth_token}}"> @@ -121,25 +126,20 @@ </select> </td> </tr> - {% else %} - <tr> - <td><b>Access method</b></td><td> - <select name="access_method" > - <option value="auto" selected>Auto</option> - </select> - </td> - </tr> {% endif %} + {% if data.task_computing.container_runtimes|length > 1 %} <tr> - <td><b>Container runtime</b></td><td> - <select name="run_using" > - <option value="default" selected>Default</option> - <!-- <option value="docker" selected>default</option> --> - <!-- <option value="singularity">Singularity</option> --> + <td><b>Container runtime</b></td><td> + <select name="container_runtime" > + <option value="" selected>Default</option> + {% for container_runtime in data.task_computing.container_runtimes %} + <option value="{{container_runtime}}">{{container_runtime}}</option> + {% endfor %} </select> </td> </tr> + {% endif %} {% if data.task_computing.wms == 'slurm' %} <tr> diff --git a/services/webapp/code/rosetta/core_app/views.py b/services/webapp/code/rosetta/core_app/views.py index 2e75f1ae5884da4fd367e0c1a4c3c58518b8c695..21687edb32af4057aa73d3941321277030703d8a 100644 --- a/services/webapp/code/rosetta/core_app/views.py +++ b/services/webapp/code/rosetta/core_app/views.py @@ -586,7 +586,7 @@ def new_task(request): task.requires_tcp_tunnel = True # Task access method - access_method = request.POST.get('access_method', None) + access_method = request.POST.get('access_method', 'auto') if access_method and access_method != 'auto' and not request.user.profile.is_power_user: raise ErrorMessage('Sorry, only power users can set a task access method other than \'auto\'.') if access_method == 'auto': @@ -605,12 +605,21 @@ def new_task(request): else: raise ErrorMessage('Unknown access method "{}"'.format(access_method)) - # Computing options # TODO: This is hardcoded thinking about Slurm and Singularity + # Computing options + computing_options = {} + + # Container runtime if any set + container_runtime = request.POST.get('container_runtime', None) + if container_runtime: + if not container_runtime in data['task_computing'].container_runtimes: + raise ErrorMessage('Unknown container runtime "{}"'.format(container_runtime)) + computing_options['container_runtime'] = container_runtime + + # CPUs, memory and partition if set computing_cpus = request.POST.get('computing_cpus', None) computing_memory = request.POST.get('computing_memory', None) computing_partition = request.POST.get('computing_partition', None) - computing_options = {} if computing_cpus: try: int(computing_cpus)