Skip to content

Parsing Error for `sacct` Node Shorthand

The sacct command reports the number of nodes for jobs running on node counts that are multiples of 1024 using shorthand notation, such as 1K for 1024, 2K for 2048, and so on. This format causes the parsing of these values as integers to fail.

For example:

$ cin_seff -j 11883099
Traceback (most recent call last):
  File "/leonardo/prod/opt/tools/cintools/1.0/none/bin/cin_seff", line 599, in <module>
    main()
  File "/leonardo/prod/opt/tools/cintools/1.0/none/bin/cin_seff", line 539, in main
    data["AllocNodes"] = int(main_info[11])
ValueError: invalid literal for int() with base 10: '1K'

where the output of sacct is the following:

$ sacct -j 11883099 --format JobID,User,Account,State,AllocCPUS,REQMEM,TotalCPU,ElapsedRaw,MaxRSS,ExitCode,NodeList,AllocNodes,Elapsed,QOS
JobID             User    Account      State  AllocCPUS     ReqMem   TotalCPU ElapsedRaw     MaxRSS ExitCode        NodeList AllocNodes    Elapsed        QOS 
------------ --------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -------- --------------- ---------- ---------- ---------- 
11883099      nwedi000 deste_330+    RUNNING      32768    492800G   00:00:00       2151                 0:0 lrdn[0006-0007+         1K   00:35:51 qos_speci+ 
11883099.ba+           deste_330+    RUNNING         32              00:00:00       2151                 0:0        lrdn0006          1   00:35:51            
11883099.ex+           deste_330+    RUNNING      32768              00:00:00       2151                 0:0 lrdn[0006-0007+         1K   00:35:51            
11883099.0             deste_330+    RUNNING      32768              00:00:00       2135                 0:0 lrdn[0006-0007+         1K   00:35:35