集群SGE作业调度系统

2020-08-04  本文已影响0人  生物信息与育种

0. 一些基本概念

关于集群与分布式的区别有一段话总结得很好:集群是个物理形态,分布式是个工作方式。只要是一堆机器,就可以叫集群,他们是不是一起协作着干活,这个谁也不知道;一个程序或系统,只要运行在不同的机器上,就可以叫分布式,C/S架构也可以叫分布式。集群一般是物理集中、统一管理的,而分布式系统则不强调这一点。所以,集群可能运行着一个或多个分布式系统,也可能根本没有运行分布式系统;分布式系统可能运行在一个集群上,也可能运行在不属于一个集群的多台(2台也算多台)机器上。

1. 常见的几种资源管理和调度系统

2. SGE常见指令

2.1 提交任务

qsub参数:

$ qsub -help
SGE 8.1.9
usage: qsub [options]
   [-a date_time]                           request a start time
   [-ac context_list]                       add context variable(s)
   [-Ap fname]                              add a new parallel environment from file
   [-astnode node_shares_list]              add sharetree node(s)
   [-at thread_name]                        add/start qmaster thread
   [-A account_string]                      account string in accounting record
   [-b y[es]|n[o]]                          handle command as binary
   [-binding [env|pe|set] exp|lin|str]      binds job to processor cores
   [-c ckpt_selector]                       define type of checkpointing for job
   [-cwd]                                   use current working directory
   [-C directive_prefix]                    define command prefix for job script
   [-dc simple_context_list]                delete context variable(s)
   [-dul listname_list]                     delete userset list(s) completely
   [-e path_list]                           specify standard error stream path(s)
   [-h]                                     place user hold on job
   [-hard]                                  consider following requests "hard"
   [-he  y[es]|n[o]]                        enable/disable hard error handling
   [-help]                                  print this help
   [-hold_jid job_identifier_list]          define jobnet interdependencies
   [-hold_jid_ad job_identifier_list]       define jobnet array interdependencies
   [-i file_list]                           specify standard input stream file(s)
   [-j y[es]|n[o]]                          merge stdout and stderr stream of job
   [-js job_share]                          share tree or functional job share
   [-jsv jsv_url]                           job submission verification script to be used
   [-l resource_list]                       request the given resources
   [-M mail_list]                           notify these e-mail addresses
   [-m mail_options]                        define mail notification events
   [-masterq wc_queue_list]                 bind master task to queue(s)
   [-mattr obj_nm attr_nm val obj_id_list]  modify an attribute (or element in a sublist) of an object
   [-N name]                                specify job name
   [-notify]                                notify job before killing/suspending it
   [-now y[es]|n[o]]                        start job immediately or not at all
   [-o path_list]                           specify standard output stream path(s)
   [-ot tickets]                            set jobs override tickets
   [-P project_name]                        set jobs project
   [-p priority]                            define jobs relative priority
   [-pe wc_pe_name slot_range]              request slot range for parallel jobs
   [-q wc_queue_list]                       bind job to queue(s)
   [-r y[es]|n[o]]                          define job as (not) restartable
   [-sc context_list]                       set job context (replaces old context)
   [-shell y[es]|n[o]]                      start command with or without wrapping <loginshell> -c
   [-soft]                                  consider following requests as soft
   [-srqs [rqs_list]]                       show resource quota set(s)
   [-sync y[es]|n[o]]                       wait for job to end and return exit code
   [-S path_list]                           command interpreter to be used
   [-t task_id_range]                       create a job-array with these tasks
   [-v variable_list]                       export these environment variables
   [-verify]                                do not submit, just verify
   [-V]                                     export all environment variables
   [-wd working_directory]                  use working_directory
   [-@ file]                                read commandline input from file
   [{command|-} [command_args]]

最常用参数:

- cwd #使用当前工作目录
- binding #将作业绑定到处理器核心
- p #定义工作的相对优先级,-1023 到 1024 , 默认值0
- P #定义项目名称,前提是存在该项目
- q #将作业绑定到队列
- l #请求给定的计算资,如-l arch=solaris64,h_vmem=750M,permas=1

示例qsub -cwd -l vf=2g,p=1 -q queuename.q -P projectname -binding linear:2 test.sh

qsub 
  -cwd 
  -l vf=2g,p=1  #vf内存简写,p线程数简写;
#资源可分开写,可写全称,单位可大小写,如-l virtual_free=2G -l num_proc=1。
#关于资源限制域可通过 qconf -sc命令查看
  -q queueName.q 
  -P ProjectName  
  -binding linear:2  #处理器核心数 linear
test.sh

2.2 查看任务

qstat命令

qstat -j jobid #某个任务详细信息
qstat -u username #某用户的任务
qstat -u \* #所有用户任务
qstat -q all.q -u \*  #查看某个队列下所有任务
qstat -q all.q@node1 -u \*  #查看某个队列的某一节点下所有任务
qstat -f  #查看用户自己在每个节点的任务情况,没啥用

任务的状态:

qw #等待状态
hqw #任务挂起等待中,待依赖的任务完成后执行
Eqw #投递任务出错
r #任务正在运行
s #暂时挂起
dr #节点挂了之后,删除任务就会出现这个状态,只有节点重启之后,任务才会消失

2.3 删除任务

qdel命令

qdel jobid #可同时删除多个,如qdel jobid1 jodid2
qdel -u username #删除某用户所有任务

2.4 挂起/恢复任务

qhold命令:挂起qw的任务

qhold jobid
qhold -u \*

qrls jobid #恢复

qmod命令:挂起running中的任务

qmod -sj jobid
qmod -usj jobid #恢复

如果未提交到SGE系统,直接运行的命令用kill -STOP pid 挂起,用kill -CONT pid恢复。

2.5 更改任务属性

qalter命令修改已提交但正处于暂挂状态的作业的属性
参数和qsub一样。

Ref:https://www.bbsmax.com/A/MAzADlxyd9/

上一篇 下一篇

猜你喜欢

热点阅读