Skip to content

Commit a32c8bb

Browse files
authored
Merge pull request #97 from natefoo/slurm-25.11
Fixes for Slurm 25.11
2 parents bc10a99 + 8dfa218 commit a32c8bb

5 files changed

Lines changed: 30 additions & 16 deletions

File tree

configure.ac

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AC_INIT([DRMAA for Slurm],[m4_esyscmd_s(./m4/ac_version.sh)],[nate@bx.psu.edu],[slurm-drmaa])
2-
AC_PREREQ([2.72])
2+
AC_PREREQ([2.71])
33
AC_REVISION([m4_esyscmd_s([git rev-parse HEAD])])
44
AC_COPYRIGHT([
55
DRMAA for Slurm
@@ -50,7 +50,6 @@ AC_PROG_MAKE_SET
5050
AC_PROG_LN_S
5151

5252
# check compiler / set basic flags:
53-
5453
if test x$GCC = xyes; then
5554
CFLAGS="-pedantic -std=c99 ${CFLAGS}"
5655
fi

drmaa_utils

slurm_drmaa/job.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ slurmdrmaa_job_control( fsd_job_t *self, int action )
9292
/* change priority to 0*/
9393
slurm_init_job_desc_msg(&job_desc);
9494
slurm_self->old_priority = job_desc.priority;
95+
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(25,11,0)
96+
job_desc.job_id_str = self->job_id;
97+
#else
9598
job_desc.job_id = atoi(self->job_id);
99+
#endif
96100
job_desc.priority = 0;
97101
job_desc.alloc_sid = 0;
98102
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(24,11,0)
@@ -122,7 +126,11 @@ slurmdrmaa_job_control( fsd_job_t *self, int action )
122126
/* change priority back*/
123127
slurm_init_job_desc_msg(&job_desc);
124128
job_desc.priority = INFINITE;
129+
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(25,11,0)
130+
job_desc.job_id_str = self->job_id;
131+
#else
125132
job_desc.job_id = atoi(self->job_id);
133+
#endif
126134
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(24,11,0)
127135
if((_serrno = slurm_update_job(&job_desc)) != SLURM_SUCCESS ) {
128136
#else

slurm_drmaa/session.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929

3030
#include <slurm/slurmdb.h>
3131

32+
/* Slurm 25.11+ moved job_id into step_id struct */
33+
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(25,11,0)
34+
#define SUBMIT_RESPONSE_JOB_ID(resp) ((resp)->step_id.job_id)
35+
#else
36+
#define SUBMIT_RESPONSE_JOB_ID(resp) ((resp)->job_id)
37+
#endif
38+
3239
static char *slurmdrmaa_session_run_job(fsd_drmaa_session_t *self, const fsd_template_t *jt);
3340

3441
static fsd_iter_t *slurmdrmaa_session_run_bulk( fsd_drmaa_session_t *self,const fsd_template_t *jt, int start, int end, int incr );
@@ -145,24 +152,24 @@ slurmdrmaa_session_run_bulk(
145152
connection_lock = fsd_mutex_unlock( &self->drm_connection_mutex );
146153

147154
if (!working_cluster_rec)
148-
fsd_log_debug(("job %u submitted", submit_response->job_id));
155+
fsd_log_debug(("job %u submitted", SUBMIT_RESPONSE_JOB_ID(submit_response)));
149156
else
150-
fsd_log_debug(("job %u submitted on cluster %s", submit_response->job_id, working_cluster_rec->name));
157+
fsd_log_debug(("job %u submitted on cluster %s", SUBMIT_RESPONSE_JOB_ID(submit_response), working_cluster_rec->name));
151158

152159
if ( start != 0 || end != 0 || incr != 0 ) {
153160
int _serrno;
154161
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(24,11,0)
155-
if (( _serrno = slurm_load_job( &job_info, submit_response->job_id, 0)) != SLURM_SUCCESS) {
162+
if (( _serrno = slurm_load_job( &job_info, SUBMIT_RESPONSE_JOB_ID(submit_response), 0)) != SLURM_SUCCESS) {
156163
#else
157-
if ( SLURM_SUCCESS != slurm_load_job( &job_info, submit_response->job_id, 0) ) {
164+
if ( SLURM_SUCCESS != slurm_load_job( &job_info, SUBMIT_RESPONSE_JOB_ID(submit_response), 0) ) {
158165
_serrno = slurm_get_errno();
159166
#endif
160167
fsd_exc_raise_fmt( FSD_ERRNO_INTERNAL_ERROR,"slurm_load_job: %s",slurm_strerror(_serrno));
161168
}
162169
else {
163170
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(14, 10, 0)
164171
for (i = 0, v = start; i < n_jobs; i++, v += incr) {
165-
job_ids[i] = fsd_asprintf("%d_%d", submit_response->job_id, v);
172+
job_ids[i] = fsd_asprintf("%d_%d", SUBMIT_RESPONSE_JOB_ID(submit_response), v);
166173
#else
167174
fsd_assert( job_info->record_count == n_jobs );
168175
for (i=0; i < job_info->record_count; i++) {
@@ -180,9 +187,9 @@ slurmdrmaa_session_run_bulk(
180187
}
181188
} else {
182189
if (!working_cluster_rec)
183-
job_ids[0] = fsd_asprintf( "%d", submit_response->job_id); /* .0*/
190+
job_ids[0] = fsd_asprintf( "%d", SUBMIT_RESPONSE_JOB_ID(submit_response)); /* .0*/
184191
else
185-
job_ids[0] = fsd_asprintf("%d.%s",submit_response->job_id,working_cluster_rec->name);
192+
job_ids[0] = fsd_asprintf("%d.%s",SUBMIT_RESPONSE_JOB_ID(submit_response),working_cluster_rec->name);
186193

187194
job = slurmdrmaa_job_new( fsd_strdup(job_ids[0]) ); /* TODO: ??? */
188195
job->session = self;

slurm_drmaa/slurm_missing.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
#define __LL_DRMAA__SLURM_MISSING_H
2626

2727
#if SLURM_VERSION_NUMBER < SLURM_VERSION_NUM(24,11,0)
28-
extern void * slurm_list_peek (List l);
28+
extern void * slurm_list_peek(List l);
29+
extern int slurm_addto_step_list(List step_list, char *names);
30+
#else
31+
extern void * slurm_list_peek(list_t *l);
32+
extern int slurm_addto_step_list(list_t *step_list, char *names);
2933
#endif
3034
#if SLURM_VERSION_NUMBER < SLURM_VERSION_NUM(24,5,0)
31-
extern void * slurm_list_remove (ListIterator i);
32-
#endif
33-
34-
#if SLURM_VERSION_NUMBER < SLURM_VERSION_NUM(24,11,0)
35-
extern int slurm_addto_step_list(List step_list, char *names);
35+
extern void * slurm_list_remove(ListIterator i);
3636
#endif
3737

3838
/* --clusters is not supported with Slurm < 15.08, but these are defined to

0 commit comments

Comments
 (0)