Skip to content

Commit 7b5991e

Browse files
committed
Incorporate fix for bulk jobs on newer Slurm versions from psnc-apps/slurm-drmaa@d32289c. Fixes #5.
1 parent 8a84f04 commit 7b5991e

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

slurm_drmaa/session.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ slurmdrmaa_session_run_bulk(
100100
job_desc_msg_t job_desc;
101101
submit_response_msg_t *submit_response = NULL;
102102
job_info_msg_t *job_info = NULL;
103+
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(14, 10, 0)
104+
int v = 0;
105+
#endif
103106

104107
/* zero out the struct, and set default vaules */
105108
slurm_init_job_desc_msg( &job_desc );
@@ -135,13 +138,16 @@ slurmdrmaa_session_run_bulk(
135138

136139
if ( start != 0 || end != 0 || incr != 0 ) {
137140
if ( SLURM_SUCCESS == slurm_load_job( &job_info, submit_response->job_id, 0) ) {
141+
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(14, 10, 0)
142+
for (i = 0, v = start; i < n_jobs; i++, v += incr) {
143+
job_ids[i] = fsd_asprintf("%d_%d", submit_response->job_id, v);
144+
#else
138145
fsd_assert( job_info->record_count == n_jobs );
139146
for (i=0; i < job_info->record_count; i++) {
140-
if (!working_cluster_rec)
141-
job_ids[i] = fsd_asprintf("%d", job_info->job_array[i].job_id);
142-
else
143-
job_ids[i] = fsd_asprintf("%d.%s",submit_response->job_id,working_cluster_rec->name);
144-
147+
job_ids[i] = fsd_asprintf("%d", job_info->job_array[i].job_id);
148+
#endif
149+
if (working_cluster_rec)
150+
job_ids[i] = fsd_asprintf("%s.%s", job_ids[i], working_cluster_rec->name);
145151
job = slurmdrmaa_job_new( fsd_strdup(job_ids[i]) );
146152
job->session = self;
147153
job->submit_time = time(NULL);
@@ -176,8 +182,6 @@ slurmdrmaa_session_run_bulk(
176182
{
177183
if ( !connection_lock )
178184
connection_lock = fsd_mutex_lock( &self->drm_connection_mutex );
179-
180-
slurm_free_submit_response_response_msg ( submit_response );
181185
}
182186
FINALLY
183187
{
@@ -186,6 +190,9 @@ slurmdrmaa_session_run_bulk(
186190
if( connection_lock )
187191
fsd_mutex_unlock( &self->drm_connection_mutex );
188192

193+
if( submit_response )
194+
slurm_free_submit_response_response_msg ( submit_response );
195+
189196
if( job )
190197
job->release( job );
191198

0 commit comments

Comments
 (0)