Skip to content

Commit

Permalink
job-list: read from sqlite if necessary
Browse files Browse the repository at this point in the history
Problem: Now that inactive jobs are stored to an sqlite database,
it is possible to retrieve additional job information that is no
longer stored in memory.

Solution: When possible, read from sqlite to get additional job
information about inactive jobs.
  • Loading branch information
chu11 committed Jun 12, 2024
1 parent fcbed7d commit 7907ee2
Show file tree
Hide file tree
Showing 4 changed files with 358 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/modules/job-list/job_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ void job_destroy (void *data)
hostlist_destroy (job->nodelist_hl);
json_decref (job->annotations);
grudgeset_destroy (job->dependencies);
json_decref (job->dependencies_db);
json_decref (job->jobspec);
json_decref (job->R);
free (job->eventlog);
json_decref (job->exception_context);
json_decref (job->job_dbdata);
free (job);
errno = save_errno;
}
Expand Down
7 changes: 7 additions & 0 deletions src/modules/job-list/job_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ struct job {
const char *exception_note;
flux_job_result_t result;
json_t *annotations;
/* dependencies - built up
* dependencies_db - recovered from db
*/
struct grudgeset *dependencies;
json_t *dependencies_db;

/* cache of job information */
json_t *jobspec;
Expand All @@ -74,6 +78,9 @@ struct job {
size_t eventlog_len;
json_t *exception_context;

/* all job data from db */
json_t *job_dbdata;

/* Track which states we have seen and have completed transition
* to. States we've processed via the states_mask and states seen
* via events stream in states_events_mask.
Expand Down
5 changes: 4 additions & 1 deletion src/modules/job-list/job_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ static int store_attr (struct job *job,
else if (streq (attr, "dependencies")) {
if (!job->dependencies)
return 0;
val = json_incref (grudgeset_tojson (job->dependencies));
if (job->dependencies_db)
val = json_incref (job->dependencies_db);
else
val = json_incref (grudgeset_tojson (job->dependencies));
}
else {
errprintf (errp, "%s is not a valid attribute", attr);
Expand Down
Loading

0 comments on commit 7907ee2

Please sign in to comment.