163 | | |
164 | | |
| 163 | === Cancel Jobs === |
| 164 | Look at '''slurmscrit2''', |
| 165 | {{{ |
| 166 | [fuji@cypress1 SerialJob]$ cat slurmscript2 |
| 167 | #!/bin/bash |
| 168 | #SBATCH --qos=workshop # Quality of Service |
| 169 | #SBATCH --partition=workshop # partition |
| 170 | #SBATCH --job-name=pythonLong # Job Name |
| 171 | #SBATCH --time=00:01:00 # WallTime |
| 172 | #SBATCH --nodes=1 # Number of Nodes |
| 173 | #SBATCH --ntasks-per-node=1 # Number of tasks (MPI processes) |
| 174 | #SBATCH --cpus-per-task=1 # Number of threads per task (OMP threads) |
| 175 | |
| 176 | module load anaconda |
| 177 | python hello.py |
| 178 | |
| 179 | sleep 3600 |
| 180 | }}} |
| 181 | |
| 182 | The major difference from '''slurmscrit1''' is the last line '''sleep 3600''', which makes Bash to wait for 3600 seconds at this point. |
| 183 | |
| 184 | Submit the job, |
| 185 | {{{ |
| 186 | [fuji@cypress1 SerialJob]$ sbatch slurmscript2 |
| 187 | Submitted batch job 773951 |
| 188 | }}} |
| 189 | |
| 190 | The '''squeue''' command gives you a list of jobs running/queued on Cypress. |
| 191 | The '''squeue''' command also tells us what node our job is being run on. |
| 192 | To single out your own job you can use the "-u" option flag to specify your user name. |
| 193 | |
| 194 | {{{ |
| 195 | [fuji@cypress1 SerialJob]$ squeue -u fuji |
| 196 | JOBID QOS NAME USER ST TIME NO NODELIST(REASON) |
| 197 | 773951 worksh pythonLong fuji R 0:07 1 cypress01-117 |
| 198 | }}} |
| 199 | |
| 200 | To stop the job, |
| 201 | {{{ |
| 202 | [fuji@cypress1 SerialJob]$ scancel 773951 |
| 203 | [fuji@cypress1 SerialJob]$ squeue -u fuji |
| 204 | JOBID QOS NAME USER ST TIME NO NODELIST(REASON) |
| 205 | }}} |
| 206 | |
| 207 | You will see a new file again. |
| 208 | {{{ |
| 209 | [fuji@cypress1 SerialJob]$ ls |
| 210 | hello.py slurm-773944.out slurm-773951.out slurmscript1 slurmscript2 |
| 211 | }}} |
| 212 | |
| 213 | The new file contains |
| 214 | {{{ |
| 215 | [fuji@cypress1 SerialJob]$ cat slurm-773951.out |
| 216 | Hello, world! |
| 217 | 2018-08-22T13:17:00.965433 |
| 218 | cypress01-117 |
| 219 | slurmstepd: error: *** JOB 773951 CANCELLED AT 2018-08-22T13:17:25 *** |
| 220 | }}} |