GOCDBClient
GOCDBClient module is a client for the GOC DB, looking for Downtimes.
WARN: the URL of the GOC DB API is hardcoded, and is: https://goc.egi.eu/gocdbpi/public/
- class DIRAC.Core.LCG.GOCDBClient.GOCDBClient
Bases:
object
Class for dealing with GOCDB. Class because of easier use from RSS
- getCurrentDTLinkList()
Get the list of all current DTs’ links
- getHostnameDowntime(hostname, startDate=None, ongoing=False)
- getServiceEndpointInfo(granularity, entity)
Get service endpoint info (in a dictionary)
- Params:
granularity
: a string. Could be in (‘hostname’, ‘sitename’, ‘roc’, ‘country’, ‘service_type’, ‘monitored’)entity
: a string. Actual name of the entity.
- getStatus(granularity, name=None, startDate=None, startingInHours=None, timeout=None)
Return actual GOCDB status of entity in name
- Parameters:
granularity (str) – should be a ValidRes, e.g. “Resource”
name – should be the name(s) of the ValidRes. Could be a list of strings or simply one string. If not given, fetches the complete list.
startDate – if not given, takes only ongoing DownTimes. if given, could be a datetime or a string (“YYYY-MM-DD”), and download DownTimes starting after that date.
startingInHours (int) – optional integer. If given, donwload DownTimes starting in the next given hours (startDate is then useless)
- Returns:
(example)
{'OK': True, 'Value': {'92569G0 lhcbsrm-kit.gridka.de': { 'DESCRIPTION': 'Annual site downtime for various major tasks i...', 'FORMATED_END_DATE': '2014-05-27 15:21', 'FORMATED_START_DATE': '2014-05-26 04:00', 'GOCDB_PORTAL_URL': 'https://goc.egi.eu/portal/index.php?Page_Type=Downtime&id=14051', 'HOSTED_BY': 'FZK-LCG2', 'HOSTNAME': 'lhcbsrm-kit.gridka.de', 'SERVICE_TYPE': 'SRM.nearline', 'SEVERITY': 'OUTAGE'}, '99873G0 srm.pic.esSRM': { 'HOSTED_BY': 'pic', 'ENDPOINT': 'srm.pic.esSRM', 'SEVERITY': 'OUTAGE', 'HOSTNAME': 'srm.pic.es', 'URL': 'srm.pic.es', 'GOCDB_PORTAL_URL': 'https://goc.egi.eu/portal/index.php?Page_Type=Downtime&id=21303', 'FORMATED_START_DATE': '2016-09-14 06:00', 'SERVICE_TYPE': 'SRM', 'FORMATED_END_DATE': '2016-09-14 15:00', 'DESCRIPTION': 'Outage declared due to network and dCache upgrades'} } }