Skip to content

Commit 66f4685

Browse files
committed
shell: return correct values in flux_shell_get_rank_info(3)
Problem: The broker rank and resource counts are incorrect in the rank info object returned by flux_shell_get_rank_info(3). Update the generation of the rank info object to return the correct values.
1 parent 51823b8 commit 66f4685

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/shell/shell.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ static json_t *flux_shell_get_rank_info_object (flux_shell_t *shell, int rank)
530530
char key [128];
531531
char *taskids = NULL;
532532
struct taskmap *map;
533+
struct rcalc_rankinfo rankinfo;
533534

534535
if (!shell->info)
535536
return NULL;
@@ -551,13 +552,16 @@ static json_t *flux_shell_get_rank_info_object (flux_shell_t *shell, int rank)
551552
if (!(taskids = get_rank_task_idset (map, rank)))
552553
return NULL;
553554

555+
if (rcalc_get_nth (shell->info->rcalc, rank, &rankinfo) < 0)
556+
return NULL;
557+
554558
o = json_pack_ex (&error, 0, "{ s:i s:i s:s s:{s:s s:s?}}",
555-
"broker_rank", rank,
559+
"broker_rank", rankinfo.rank,
556560
"ntasks", taskmap_ntasks (map, rank),
557561
"taskids", taskids,
558562
"resources",
559-
"cores", shell->info->rankinfo.cores,
560-
"gpus", shell->info->rankinfo.gpus);
563+
"cores", rankinfo.cores,
564+
"gpus", rankinfo.gpus);
561565
free (taskids);
562566

563567
if (o == NULL)

0 commit comments

Comments
 (0)