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

Added support for viewing Slurm task logs.

parent 5538403f
No related branches found
No related tags found
No related merge requests found
......@@ -412,7 +412,25 @@ class SlurmComputingManager(ComputingManager):
def _get_task_log(self, task, **kwargs):
raise NotImplementedError('Not implemented')
# Get user keys
if task.computing.require_user_auth_keys:
user_keys = Keys.objects.get(user=task.user, default=True)
else:
raise NotImplementedError('Remote tasks not requiring keys are not yet supported')
# Get computing host
host = task.computing.get_conf_param('master')
user = task.computing.get_conf_param('user')
# Stop the task remotely
view_log_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "cat \$HOME/{}.log"\''.format(user_keys.private_key_file, user, host, task.uuid)
out = os_shell(view_log_command, capture=True)
if out.exit_code != 0:
raise Exception(out.stderr)
else:
return out.stdout
......
......@@ -74,11 +74,12 @@
<a href="?uuid={{task.uuid}}&action=delete&details=False">Delete</a>
{% if task.status == "running" %}
| <a href="?uuid={{task.uuid}}&action=connect">Connect</a>
| <a href="/task_log/?uuid={{task.uuid}}&action=viewlog">View Log</a>
{% else %}
| <font color="#c0c0c0">Connect</font>
| <font color="#c0c0c0">View Log</font>
{% endif%}
| <a href="/task_log/?uuid={{task.uuid}}&action=viewlog">View Log</a>
</td>
</tr>
......
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