Skip to content

Commit 161fa8a

Browse files
committed
perilog: use idf58() convenience function
Problem: A use of flux_job_id_encode(3) in the perilog builtin jobtap plugin could be replaced by the simpler idf58() convenience function. Repace flux_job_id_encode(3) with idf58() in the perilog jobtap plugin.
1 parent 9e5f5d3 commit 161fa8a

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/modules/job-manager/plugins/perilog.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include <flux/jobtap.h>
5353

5454
#include "src/common/libjob/job_hash.h"
55+
#include "src/common/libjob/idf58.h"
5556
#include "src/common/libczmqcontainers/czmq_containers.h"
5657
#include "ccan/str/str.h"
5758

@@ -269,7 +270,6 @@ static int run_command (flux_plugin_t *p,
269270
.on_stderr = io_cb
270271
};
271272
char path[PATH_MAX + 1];
272-
char jobid[128];
273273

274274
if (flux_plugin_arg_unpack (args,
275275
FLUX_PLUGIN_ARG_IN,
@@ -280,13 +280,8 @@ static int run_command (flux_plugin_t *p,
280280
return -1;
281281
}
282282

283-
if (flux_job_id_encode (id, "f58", jobid, sizeof (jobid)) < 0) {
284-
flux_log_error (h, "flux_job_id_encode");
285-
return -1;
286-
}
287-
288283
if (flux_cmd_setcwd (cmd, getcwd (path, sizeof (path))) < 0
289-
|| flux_cmd_setenvf (cmd, 1, "FLUX_JOB_ID", "%s", jobid) < 0
284+
|| flux_cmd_setenvf (cmd, 1, "FLUX_JOB_ID", "%s", idf58 (id)) < 0
290285
|| flux_cmd_setenvf (cmd, 1, "FLUX_JOB_USERID", "%u", userid) < 0) {
291286
flux_log_error (h, "%s: flux_cmd_create", prolog ? "prolog" : "epilog");
292287
return -1;

0 commit comments

Comments
 (0)