Hi, since I haven't seen it being mentioned so far: You could also just sanitize the job comment field from any unwanted characters (e.g. newlines) at submit time by filtering them in job_submit.lua. I do that for both job comments and job names (otherwise you can apparently do some pretty wild stuff like creating colored squeue output via ANSI color codes): function filter_specialchars(string, string_desc) string_clean = string:gsub("[^%w_%-%.%+%^%⁰-⁹]", "_") slurm.log_info("%s: Cleaned-up %s: %s.", log_prefix, string_desc, string_clean) return string_clean end This function will replace all characters with underscores except alphanumeric character, '_', '-', '.', '+', '^', and numeric superscripts ('string' parameters is either job_desc.name or job_desc.comment; the other two variables are for logging only: 'string_desc' is either 'job name' or 'job comment' and 'log_prefix' is 'slurm_job_submit'). The superscripts are allowed since our chemistry users sometimes use them for chemical formulae (not quite IUPAC compliant, but subscripts are much more of a hassle to type). Kind regards René Sitt Am 22.09.26 um 22:49 schrieb Adam Novak via slurm-users:
It was recently pointed out to me that `scontrol show job` will include jobs' comments, and those comments seem to be able to contain arbitrary text, including newlines and "=". The comments don't seem to be delimited or escaped in any way within the `scontrol show job` output.
This means I can't actually parse the output of `scontrol show job`, because once a comment starts I can never tell that it has ended. Someone can put a whole valid-looking job record inside their job comment, or something that looks like the tail end of one job record and the beginning of another.
Is there a way to adjust the output format or access that data, as a normal cluster user, through another interface?
To illustrate the problem, I ran:
sbatch --wrap "sleep 10" --comment="$(printf "\n\nJobID=12345\n\n")"
And I found this in my `scontrol show job` output:
JobId=38807436 JobName=wrap UserId=anovak1(30065) GroupId=prismuser(600) MCS_label=N/A Priority=4202 Nice=0 Account=standard QOS=normal JobState=RUNNING Reason=None Dependency=(null) Requeue=1 Restarts=0 BatchFlag=1 Reboot=0 ExitCode=0:0 RunTime=00:00:09 TimeLimit=00:10:00 TimeMin=N/A SubmitTime=2026-09-22T13:47:15 EligibleTime=2026-09-22T13:47:15 AccrueTime=2026-09-22T13:47:15 StartTime=2026-09-22T13:47:17 EndTime=2026-09-22T13:57:17 Deadline=N/A SuspendTime=None SecsPreSuspend=0 LastSchedEval=2026-09-22T13:47:17 Scheduler=Backfill Partition=short AllocNode:Sid=phoenix:1297984 ReqNodeList=(null) ExcNodeList=(null) NodeList=phoenix-06 BatchHost=phoenix-06 NumNodes=1 NumCPUs=1 NumTasks=1 CPUs/Task=1 ReqB:S:C:T=0:0:*:* TRES=cpu=1,mem=4000M,node=1,billing=1 Socks/Node=* NtasksPerN:B:S:C=0:0:*:* CoreSpec=* MinCPUsNode=1 MinMemoryCPU=4000M MinTmpDiskNode=0 Features=(null) DelayBoot=00:00:00 OverSubscribe=OK Contiguous=0 Licenses=(null) Network=(null) Command=(null) WorkDir=/private/home/anovak1/workspace/cwltool Comment=
JobID=12345 StdErr=/private/home/anovak1/workspace/cwltool/slurm-38807436.out StdIn=/dev/null StdOut=/private/home/anovak1/workspace/cwltool/slurm-38807436.out Power=
-- Dipl.-Chem. René Sitt Abteilung Zentrale Systeme - Hochleistungsrechnen Hochschulrechenzentrum (HRZ) Hessisches Kompetenzzentrum für Hochleistungsrechnen (HKHLR) Philipps-Universität Marburg Hans-Meerwein-Straße 6 35032 Marburg Büro: Gebäude H|04, Raum 04A32 T +49 6421 28-23523 E sittr@hrz.uni-marburg.de M @sittr:matrix.uni-marburg.de https://www.uni-marburg.de/de/hrz https://www.hkhlr.de