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+
3239static char * slurmdrmaa_session_run_job (fsd_drmaa_session_t * self , const fsd_template_t * jt );
3340
3441static 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 ;
0 commit comments