{"id":9113,"date":"2025-03-17T17:29:57","date_gmt":"2025-03-17T17:29:57","guid":{"rendered":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/?page_id=9113"},"modified":"2026-06-04T13:22:54","modified_gmt":"2026-06-04T12:22:54","slug":"deleting-jobs-slurm","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/batch-slurm\/deleting-jobs-slurm\/","title":{"rendered":"Deleting or Modifying Jobs (Slurm)"},"content":{"rendered":"<h2>Deleting jobs in Slurm<\/h2>\n<p>On occasion it may be necessary to remove a waiting job from the queue, or to stop a running job (and remove it from the queue). This is done using <code>scancel<\/code> . For example<\/p>\n<pre class=\"slurm\">\r\nscancel 18076\r\n         #\r\n         # replace 18076 with <em>your<\/em> job id\r\n\r\n# To delete <strong>all<\/strong> of my jobs (running and pending) <strong>CAUTION!!!<\/strong>\r\nscancel --me\r\n<\/pre>\n<p>You can identify the jobid typing the command <code>squeue<\/code> on its own.<\/p>\n<h3>Deleting Job Array Tasks<\/h3>\n<p>See the information on <a href=\"\/csf3\/batch\/job-arrays-slurm\/#Deleting_Job_Arrays\">Job Arrays (Slurm)<\/a> for how to delete all tasks in the job array or specific tasks.<\/p>\n<h2>Modifying jobs in slurm<\/h2>\n<h3>Running jobs<\/h3>\n<p>Do not attempt to modify running jobs, if you have made a mistake in specifying job resources and the job is already running, &#8220;scancel&#8221; the job, clean up the outputs, correct your sbatch script and resubmit.<\/p>\n<h3>Pending jobs<\/h3>\n<p><code>scontrol<\/code> can be used to modify pending jobs, use this with care as it is possible to put your job into a non-runnable state. <\/p>\n<p>If you are in any doubt about how to edit jobs, use <code>scancel<\/code>, edit your sbatch script and resubmit. AI responses (search and chatbots) do not produce reliable Slurm commands if you do not know what you need to ask for.<\/p>\n<p><strong>Change time limit<\/strong><br \/>\nStart by holding the job you want to change:<\/p>\n<pre>\r\nscontrol hold jobid=1234567\r\n<\/pre>\n<p>this will prevent the job from starting while you make changes. Then review the details of the job you want to change:<\/p>\n<pre>\r\nscontrol show jobid=1234567\r\n<\/pre>\n<p>Then change the time limit:<\/p>\n<pre>scontrol update jobid=1234567 TimeLimit=4-0<\/pre>\n<p>where the jobid is the id of your job and the TimeLimit can be set to any valid duration. If you get &#8216;permission denied&#8217; then you have asked for a duration that is not permitted by the partition.<\/p>\n<p>Check the changes you have made:<\/p>\n<pre>\r\nscontrol show jobid=1234567\r\n<\/pre>\n<p>Once you are happy, release the job:<\/p>\n<pre>\r\nscontrol release jobid=1234567\r\n<\/pre>\n<p><strong>Change CPU resources<\/strong><\/p>\n<p>Start by holding the job you want to change:<\/p>\n<pre>\r\nscontrol hold jobid=1234567\r\n<\/pre>\n<p>This will prevent the job from starting while you make changes. Then review the details of the job you want to change:<\/p>\n<pre>\r\nscontrol show jobid=1234567\r\n<\/pre>\n<p>The relevant parameters are:<\/p>\n<pre>\r\nNumNodes=1 NumCPUs=XX NumTasks=YY CPUs\/Task=ZZ\r\n<\/pre>\n<p>whatever you change, NumCPUs must = NumTasks * CPUs\/Task; However, CPUs\/Task cannot be changed. For example, with:<\/p>\n<pre>\r\nNumNodes=1 NumCPUs=22 NumTasks=22 CPUs\/Task=1\r\n<\/pre>\n<p>a valid change is:<\/p>\n<pre>\r\nscontrol update jobid=1234567 NumCPUs=20 NumTasks=20\r\n<\/pre>\n<p>but with:<\/p>\n<pre>\r\nNumNodes=1 NumCPUs=44 NumTasks=22 CPUs\/Task=2\r\n<\/pre>\n<p>examples of valid changes are:<\/p>\n<pre>\r\nscontrol update jobid=1234567 NumCPUs=40 NumTasks=20         # Because CPUs\/Task is fixed at 2\r\nscontrol update jobid=1234567 NumCPUs=20 NumTasks=10         # Because CPUs\/Task is fixed at 2\r\n<\/pre>\n<p>Check the changes you have made:<\/p>\n<pre>\r\nscontrol show jobid=1234567\r\n<\/pre>\n<p>Once you are happy, release the job:<\/p>\n<pre>\r\nscontrol release jobid=1234567\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Deleting jobs in Slurm On occasion it may be necessary to remove a waiting job from the queue, or to stop a running job (and remove it from the queue). This is done using scancel . For example scancel 18076 # # replace 18076 with your job id # To delete all of my jobs (running and pending) CAUTION!!! scancel &#8211;me You can identify the jobid typing the command squeue on its own. Deleting Job.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/batch-slurm\/deleting-jobs-slurm\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":9105,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-9113","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/9113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/comments?post=9113"}],"version-history":[{"count":12,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/9113\/revisions"}],"predecessor-version":[{"id":12340,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/9113\/revisions\/12340"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/9105"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/media?parent=9113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}