Skip to content

Commit 478aaa5

Browse files
committed
job-list: read from sqlite if necessary
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.
1 parent 3fd084a commit 478aaa5

File tree

4 files changed

+358
-12
lines changed

4 files changed

+358
-12
lines changed

src/modules/job-list/job_data.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ void job_destroy (void *data)
3838
hostlist_destroy (job->nodelist_hl);
3939
json_decref (job->annotations);
4040
grudgeset_destroy (job->dependencies);
41+
json_decref (job->dependencies_db);
4142
json_decref (job->jobspec);
4243
json_decref (job->R);
4344
free (job->eventlog);
4445
json_decref (job->exception_context);
46+
json_decref (job->job_dbdata);
4547
free (job);
4648
errno = save_errno;
4749
}

src/modules/job-list/job_data.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ struct job {
6565
const char *exception_note;
6666
flux_job_result_t result;
6767
json_t *annotations;
68+
/* dependencies - built up
69+
* dependencies_db - recovered from db
70+
*/
6871
struct grudgeset *dependencies;
72+
json_t *dependencies_db;
6973

7074
/* cache of job information */
7175
json_t *jobspec;
@@ -74,6 +78,9 @@ struct job {
7478
size_t eventlog_len;
7579
json_t *exception_context;
7680

81+
/* all job data from db */
82+
json_t *job_dbdata;
83+
7784
/* Track which states we have seen and have completed transition
7885
* to. States we've processed via the states_mask and states seen
7986
* via events stream in states_events_mask.

src/modules/job-list/job_util.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ static int store_attr (struct job *job,
205205
else if (streq (attr, "dependencies")) {
206206
if (!job->dependencies)
207207
return 0;
208-
val = json_incref (grudgeset_tojson (job->dependencies));
208+
if (job->dependencies_db)
209+
val = json_incref (job->dependencies_db);
210+
else
211+
val = json_incref (grudgeset_tojson (job->dependencies));
209212
}
210213
else {
211214
errprintf (errp, "%s is not a valid attribute", attr);

0 commit comments

Comments
 (0)