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

Added support for bindings in Singularity sys conf.

parent 192f21f7
No related branches found
No related tags found
No related merge requests found
......@@ -332,12 +332,17 @@ class SlurmComputingManager(ComputingManager):
else:
authstring = ''
bindings = task.computing.get_conf_param('bindings', from_sys_only=True )
if not bindings:
bindings = ''
else:
bindings = '-B {}'.format(bindings)
run_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, user, host)
run_command += '\'bash -c "echo \\"#!/bin/bash\nwget {}/api/v1/base/agent/?task_uuid={} -O \$HOME/agent_{}.py &> \$HOME/{}.log && export BASE_PORT=\\\\\\$(python \$HOME/agent_{}.py 2> \$HOME/{}.log) && '.format(webapp_conn_string, task.uuid, task.uuid, task.uuid, task.uuid, task.uuid)
run_command += 'export SINGULARITY_NOHTTPS=true && export SINGULARITYENV_BASE_PORT=\\\\\\$BASE_PORT && {} '.format(authstring)
run_command += 'exec nohup singularity run --pid --writable-tmpfs --containall --cleanenv '
run_command += 'exec nohup singularity run {} --pid --writable-tmpfs --containall --cleanenv '.format(bindings)
# Double to escape for python six for shell (double times three as \\\ escapes a single slash in shell)
......
......@@ -152,11 +152,17 @@ class Computing(models.Model):
self._user_conf_data = None
def get_conf_param(self, param):
def get_conf_param(self, param, from_sys_only=False):
try:
param_value = self.sys_conf_data[param]
except (TypeError, KeyError):
param_value = self.user_conf_data[param]
if not from_sys_only:
try:
param_value = self.user_conf_data[param]
except (TypeError, KeyError):
return None
else:
return None
return param_value
......
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