Coverage for python/lsst/ctrl/bps/ping.py: 67%
9 statements
« prev ^ index » next coverage.py v6.5.0, created at 2022-10-27 02:09 -0700
« prev ^ index » next coverage.py v6.5.0, created at 2022-10-27 02:09 -0700
1# This file is part of ctrl_bps.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (https://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <https://www.gnu.org/licenses/>.
22"""Supporting functions for pinging WMS service.
23"""
25__all__ = ["ping"]
27import logging
29from lsst.utils import doImport
31_LOG = logging.getLogger(__name__)
34def ping(wms_service, pass_thru=None):
35 """Checks whether WMS services are up, reachable, and any authentication,
36 if needed, succeeds.
38 The services to be checked are those needed for submit, report, cancel,
39 restart, but ping cannot guarantee whether jobs would actually run
40 successfully.
42 Parameters
43 ----------
44 wms_service : `str`
45 Name of the class.
46 pass_thru : `str`
47 A string to pass directly to the WMS service class.
49 Returns
50 -------
51 status : `int`
52 Services are available (0) or problems (not 0)
53 message : `str`
54 Any message from WMS (e.g., error details).
55 """
56 wms_service_class = doImport(wms_service)
57 wms_service = wms_service_class({})
59 return wms_service.ping(pass_thru)