Skip to content
Snippets Groups Projects
Commit 5be355e7 authored by Moe Jette's avatar Moe Jette
Browse files

Job info dump (in api and used by scontrol) now prints user name in

addition to the user id (used to just print user id).
parent e1e4fb91
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#endif #endif
#include <errno.h> #include <errno.h>
#include <pwd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
...@@ -72,9 +73,15 @@ slurm_print_job_info ( FILE* out, job_info_t * job_ptr ) ...@@ -72,9 +73,15 @@ slurm_print_job_info ( FILE* out, job_info_t * job_ptr )
{ {
int j; int j;
char time_str[16]; char time_str[16];
struct passwd *user_info = NULL;
fprintf ( out, "JobId=%u UserId=%u ", fprintf ( out, "JobId=%u ", job_ptr->job_id);
job_ptr->job_id, job_ptr->user_id); user_info = getpwuid((uid_t) job_ptr->user_id);
if (user_info && user_info->pw_name[0])
fprintf ( out, "UserId=%s(%u) ",
user_info->pw_name, job_ptr->user_id);
else
fprintf ( out, "UserId=(%u) ", job_ptr->user_id);
fprintf ( out, "Name=%s JobState=%s\n", fprintf ( out, "Name=%s JobState=%s\n",
job_ptr->name, job_state_string(job_ptr->job_state)); job_ptr->name, job_state_string(job_ptr->job_state));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment