The command "scontrol show jobs jobid" will show the nodes. And then
then command "ssh nodes scontrol listpids jobid" wiil show the pids.

But this is a little complex. Is there more simple command, like LSF bjobs,
show the nodes and the pids.
And how to parse the nodelist like "cn[11033,11069],gn[1103-1120]" ?


------------------ Original ------------------
From:  "Ole Holm Nielsen";<[email protected]>;
Date:  Thu, May 11, 2017 10:20 PM
To:  "slurm-dev"<[email protected]>; 

Subject:  [slurm-dev] Re: How to get pids of a job




I have written a small tool to display the user processes in a job:
   https://ftp.fysik.dtu.dk/Slurm/sshjob

An example output is:

# sshjob  57811
Nodelist for job-id 57811: a128
Node usage: NumNodes=1 NumCPUs=8 NumTasks=8 CPUs/Task=1 ReqB:S:C:T=0:0:*:*
----------------
a128
----------------
   PID S USER      STARTED NLWP     TIME %CPU   RSS COMMAND
18560 S userNN     May 10    1 00:00:00  0.0  1584 /bin/bash 
/var/spool/slurmd/job57811/slurm_script
18580 S userNN     May 10    1 00:00:00  0.0 22792 python vasp.py
18585 S userNN     May 10    1 00:00:00  0.0  1468 sh -c mpiexec 
/home/niflheim/nirama/vasp.5.4.1_sy
18586 S userNN     May 10    5 00:00:01  0.0  7148 mpiexec 
/home/niflheim/nirama/vasp.5.4.1_sylg/vas
18592 R userNN     May 10    3 1-06:45:34 99.5 1917736 
/home/niflheim/nirama/vasp.5.4.1_sylg/vasp_VT
18594 R userNN     May 10    3 1-06:51:23 99.8 1927368 
/home/niflheim/nirama/vasp.5.4.1_sylg/vasp_VT
18595 R userNN     May 10    3 1-06:51:36 99.8 1918248 
/home/niflheim/nirama/vasp.5.4.1_sylg/vasp_VT
18596 R userNN     May 10    3 1-06:51:22 99.8 1916808 
/home/niflheim/nirama/vasp.5.4.1_sylg/vasp_VT
18597 R userNN     May 10    3 1-06:51:32 99.8 1913816 
/home/niflheim/nirama/vasp.5.4.1_sylg/vasp_VT
18598 R userNN     May 10    3 1-06:51:22 99.8 1920048 
/home/niflheim/nirama/vasp.5.4.1_sylg/vasp_VT
18599 R userNN     May 10    3 1-06:51:32 99.8 1917112 
/home/niflheim/nirama/vasp.5.4.1_sylg/vasp_VT
18600 R userNN     May 10    3 1-06:51:23 99.8 1916796 
/home/niflheim/nirama/vasp.5.4.1_sylg/vasp_VT


The PDSH tool is required, see some advice in:
https://wiki.fysik.dtu.dk/niflheim/SLURM#pdsh-parallel-distributed-shell

A similar tool displays user processes on a specified node:
   https://ftp.fysik.dtu.dk/Slurm/sshps

I hope this helps.

/Ole


On 05/11/2017 04:01 PM, John Hearns wrote:
> A good tool to us on the nodes when you have the list of nodes is 'pgrep'
> https://linux.die.net/man/1/pgrep
> 
> 
> 
> On 11 May 2017 at 15:44, Jason Bacon <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> 
> 
>     Parse the node names from squeue output (-o can help if you want to
>     automate this) and then run ps or top on those nodes.
> 
>     Cheers,
> 
>          JB
> 
>     On 05/11/17 04:07, GHui wrote:
> 
>         How to get pids of a job
> 
>         I want to get a job's pids on nodes. How could I do that?
> 
>         --GHui

Reply via email to