@@ -2410,7 +2410,7 @@ def peekJob(self, jobID, printOutput=False):
2410
2410
2411
2411
#############################################################################
2412
2412
2413
- def pingService (self , system , service , printOutput = False , url = None ):
2413
+ def pingService (self , system = None , service = None , printOutput = False , url = None ):
2414
2414
"""The ping function will attempt to return standard information from a system
2415
2415
service if this is available. If the ping() command is unsuccessful it could
2416
2416
indicate a period of service unavailability.
@@ -2430,8 +2430,7 @@ def pingService(self, system, service, printOutput=False, url=None):
2430
2430
:type url: string
2431
2431
:returns: S_OK,S_ERROR
2432
2432
"""
2433
-
2434
- if not isinstance (system , str ) and isinstance (service , str ) and not isinstance (url , str ):
2433
+ if not (system and service ) and not url :
2435
2434
return self ._errorReport ("Expected string for system and service or a url to ping()" )
2436
2435
result = S_ERROR ()
2437
2436
try :
@@ -2446,9 +2445,14 @@ def pingService(self, system, service, printOutput=False, url=None):
2446
2445
else :
2447
2446
serviceURL = url
2448
2447
client = Client (url = url )
2448
+
2449
+ startTime = time .time ()
2449
2450
result = client .ping ()
2451
+ roudtrip_time = time .time () - startTime
2450
2452
if result ["OK" ]:
2451
2453
result ["Value" ]["service url" ] = serviceURL
2454
+ result ["Value" ]["roundtrip_time" ] = roudtrip_time
2455
+
2452
2456
except Exception as x :
2453
2457
self .log .warn (f"ping for { system } /{ service } failed with exception:\n { str (x )} " )
2454
2458
result ["Message" ] = str (x )
0 commit comments