Skip to content

Commit 998732c

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 788cc32 commit 998732c

File tree

4 files changed

+280
-11
lines changed

4 files changed

+280
-11
lines changed

src/modules/job-list/job_data.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ void job_destroy (void *data)
3434
free (job->nodelist);
3535
json_decref (job->annotations);
3636
grudgeset_destroy (job->dependencies);
37+
json_decref (job->dependencies_db);
3738
json_decref (job->jobspec);
3839
json_decref (job->R);
3940
free (job->eventlog);
4041
json_decref (job->exception_context);
4142
zlist_destroy (&job->next_states);
43+
json_decref (job->job_dbdata);
4244
free (job);
4345
errno = save_errno;
4446
}

src/modules/job-list/job_data.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ struct job {
6161
const char *exception_note;
6262
flux_job_result_t result;
6363
json_t *annotations;
64+
/* dependencies - built up
65+
* dependencies_db - recovered from db
66+
*/
6467
struct grudgeset *dependencies;
68+
json_t *dependencies_db;
6569

6670
/* cache of job information */
6771
json_t *jobspec;
@@ -70,6 +74,9 @@ struct job {
7074
size_t eventlog_len;
7175
json_t *exception_context;
7276

77+
/* all job data from db */
78+
json_t *job_dbdata;
79+
7380
/* Track which states we have seen and have completed transition
7481
* to. We do not immediately update to the new state and place
7582
* onto a new list until we have retrieved any necessary data

src/modules/job-list/job_util.c

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

0 commit comments

Comments
 (0)