I am implementing Esri's python script to batch reconcile and post versions of our Enterprise Geodatabase running on SQL Server. The script is found here and would be run from our server using Task Scheduler. Instead of automatically disconnecting users from the database after a set period, we would like to check whether a user has an open edit session going. If there is an active edit session, instead of disconnecting the user and losing any edits they may have made, the script would not be run.
Currently, the script set to run only if there are no other users connected besides the administrator, i.e. if a Map Document is left open overnight on a Desktop the script won't run. This is a blanket fix and I would prefer that the script still run if the open map document isn’t being actively edited.
Is there a way to check if a user connected to the database is in an edit session?