Could you please let me know if there is a way to detect from within a process whether it is running as an HTCondor job?
I am especially interested in how to do it from python code but a C++ way to do it would be also very helpful.
Example of what I hope to do in python:
if current_process_is_running_as_an_HTCondor_job():
do_action_1()
else:
do_action_2()
How can one implement current_process_is_running_as_an_HTCondor_job() ?
Thank you very much for your help!
HTCondor sets a number of environment variables: https://htcondor.readthedocs.io/en/latest/users-manual/services-for-jobs.html
_CONDOR_SCRATCH_DIR_CONDOR_SLOT_CONDOR_JOB_AD_CONDOR_MACHINE_AD_CONDOR_JOB_IWD_CONDOR_WRAPPER_ERROR_FILEThe existence of any of them would be a good indicator that you are running under Condor.