I have a threaded timer running to disconnect from p4 after a certain amount of time (because perforce will auto timeout in our application and fails to reconnect).  I want to make sure that I do not disconnect if any long action is running (like downloading a large file).  Are there any p4 commands that can check if there are currently commands being run.
Thanks
You can run p4 monitor show to check from the server side if any commands are running.
For your use case, though, it would be more straightforward for your script to simply keep track of its own run() calls, since anything you care about will take place in the context of one of those calls.  It's generally good practice to close your connection once you're done invoking commands with run(), since holding idle connections open can potentially DDoS the server if enough client instances do it.
p4python check if any actions are being run