Skip to content

Commit

Permalink
flux-shutdown: add --gc, --dump=PATH options
Browse files Browse the repository at this point in the history
Problem: a system instance that runs flux-dump(1) from rc3
might get killed by systemd TimeoutStopSec.

Have flux-shutdown(1) arrange for the dump.  If the instance is
being shut down by this method, then systemctl stop is not being run,
so TimeoutStopSec does not apply.
  • Loading branch information
garlick committed Apr 26, 2022
1 parent 53a7060 commit 0e97b7c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/cmd/builtin/shutdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ static int subcmd (optparse_t *p, int ac, char *av[])
if (optparse_hasopt (p, "background"))
flags &= ~FLUX_RPC_STREAMING;

if (optparse_hasopt (p, "gc") || optparse_hasopt (p, "dump")) {
const char *val = optparse_get_str (p, "dump", "auto");

if (flux_attr_set (h, "content.dump", val) < 0)
log_err_exit ("error setting content.dump attribute");

log_msg ("shutdown will dump KVS (this may take some time)");
}

/* N.B. set nodeid=FLUX_NODEID_ANY so we get immediate error from
* broker if run on rank > 0.
*/
Expand All @@ -90,6 +99,12 @@ static int subcmd (optparse_t *p, int ac, char *av[])
}

static struct optparse_option opts[] = {
{ .name = "gc", .has_arg = 0,
.usage = "Garbage collect KVS (short for --dump=auto)",
},
{ .name = "dump", .has_arg = 1, .arginfo = "PATH",
.usage = "Dump KVS content to specified archive file using flux-dump(1)."
},
{ .name = "background", .has_arg = 0,
.usage = "Exit the command immediately after initiating shutdown",
},
Expand Down

0 comments on commit 0e97b7c

Please sign in to comment.