1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
12 gatk2_install_path = None
15 global gatk2_install_path
16 if gatk2_install_path:
17 return gatk2_install_path
18 gatk2_install_path = arvados.util.tarball_extract(
19 tarball = arvados.current_job()['script_parameters']['gatk_tbz'],
21 return gatk2_install_path
24 taskspernode = int(os.environ.get('CRUNCH_NODE_SLOTS', '1'))
25 with open('/proc/meminfo', 'r') as f:
26 ram = int(re.search(r'MemTotal:\s*(\d+)', f.read()).group(1)) / 1024
28 ram = ram / taskspernode
29 return max(ram-700, 500)
31 def cpus_on_this_node():
32 with open('/proc/cpuinfo', 'r') as cpuinfo:
33 return max(int(os.environ.get('SLURM_CPUS_ON_NODE', 1)),
34 len(re.findall(r'^processor\s*:\s*\d',
39 return max(1, (cpus_on_this_node()
40 / int(os.environ.get('CRUNCH_NODE_SLOTS', 1))))
43 kwargs.setdefault('cwd', arvados.current_task().tmpdir)
44 kwargs.setdefault('stdout', sys.stderr)
46 '-Xmx%dm' % memory_limit(),
47 '-Djava.io.tmpdir=' + arvados.current_task().tmpdir,
48 '-jar', os.path.join(install_path(), 'GenomeAnalysisTK.jar')]
49 execargs += [str(arg) for arg in kwargs.pop('args', [])]
50 sys.stderr.write("%s.run: exec %s\n" % (__name__, str(execargs)))
51 return arvados.util.run_command(execargs, **kwargs)