---
name: "slurm_suspend"
section: "3"
platform: "linux"
package: "libslurm-dev"
version: "20.11.7+really20.11.4-2+deb11u1"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/slurm_resume"
---

# slurm\_suspend(3)

Slurm suspend, resume and requeue functions

Part of [slurm\_resume(3)](/slurm_resume/3.md).

## NAME

slurm\_suspend, slurm\_suspend2, slurm\_resume, slurm\_resume2, slurm\_requeue, slurm\_requeue2, slurm\_free\_job\_array\_resp  - Slurm suspend, resume and requeue functions

## SYNTAX

\#include \<slurm/slurm.h\>

int **slurm\_suspend** (\
\
 	uint32\_t *job\_id*\
 );

int **slurm\_suspend2** (\
\
         char \* *job\_id\_str*,\
         job\_array\_resp\_msg\_t \*\*resp\
 );

int **slurm\_resume** (\
\
 	uint32\_t *job\_id*\
 );

int **slurm\_resume2** (\
\
         char \* *job\_id\_str*,\
         job\_array\_resp\_msg\_t \*\*resp\
 );

int **slurm\_requeue** (\
\
         uint32\_t *job\_id*,\
         uint32\_t *state*\
 );

int **slurm\_requeue2** (\
\
 	char \* *job\_id\_str*,\
         uint32\_t *state*,\
         job\_array\_resp\_msg\_t \*\*resp\
 );

void **slurm\_free\_job\_array\_resp** (\
\
         job\_array\_resp\_msg\_t \*resp\
 );

## ARGUMENTS

- *job\_id*

  Slurm job ID to perform the operation upon in numeric form.

- *job\_id\_str*

  Slurm job ID to perform the operation upon in string form. This is intended to be a single job. For job arrays, the job ID may be followed by an underscore and task ID values. For example: "123", "123\_4", "123\_4-6", "123\_4,6,8", and "123\_4-6,18". The functions using this option are designed primarily for use with job arrays so that separate error codes can be returned for each task of the job array.

- *resp*

  Array of error codes and job IDs. Always use the **slurm\_free\_job\_array\_resp** function to release the memory allocated to hold the error codes.

- *state*

  The state in which the job should be requeued valid values are:

  - *"0"*

    If the job has to be requeued in JOB\_PENDING state.

  - *"JOB\_SPECIAL\_EXIT"*

    If the job has to be requeued in the special exit state and be held.

  - *"JOB\_REQUEUE\_HOLD"*

    If the job has to be requeued in "JOB\_PENDING" and held state.

## DESCRIPTION

- **slurm\_suspend**

  Suspend the specified job.

- **slurm\_suspend2**

  Suspend the specified job or job array. Call the function **slurm\_free\_job\_array\_resp** to release memory allocated for the response array.

- **slurm\_resume**

  Resume execution of a previously suspended job.

- **slurm\_resume2**

  Resume execution of a previously suspended job or job array. Call the function **slurm\_free\_job\_array\_resp** to release memory allocated for the response array.

- **slurm\_requeue**

  Requeue a running or pending Slurm batch job. The job script will be restarted from its beginning.

- **slurm\_requeue2**

  Requeue a running or pending Slurm batch job or job array. The job script will be restarted from its beginning. Call the function **slurm\_free\_job\_array\_resp** to release memory allocated for the response array.

- **slurm\_free\_job\_array\_resp**

  Release memory allocated by the **slurm\_suspend2**, **slurm\_resume2**, **slurm\_requeue2**, and **slurm\_update\_job2** functions.

## RETURN VALUE

Zero is returned upon success. On error, -1 is returned, and the Slurm error code is set appropriately. Functions **slurm\_suspend2**, **slurm\_resume2**, and **slurm\_requeue2** return zero if the *resp* array is filled, in which the that array should be examined to determine the error codes for individual tasks of a job array. Then call the function **slurm\_free\_job\_array\_resp** to release memory allocated for the response array.

## ERRORS

**ESLURM\_DISABLED** the operation is currently disabled (e.g. attempt to suspend a job that is not running, resume a job that is not currently suspended, or requeue a job on which the operation has been disabled).

**ESLURM\_INVALID\_JOB\_ID** the requested job id does not exist.

**ESLURM\_ACCESS\_DENIED** the requesting user lacks authorization for the requested action (e.g. not user root or SlurmUser).

**ESLURM\_JOB\_PENDING** the requested job is still pending.

**ESLURM\_ALREADY\_DONE** the requested job has already completed.

**ESLURM\_NOT\_SUPPORTED** the requested operation is not supported on this system.

## NOTE

These functions are included in the libslurm library, which must be linked to your process for use (e.g. "cc -lslurm myprog.c").

## COPYING

Portions copyright (C) 2014 SchedMD LLC. Portions copyright (C) 2005-2006 The Regents of the University of California. Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). CODE-OCEC-09-009. All rights reserved.

This file is part of Slurm, a resource management program. For details, see \<https://slurm.schedmd.com/\>.

Slurm is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Slurm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

## SEE ALSO

[**scontrol**(1)](/scontrol/1.md)
