diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index 50939c224c665dd26331b504efb873a466429d81..a2bf21bbd1544a954cccc5e98bb86143927961b3 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -1977,12 +1977,36 @@ void _add_job_hash(struct job_record *job_ptr) job_hash[inx] = job_ptr; } +/* + * find_job_array_rec - return a pointer to the job record with the given + * array_job_id/array_task_id + * IN job_id - requested job's id + * IN array_task_id - requested job's task id (NO_VAL if none specified) + * RET pointer to the job's record, NULL on error + */ +extern struct job_record *find_job_array_rec(uint32_t array_job_id, + uint16_t array_task_id) +{ + ListIterator job_iterator; + struct job_record *job_ptr; + + if (array_task_id == (uint16_t) NO_VAL) + return find_job_record(array_job_id); + + job_iterator = list_iterator_create(job_list); + while ((job_ptr = (struct job_record *) list_next(job_iterator))) { + if ((job_ptr->array_job_id == array_job_id) && + (job_ptr->array_task_id == array_task_id)) + break; + } + list_iterator_destroy(job_iterator); + return job_ptr; +} + /* * find_job_record - return a pointer to the job record with the given job_id * IN job_id - requested job's id * RET pointer to the job's record, NULL on error - * global: job_list - global job list pointer - * job_hash - hash table into job records */ struct job_record *find_job_record(uint32_t job_id) { diff --git a/src/slurmctld/slurmctld.h b/src/slurmctld/slurmctld.h index 6c1fc41cb893e6002ddff7b5876dee0eebb406ba..c447cd33cdf4839bf7784e10c52fd647ea62bb22 100644 --- a/src/slurmctld/slurmctld.h +++ b/src/slurmctld/slurmctld.h @@ -878,14 +878,22 @@ extern void excise_node_from_job(struct job_record *job_ptr, */ extern List feature_list_copy(List feature_list_src); +/* + * find_job_array_rec - return a pointer to the job record with the given + * array_job_id/array_task_id + * IN job_id - requested job's id + * IN array_task_id - requested job's task id (NO_VAL if none specified) + * RET pointer to the job's record, NULL on error + */ +extern struct job_record *find_job_array_rec(uint32_t array_job_id, + uint16_t array_task_id); + /* * find_job_record - return a pointer to the job record with the given job_id * IN job_id - requested job's id * RET pointer to the job's record, NULL on error - * global: job_list - global job list pointer - * job_hash - hash table into job records */ -extern struct job_record *find_job_record (uint32_t job_id); +struct job_record *find_job_record(uint32_t job_id); /* * find_first_node_record - find a record for first node in the bitmap