Commit 8c34e904 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Fix bug: Cluster execution does not work within a virtual environment

parent 708eebeb
......@@ -105,6 +105,11 @@ class Config:
config['install_path'] = pkg_resources.resource_filename('psot', '')
config['helpers_path'] = pkg_resources.resource_filename('psot', 'helpers')
config['repository_paths'] = self.repo_paths
# check if running inside a virtual environment
if 'VIRTUAL_ENV' in os.environ:
config['venv'] = os.environ['VIRTUAL_ENV']
self.merge_modules_in_profiles(config)
return config
......
......@@ -67,6 +67,8 @@ def generate_execution(config, args):
execution['fasta'] = os.path.abspath(args.fasta)
execution['output'] = os.path.abspath(args.output)
execution['install_path'] = config['install_path']
if 'venv' in config:
execution['venv'] = config['venv']
if args.execution_dir:
execution['directory'] = os.path.abspath(args.execution_dir)
else:
......
......@@ -191,6 +191,8 @@ Channel.fromPath(params.fasta).set{fasta}''')
config['executor'] = 'sge'
config['chunks'] = ".splitFasta(by:300, file:'input')"
config['clusterOptions'] = "clusterOptions='-S /bin/bash'"
if 'venv' in execution:
config['clusterOptions'] = config['clusterOptions'] + "\nbeforeScript 'export PS1=; source " + execution['venv'] + "/bin/activate'"
else:
config['executor'] = 'local'
config['chunks'] = ''
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment