## Demonstration of ping()¶

This notebook will demonstrate using the ping() method to determine if an HTCondor service, such as the Collector and Schedd, are alive and responding.

First we import the htcondor module and instantiate a Collector() object.

In [1]:
import htcondor
print( htcondor.version() )   # display version of HTCondor used
col = htcondor.Collector()

$CondorVersion: 8.7.9 May 2 2018 PRE-RELEASE-UWCS$


Next, we get the address for the collector and send it a ping(). The ping() method will throw an expcetion on failure. Then we do the same for the schedd.

In [2]:
try:
print('Collector is responsive')
except:
print('Collector is NOT responding')

Collector is responsive

In [3]:
try:
print('Schedd is responsive')
except:
print('Schedd is NOT responding')

Schedd is responsive


To demonstrate things work as expected when a service is down, the below will send a command to the condor_master telling it to shutdown the schedd. WARNING!! This will shutdown the schedd on the local machine, don't do this on a production setup!!

In [4]:
master_ad = col.locate(htcondor.DaemonTypes.Master)
htcondor.DaemonCommands.DaemonOff,
"SCHEDD")
print('Sent command to shut down the schedd')

Sent command to shut down the schedd

In [5]:
try:

Schedd is NOT responding