使用 slurm 脚本

使用 slurm 脚本

我是 Ubuntu 20.04 LST 的新手用户。下面是用于 slurm 的 python 脚本,我一直尝试使用它,但失败了。

三个变量都有问题。

#! /bin/bash

ROOT_UID=0

#Run as root, of course. (this might not be necessary, because we have to run the script somehow with root anyway)
if [ "$UID" -ne "$ROOT_UID" ]
then
     echo "Must be root to run this script"
     exit "$E_NOTROOT"
fi

#test, arguments are down there for slurm.
if [ $# -eq 3 ]; then
slurmname=$1
accountname=$2
maxjobsnumbers=$3
          
       # to create just a slurm user on the default account
       sacctmgr create user -s "$slurmname"  "$accountname"
           
       # to setup job limit for a slurm user
       sacctmgr -i modify user "$slurmname" set "$maxjobsnumbers"
       
       # to show job limit
       sacctmgr show ass

       echo ""
       echo "The user has been setuped on Slurm"
       sacctmgr show user "$slurmname"
else
       echo  " this program needs 3 arguments you have given $# "
       echo  " you have to call the script $0 slurmname, accountname and maxjobsnumbers "
fi
exit 0

当我使用命令运行.sh 文件时,输出是;

tonny(slurmname)

音乐(账户名)

1(最大作业数)

 root@hn:/home/sysadmin1/Desktop# ./adduser_slurm.sh tonny music 1

 Need name of account to add user to.
 Nothing new added.
 Bad format on 1: End your option with an '=' sign
 Cluster    Account       User  Partition     Share   Priority 
 GrpJobs       GrpTRES GrpSubmit     GrpWall   GrpTRESMins 
 MaxJobs       MaxTRES MaxTRESPerNode MaxSubmit     MaxWall   
 MaxTRESMins                  QOS   Def QOS GrpTRESRunMin 
 ---------- ---------- ---------- ---------- --------- --------- 
 - ------- ------------- --------- ----------- ------------- ---- 
 --- ------------- -------------- --------- ----------- --------- 
 ---- -------------------- --------- ------------- 
 cluster       root                               1                                                                                                                                                             
 normal                         
 cluster       root       root                    1                                                                                                                                                             
 normal                         
 cluster      music                               1                                                                                                                                                             
 normal                         
 cluster      music       cta1                    1                                                                            
 3                                                                                
 normal                         
 cluster      music       cta2                    1                                                                            
 2                                                                                
 normal                         

  The user has been setuped on Slurm
  User   Def Acct     Admin 
  ---------- ---------- --------- 



                                                      

尚未添加新用户。

我的意思是,我如何创建新用户,如何在 slurm 帐户上添加新用户,以及如何使用此脚本在 slurm 上为新用户设置 maxjob 限制?

相关内容