Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
305 views
in Technique[技术] by (71.8m points)

python - Subprocess check_output ssh env not loaded

I want to run a python script on a remote machine, this Python script requires a library to be loaded to run, I pass this LD_PRELOAD variable but it has no effect. What is the most python way to do this?

subprocess.check_output(['ssh', '<SERVER>',' python <SCRIPT> ' , ' > test.log ' , ' & echo -ne $! '], env={'LD_PRELOAD': <LD_PRELOAD_PATH>]})

With check_output I desire to launch the script on the remote machine as a background process while returning the pid to the host machine. Please note I do not want to block on the host machine.

On the remote machine I see following error

INTEL MKL ERROR: /opt/intel/mkl/lib/intel64/libmkl_avx512.so: undefined symbol: mkl_sparse_optimize_bsr_trsm_i8. 
Intel MKL FATAL ERROR: Cannot load libmkl_avx512.so or libmkl_def.so.

Which happens when the library is not loaded. It works fine when I directly launch the script on the remote machine because the env variables(LD_PRELOAD) are sourced from my bashrc.

Thanks

question from:https://stackoverflow.com/questions/65884137/subprocess-check-output-ssh-env-not-loaded

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...