Problem

If you try to modify some parameters of a submitted job, you might get an error under certain conditions.

Solution

Some Slurm settings of a job in state PD  (PENDING) can be modified using the command scontrol update.
In order to do that, you should use the same format returned by the Slurm scontrol show  command.

For instance, you can change the job name and the wall time of a pending job as in the example below:

scontrol update JobId=2543 Name=newtest TimeLimit=00:10:00

The command above will set a new job name and time limit to the pending job with JobId 2543.

Please note that the command will fail to change the time limit if the job is in state R (RUNNING), but it will still manage to update the job name.