Coverage for python/lsst/ctrl/execute/condorInfoConfig.py: 62%
22 statements
« prev ^ index » next coverage.py v7.5.0, created at 2024-05-02 11:26 +0000
« prev ^ index » next coverage.py v7.5.0, created at 2024-05-02 11:26 +0000
1#!/usr/bin/env python
3#
4# LSST Data Management System
5# Copyright 2008-2016 LSST Corporation.
6#
7# This product includes software developed by the
8# LSST Project (http://www.lsst.org/).
9#
10# This program is free software: you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the LSST License Statement and
21# the GNU General Public License along with this program. If not,
22# see <http://www.lsstcorp.org/LegalNotices/>.
23#
25import lsst.pex.config as pexConfig
26from lsst.ctrl.execute import envString
29class FakeTypeMap(dict):
30 def __init__(self, configClass):
31 self.configClass = configClass
33 def __getitem__(self, k):
34 return self.setdefault(k, self.configClass)
37class UserInfoConfig(pexConfig.Config):
38 """User information"""
40 name = pexConfig.Field(doc="user login name", dtype=str, default=None)
41 home = pexConfig.Field(doc="user home directory", dtype=str, default=None)
42 scratch = pexConfig.Field(doc="user scratch directory", dtype=str, default=None)
45class UserConfig(pexConfig.Config):
46 """User specific information"""
48 user = pexConfig.ConfigField(doc="user", dtype=UserInfoConfig)
51class CondorInfoConfig(pexConfig.Config):
52 """A pex_config file describing the platform specific information about
53 remote user logins.
54 """
56 platform = pexConfig.ConfigChoiceField("platform info", FakeTypeMap(UserConfig))
59if __name__ == "__main__": 59 ↛ 60line 59 didn't jump to line 60, because the condition on line 59 was never true
60 config = CondorInfoConfig()
61 filename = "$HOME/.lsst/condor-info.py"
62 filename = envString.resolve(filename)
63 config.load(filename)
65 for i in config.platform:
66 print(i)