From 91f65b977244496af89e5f039dd337b90dd32cfc Mon Sep 17 00:00:00 2001 From: Robert Brunner Date: Tue, 19 Jan 2021 03:01:48 -0600 Subject: libyogrt: add lsf scheduler support, create yogrt.conf file (#19960) Tell the libyogrt installer to create a yogrt.conf file, specifying whatever scheduler was specified in the scheduler=XXX parameter. --- .../repos/builtin/packages/libyogrt/package.py | 39 +++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/libyogrt/package.py b/var/spack/repos/builtin/packages/libyogrt/package.py index 7d7c2c74ca..38138aee3a 100644 --- a/var/spack/repos/builtin/packages/libyogrt/package.py +++ b/var/spack/repos/builtin/packages/libyogrt/package.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * +import os class Libyogrt(AutotoolsPackage): @@ -33,12 +34,15 @@ class Libyogrt(AutotoolsPackage): variant('scheduler', default='system', description="Select scheduler integration", - values=['system', 'slurm'], multi=False) + values=['system', 'slurm', 'lsf'], multi=False) + depends_on('slurm', when='scheduler=slurm') + depends_on('lsf', when='scheduler=lsf') + + conflicts('scheduler=lsf', when='@:1.22') + variant('static', default='False', description="build static library") - depends_on('slurm', when='scheduler=slurm') - def url_for_version(self, version): if version < Version(1.21): return "https://github.com/LLNL/libyogrt/archive/%s.tar.gz" % version @@ -49,10 +53,37 @@ class Libyogrt(AutotoolsPackage): args = [] sched = self.spec.variants['scheduler'].value - if sched != "system": + if sched == "lsf": + # The LSF library depends on a couple of other libraries, + # and running the build inside of spack does not find + # them, and the user has to add them when they want + # to use -lyogrt. If we explicitly tell it what libraries + # to use, the user does not need to specify them + args.append('--with-lsf') + args.append('LIBS=-llsf -lrt -lnsl') + elif sched != "system": args.append('--with-%s=%s' % (sched, self.spec[sched].prefix)) if '+static' in self.spec: args.append('--enable-static=yes') return args + + @run_after('install') + def create_yogrt_conf(self): + etcpath = os.path.join(prefix, "etc") + + # create subdirectory to hold yogrt.conf file + if not os.path.isdir(etcpath): + mode = 0o755 + os.mkdir(etcpath, mode) + + # if no scheduler is specified, create yogrt conf file + # with backend=none + sched = self.spec.variants['scheduler'].value + if sched == "system": + sched = "none" + + # create conf file to inform libyogrt about job scheduler + with open(os.path.join(etcpath, "yogrt.conf"), "w+") as f: + f.write("backend=%s\n" % sched) -- cgit v1.2.3-70-g09d2