Skip to content

Commit 428defa

Browse files
committed
job-list: add nodelist hostlist to job_data
Problem: In the near future it'd be convenient to do calculations on the job nodelist, but it often needs to be in a hostlist data structure for processing. We'd like to avoid converting the nodelist to hostlist struct over and over again. Add a field into the job_data struct to hold a cached version of the nodelist in a hostlist struct.
1 parent 90ddf93 commit 428defa

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/modules/job-list/job_data.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ void job_destroy (void *data)
3535
int save_errno = errno;
3636
free (job->ranks);
3737
free (job->nodelist);
38+
hostlist_destroy (job->nodelist_hl);
3839
json_decref (job->annotations);
3940
grudgeset_destroy (job->dependencies);
4041
json_decref (job->jobspec);

src/modules/job-list/job_data.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <flux/core.h>
1515
#include <jansson.h>
1616

17+
#include "src/common/libhostlist/hostlist.h"
1718
#include "src/common/libutil/grudgeset.h"
1819
#include "src/common/libczmqcontainers/czmq_containers.h"
1920

@@ -54,6 +55,7 @@ struct job {
5455
int nnodes;
5556
char *ranks;
5657
char *nodelist;
58+
struct hostlist *nodelist_hl; /* cache of nodelist in hl form */
5759
double expiration;
5860
int wait_status;
5961
bool success;

0 commit comments

Comments
 (0)