Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: job-list: store inactive job data in job database #4336

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/modules/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ job_list_la_SOURCES =
job_list_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(FLUX_SECURITY_CFLAGS) \
$(HWLOC_CFLAGS)
$(HWLOC_CFLAGS) \
$(SQLITE_CFLAGS)
job_list_la_LIBADD = \
$(builddir)/job-list/libjob-list.la \
$(top_builddir)/src/common/libjob/libjob.la \
Expand All @@ -199,7 +200,8 @@ job_list_la_LIBADD = \
$(top_builddir)/src/common/libflux-optparse.la \
$(top_builddir)/src/common/librlist/librlist.la \
$(JANSSON_LIBS) \
$(HWLOC_LIBS)
$(HWLOC_LIBS) \
$(SQLITE_LIBS)
job_list_la_LDFLAGS = $(fluxmod_ldflags) -module

job_ingest_la_SOURCES =
Expand Down
19 changes: 17 additions & 2 deletions src/modules/job-list/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ libjob_list_la_SOURCES = \
job_state.c \
job_data.h \
job_data.c \
job_db.h \
job_db.c \
list.h \
list.c \
job_util.h \
Expand All @@ -35,12 +37,17 @@ libjob_list_la_SOURCES = \
state_match.h \
state_match.c \
match_util.h \
match_util.c
match_util.c \
constraint_sql.h \
constraint_sql.c \
util.h \
util.c

TESTS = \
test_job_data.t \
test_match.t \
test_state_match.t
test_state_match.t \
test_constraint_sql.t

test_ldadd = \
$(builddir)/libjob-list.la \
Expand Down Expand Up @@ -89,6 +96,14 @@ test_state_match_t_LDADD = \
test_state_match_t_LDFLAGS = \
$(test_ldflags)

test_constraint_sql_t_SOURCES = test/constraint_sql.c
test_constraint_sql_t_CPPFLAGS = \
$(test_cppflags)
test_constraint_sql_t_LDADD = \
$(test_ldadd)
test_constraint_sql_t_LDFLAGS = \
$(test_ldflags)

EXTRA_DIST = \
test/R/1node_1core.R \
test/R/1node_4core.R \
Expand Down
105 changes: 105 additions & 0 deletions src/modules/job-list/config.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
static void config_reload_cb (flux_t *h,
flux_msg_handler_t *mh,
const flux_msg_t *msg,
void *arg)
{
struct conf *conf = arg;
const flux_conf_t *instance_conf;
struct conf_callback *ccb;
flux_error_t error;
const char *errstr = NULL;

if (flux_conf_reload_decode (msg, &instance_conf) < 0)
goto error;
if (policy_validate (instance_conf, &error) < 0) {
errstr = error.text;
goto error;
}
ccb = zlistx_first (conf->callbacks);
while (ccb) {
if (ccb->cb (instance_conf, &error, ccb->arg) < 0) {
errstr = error.text;
errno = EINVAL;
goto error;
}
ccb = zlistx_next (conf->callbacks);
}
if (flux_set_conf (h, flux_conf_incref (instance_conf)) < 0) {
errstr = "error updating cached configuration";
flux_conf_decref (instance_conf);
goto error;
}
if (flux_respond (h, msg, NULL) < 0)
flux_log_error (h, "error responding to config-reload request");
return;
error:
if (flux_respond_error (h, msg, errno, errstr) < 0)
flux_log_error (h, "error responding to config-reload request");
}

static const struct flux_msg_handler_spec htab[] = {
{ FLUX_MSGTYPE_REQUEST, "job-manager.config-reload", config_reload_cb, 0 },
FLUX_MSGHANDLER_TABLE_END,
};





static int process_config (struct kvs_ctx *ctx)
{
flux_error_t error;
if (kvs_checkpoint_config_parse (ctx->kcp,
flux_get_conf (ctx->h),
&error) < 0) {
flux_log (ctx->h, LOG_ERR, "%s", error.text);
return -1;
}
return 0;
}



static int checkpoint_period_parse (const flux_conf_t *conf,
flux_error_t *errp,
double *checkpoint_period)
{
flux_error_t error;
const char *str = NULL;

if (flux_conf_unpack (conf,
&error,
"{s?{s?s}}",
"kvs",
"checkpoint-period", &str) < 0) {
errprintf (errp,
"error reading config for kvs: %s",
error.text);
return -1;
}

if (str) {
if (fsd_parse_duration (str, checkpoint_period) < 0) {
errprintf (errp,
"invalid checkpoint-period config: %s",
str);
return -1;
}
}

return 0;
}

int kvs_checkpoint_config_parse (kvs_checkpoint_t *kcp,
const flux_conf_t *conf,
flux_error_t *errp)
{
if (kcp) {
double checkpoint_period = kcp->checkpoint_period;
if (checkpoint_period_parse (conf, errp, &checkpoint_period) < 0)
return -1;
kcp->checkpoint_period = checkpoint_period;
}
return 0;
}

Loading
Loading