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!
CodePudding user response:
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_FILE
The existence of any of them would be a good indicator that you are running under Condor.