Skip to content

Commit 0d96998

Browse files
committed
job-exec: use f58 encoding for jobids in log messages
Problem: The job-exec module logs jobids in their decimal representation, which aren't easily identifiable as jobids at first glance and take up more space in most cases. Log jobids as f58 where possible and appropriate in the job-exec module through use of the idf58() convenience function.
1 parent 99e433f commit 0d96998

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

src/modules/job-exec/bulk-exec.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "src/common/libczmqcontainers/czmq_containers.h"
2222
#include "src/common/libutil/aux.h"
23+
#include "src/common/libjob/idf58.h"
2324
#include "bulk-exec.h"
2425

2526
struct exec_cmd {
@@ -491,8 +492,8 @@ void bulk_exec_kill_log_error (flux_future_t *f, flux_jobid_t id)
491492
if (flux_future_get (cf, NULL) < 0) {
492493
uint32_t rank = flux_rpc_get_nodeid (cf);
493494
flux_log_error (h,
494-
"%ju: exec_kill: %s (rank %lu)",
495-
(uintmax_t) id,
495+
"%s: exec_kill: %s (rank %lu)",
496+
idf58 (id),
496497
flux_get_hostbyrank (h, rank),
497498
(unsigned long)rank);
498499
}

src/modules/job-exec/exec.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ static int exec_kill (struct jobinfo *job, int signum)
458458
f = bulk_exec_kill (exec, signum);
459459
if (!f) {
460460
if (errno != ENOENT)
461-
flux_log_error (job->h, "%ju: bulk_exec_kill", job->id);
461+
flux_log_error (job->h, "%s: bulk_exec_kill", idf58 (job->id));
462462
return 0;
463463
}
464464

@@ -469,7 +469,9 @@ static int exec_kill (struct jobinfo *job, int signum)
469469

470470
jobinfo_incref (job);
471471
if (flux_future_then (f, 3., exec_kill_cb, job) < 0) {
472-
flux_log_error (job->h, "%ju: exec_kill: flux_future_then", job->id);
472+
flux_log_error (job->h,
473+
"%s: exec_kill: flux_future_then",
474+
idf58 (job->id));
473475
flux_future_destroy (f);
474476
return -1;
475477
}

src/modules/job-exec/job-exec.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ static void kill_timer_cb (flux_reactor_t *r, flux_watcher_t *w,
383383
idf58 (job->id));
384384
if (!(f = flux_job_kill (job->h, job->id, SIGKILL))) {
385385
flux_log_error (job->h,
386-
"flux_job_kill (%ju, SIGKILL)",
387-
job->id);
386+
"flux_job_kill (%s, SIGKILL)",
387+
idf58 (job->id));
388388
return;
389389
}
390390
/* Open loop */
@@ -429,8 +429,8 @@ static void timelimit_cb (flux_reactor_t *r,
429429
if (jobid_exception (job->h, job->id, job->req, "timeout", 0, 0,
430430
"resource allocation expired") < 0)
431431
flux_log_error (job->h,
432-
"failed to generate timeout exception for %ju",
433-
job->id);
432+
"failed to generate timeout exception for %s",
433+
idf58 (job->id));
434434
(*job->impl->kill) (job, SIGALRM);
435435
flux_watcher_stop (w);
436436
job->exception_in_progress = 1;
@@ -498,8 +498,8 @@ void jobinfo_started (struct jobinfo *job)
498498
if (h && job->req) {
499499
if (jobinfo_set_expiration (job) < 0)
500500
flux_log_error (h,
501-
"failed to set expiration for %ju",
502-
(uintmax_t) job->id);
501+
"failed to set expiration for %s",
502+
idf58 (job->id));
503503
job->running = 1;
504504
if (jobinfo_respond (h, job, "start") < 0)
505505
flux_log_error (h, "jobinfo_started: flux_respond");
@@ -641,8 +641,8 @@ void jobinfo_log_output (struct jobinfo *job,
641641
"rank", buf,
642642
"data", data, len) < 0)
643643
flux_log_error (job->h,
644-
"eventlog_append failed: %ju: message=%s",
645-
(uintmax_t) job->id,
644+
"eventlog_append failed: %s: message=%s",
645+
idf58 (job->id),
646646
data);
647647
}
648648

@@ -1009,8 +1009,8 @@ static void get_rootref_cb (flux_future_t *fprev, void *arg)
10091009
job->userid)))
10101010
flux_log (job->h,
10111011
LOG_DEBUG,
1012-
"checkpoint rootref not found: %ju",
1013-
(uintmax_t)job->id);
1012+
"checkpoint rootref not found: %s",
1013+
idf58 (job->id));
10141014

10151015
/* if rootref not found, still create namespace */
10161016
if (!(f = ns_create_and_link (h, job, 0)))
@@ -1084,8 +1084,8 @@ static void evlog_err (struct eventlogger *ev, void *arg, int err, json_t *e)
10841084
struct jobinfo *job = arg;
10851085
char *s = json_dumps (e, JSON_COMPACT);
10861086
flux_log_error (job->h,
1087-
"eventlog error: job=%ju: entry=%s",
1088-
(uintmax_t) job->id,
1087+
"eventlog error: %s: entry=%s",
1088+
idf58 (job->id),
10891089
s);
10901090
free (s);
10911091
}
@@ -1151,8 +1151,8 @@ static int job_start (struct job_exec_ctx *ctx, const flux_msg_t *msg)
11511151
job->ev = eventlogger_create (job->h, 0.01, &ev_ops, job);
11521152
if (!job->ev || eventlogger_setns (job->ev, job->ns) < 0) {
11531153
flux_log_error (job->h,
1154-
"eventlogger_create/setns for job %ju failed",
1155-
(uintmax_t) job->id);
1154+
"eventlogger_create/setns for job %s failed",
1155+
idf58 (job->id));
11561156
jobinfo_decref (job);
11571157
return -1;
11581158
}

0 commit comments

Comments
 (0)