我对 LSF 平台有疑问,我无法理解。
出于脚本编写原因,我需要使用 perl 脚本检查“bjobs”(和其他 b***)正在运行/待处理的作业。
由于某种原因它不起作用,我能够查看以下错误消息:
lsb_init: Failed in an LSF library call: Unable to open file lsf.conf
谷歌和手册中的一些研究没有给出什么好的结果,我做了一些测试。
我的帐户(最大)是 LSF 管理员。 Root 也是 LSF 管理员。
所以我切换到 root,并尝试启动 bjobs,但使用“sudo –u max”达到最大。请看一下这些命令:
hn[~]=> whoami
max
hn[~]=> bjobs
No unfinished job found
hn[~]=> su
Password:
[root@hn max]# whoami
root
[root@hn max]# sudo -u max whoami
max
[root@hn max]# bjobs
No unfinished job found
[root@hn max]# sudo -u max bjobs
lsb_init: Failed in an LSF library call: Unable to open file lsf.conf
我该如何纠正这个问题?
默认情况下,LSF 将在 /etc 中查找 lsf.conf。如果不存在,那么它将在环境变量 LSF_ENVDIR 中的目录中查找。
sudo 可能正在重置您的环境。尝试
sudo -i
或放置
Defaults !env_reset
在你的 sudoers 文件中。
你也可以尝试这样的事情
sudo -u max LSF_ENVDIR=$LSF_ENVDIR LSF_SERVERDIR=$LSF_SERVERDIR bjobs
对于任何围绕 SSH 编写脚本的人,必须在命令行上显式设置上述两个变量,如下所示:
ssh [email protected] 'export LSF_ENVDIR=/path/to/lsf/envdir; export LSF_SERVERDIR=/path/to/lsf/serverdir; bsub ...'
或者在文件
~/.ssh/environment
文件中(前提是sshd配置了PermitUserEnvironment yes
)。
测试环境:IBM Spectrum LSF 10.1.0.0 build 476021,2017 年 11 月 20 日,“Red Hat Enterprise Linux Server 7.9 (Maipo)”。先执行以下命令:
For csh or tcsh:
source /lsf_installed_dir/path_to/cshrc.lsf
For sh, ksh, or bash:
. /lsf_installed_dir/path_to/profile.lsf
然后执行bjobs命令,例如bjobs -V。错误消息类似于,
lsb_init: initenv_:fopen(/etc/lsf.conf) failed, No such file or directory.
lsb_init: Failed in an LSF library call: Unable to open file lsf.conf
不再显示。