Ticket 20546 - Incorrect expansion of %A for sacct --expand-patterns
Summary: Incorrect expansion of %A for sacct --expand-patterns
Status: OPEN
Alias: None
Product: Slurm
Classification: Unclassified
Component: Accounting (show other tickets)
Version: 24.05.0
Hardware: Linux Linux
: 6 - No support contract
Assignee: Jacob Jenson
QA Contact:
URL:
Depends on:
Blocks:
 
Reported: 2024-07-30 10:36 MDT by Federico Baldassarre
Modified: 2024-07-30 10:36 MDT (History)
0 users

See Also:
Site: -Other-
Alineos Sites: ---
Atos/Eviden Sites: ---
Confidential Site: ---
Coreweave sites: ---
Cray Sites: ---
DS9 clusters: ---
HPCnow Sites: ---
HPE Sites: ---
IBM Sites: ---
NOAA SIte: ---
NoveTech Sites: ---
Nvidia HWinf-CS Sites: ---
OCF Sites: ---
Recursion Pharma Sites: ---
SFW Sites: ---
SNIC sites: ---
Tzag Elita Sites: ---
Linux Distro: ---
Machine Name:
CLE Version:
Version Fixed:
Target Release: ---
DevPrio: ---
Emory-Cloud Sites: ---


Attachments

Note You need to log in before you can comment on or make changes to this ticket.
Description Federico Baldassarre 2024-07-30 10:36:45 MDT
The expansion of %A in sacct --expand-patterns is incorrect for job arrays. It expands to the unique id of the job and not to the array id.

If the job is running, scontrol gives the actual path that the job is writing to.



Example with a job array (JobId=4222747 ArrayJobId=4222555 ArrayTaskId=10):

```
sacct --job 4222555_10 --format=StdOut%200 --expand-patterns
path/to/logs/4222747_10_0_log.out

sacct --job 4222555_10 --json | jq -r '.jobs[0].stdout'
path/to/logs/%A_%a_0_log.out

sacct --job 4222555_10 --json | jq -r '.jobs[0].stdout_expanded'
path/to/logs/4222747_10_0_log.out

scontrol show job 4222555_10 | grep -i stdout
StdOut=path/to/logs/4222555_10_0_log.out
```



Example with a regular job (JobId=4222523):

```
sacct --job 4222523 --format=StdOut%200 --expand-patterns
path/to/logs/4222523_0_log.out

sacct --job 4222523 --json | jq -r '.jobs[0].stdout'
path/to/logs/%j_0_log.out

sacct --job 4222523 --json | jq -r '.jobs[0].stdout_expanded'
path/to/logs/4222523_0_log.out

scontrol show job 4222523 | grep -i stdout
path/to/logs/4222523_0_log.out
```