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

Fixed bugs in running tasks on standalone computing resources.

parent ec4eec10
No related branches found
No related tags found
No related merge requests found
...@@ -194,15 +194,16 @@ class SSHSingleNodeComputingManager(SingleNodeComputingManager, SSHComputingMana ...@@ -194,15 +194,16 @@ class SSHSingleNodeComputingManager(SingleNodeComputingManager, SSHComputingMana
from.utils import get_webapp_conn_string from.utils import get_webapp_conn_string
webapp_conn_string = get_webapp_conn_string() webapp_conn_string = get_webapp_conn_string()
# Run the container on the host (non blocking) # Handle container runtime
if task.container.type == 'singularity': if task.computing.default_container_runtime == 'singularity':
#if not task.container.supports_custom_interface_port:
# raise Exception('This task does not support dynamic port allocation and is therefore not supported using singularity on Slurm')
# Set pass if any # Set pass if any
if task.auth_pass:
authstring = ' export SINGULARITYENV_AUTH_PASS={} && '.format(task.auth_pass)
else:
authstring = '' authstring = ''
if not task.requires_proxy_auth and task.password:
authstring = ' export SINGULARITYENV_AUTH_PASS={} && '.format(task.password)
# Set binds, only from sys config if the resource is not owned by the user # Set binds, only from sys config if the resource is not owned by the user
if self.computing.user != task.user: if self.computing.user != task.user:
...@@ -227,18 +228,9 @@ class SSHSingleNodeComputingManager(SingleNodeComputingManager, SSHComputingMana ...@@ -227,18 +228,9 @@ class SSHSingleNodeComputingManager(SingleNodeComputingManager, SSHComputingMana
run_command += 'export SINGULARITY_NOHTTPS=true && export SINGULARITYENV_BASE_PORT=\$BASE_PORT && {} '.format(authstring) run_command += 'export SINGULARITY_NOHTTPS=true && export SINGULARITYENV_BASE_PORT=\$BASE_PORT && {} '.format(authstring)
run_command += 'exec nohup singularity run {} --pid --writable-tmpfs --no-home --home=/home/metauser --workdir /tmp/{}_data/tmp -B/tmp/{}_data/home:/home --containall --cleanenv '.format(binds, task.uuid, task.uuid) run_command += 'exec nohup singularity run {} --pid --writable-tmpfs --no-home --home=/home/metauser --workdir /tmp/{}_data/tmp -B/tmp/{}_data/home:/home --containall --cleanenv '.format(binds, task.uuid, task.uuid)
# Set registry # Container part
if task.container.registry == 'docker_local': run_command+='docker://{}/{}:{} &>> /tmp/{}_data/task.log & echo \$!"\''.format(task.container.registry, task.container.image, task.container.tag, task.uuid)
# Get local Docker registry conn string
from.utils import get_local_docker_registry_conn_string
local_docker_registry_conn_string = get_local_docker_registry_conn_string()
registry = 'docker://{}/'.format(local_docker_registry_conn_string)
elif task.container.registry == 'docker_hub':
registry = 'docker://'
else:
raise NotImplementedError('Registry {} not supported'.format(task.container.registry))
run_command+='{}{} &>> /tmp/{}_data/task.log & echo \$!"\''.format(registry, task.container.image, task.uuid)
else: else:
raise NotImplementedError('Container {} not supported'.format(task.container.type)) raise NotImplementedError('Container {} not supported'.format(task.container.type))
...@@ -274,7 +266,7 @@ class SSHSingleNodeComputingManager(SingleNodeComputingManager, SSHComputingMana ...@@ -274,7 +266,7 @@ class SSHSingleNodeComputingManager(SingleNodeComputingManager, SSHComputingMana
user = self.computing.conf.get('user') user = self.computing.conf.get('user')
# Stop the task remotely # Stop the task remotely
stop_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "kill -9 {}"\''.format(user_keys.private_key_file, user, host, task.pid) stop_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "kill -9 {}"\''.format(user_keys.private_key_file, user, host, task.id)
out = os_shell(stop_command, capture=True) out = os_shell(stop_command, capture=True)
if out.exit_code != 0: if out.exit_code != 0:
if not 'No such process' in out.stderr: if not 'No such process' in out.stderr:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment