I cannot see arcpy function to test if geodatabase is accepting connections. Quick SQL trace tells me that ArcGIS checks it using following SQL statement
SELECT num_prop_value FROM DBNAME.sde.SDE_server_config WHERE prop_name = 'STATUS'
And if the value is 2, it is NOT accepting connections. Value 1 means it is.
Following python code may help.
import arcpy
import os
def is_accepting_connections(sde_conn_nonadmin):
if (os.path.exists(sde_conn_nonadmin) == False):
raise ValueError("Invalid SDE connection file '{}'".format(sde_conn_nonadmin))
try:
arcpy.env.workspace = sde_conn_nonadmin
desc = arcpy.Describe(sde_conn_nonadmin)
if (hasattr(desc, 'workspaceType')):
return True
else:
return False
except:
raise