Changeset 38 for branches/slurm-drmaa-1.2.0/slurm_drmaa
- Timestamp:
- 07/22/14 11:17:42 (11 years ago)
- Location:
- branches/slurm-drmaa-1.2.0/slurm_drmaa
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/slurm-drmaa-1.2.0/slurm_drmaa/job.c
r37 r38 261 261 const fsd_template_t *jt, 262 262 fsd_environ_t **envp, 263 job_desc_msg_t * job_desc, 264 int n_job /* ~job_step */ 265 ) 263 job_desc_msg_t * job_desc) 266 264 { 267 265 fsd_expand_drmaa_ph_t *volatile expand = NULL; … … 269 267 TRY 270 268 { 271 expand = fsd_expand_drmaa_ph_new( NULL, NULL, fsd_ asprintf("%d",n_job) );272 slurmdrmaa_job_create( session, jt, envp, expand, job_desc , n_job);269 expand = fsd_expand_drmaa_ph_new( NULL, NULL, fsd_strdup("%a") ); 270 slurmdrmaa_job_create( session, jt, envp, expand, job_desc ); 273 271 } 274 272 EXCEPT_DEFAULT … … 308 306 fsd_environ_t **envp, 309 307 fsd_expand_drmaa_ph_t *expand, 310 job_desc_msg_t * job_desc, 311 int n_job 308 job_desc_msg_t * job_desc 312 309 ) 313 310 { … … 326 323 const char *job_category = "default"; 327 324 328 slurmdrmaa_init_job_desc( job_desc );329 330 slurm_init_job_desc_msg( job_desc );331 332 325 job_desc->user_id = getuid(); 333 326 job_desc->group_id = getgid(); -
branches/slurm-drmaa-1.2.0/slurm_drmaa/job.h
r27 r38 43 43 }; 44 44 45 void slurmdrmaa_job_create_req(fsd_drmaa_session_t *session, const fsd_template_t *jt, fsd_environ_t **envp, job_desc_msg_t * job_desc , int n_job);46 void slurmdrmaa_job_create(fsd_drmaa_session_t *session, const fsd_template_t *jt, fsd_environ_t **envp, fsd_expand_drmaa_ph_t *expand, job_desc_msg_t * job_desc , int n_job);45 void slurmdrmaa_job_create_req(fsd_drmaa_session_t *session, const fsd_template_t *jt, fsd_environ_t **envp, job_desc_msg_t * job_desc ); 46 void slurmdrmaa_job_create(fsd_drmaa_session_t *session, const fsd_template_t *jt, fsd_environ_t **envp, fsd_expand_drmaa_ph_t *expand, job_desc_msg_t * job_desc ); 47 47 48 48 #endif /* __SLURM_DRMAA__JOB_H */ -
branches/slurm-drmaa-1.2.0/slurm_drmaa/session.c
r35 r38 98 98 job_desc_msg_t job_desc; 99 99 submit_response_msg_t *submit_response = NULL; 100 job_info_msg_t *job_info = NULL; 101 102 /* zero out the struct, and set default vaules */ 103 slurm_init_job_desc_msg( &job_desc ); 100 104 101 105 TRY 102 106 { 103 107 unsigned i; 104 108 if( start != end ) 105 109 { 106 unsigned idx, i;107 108 110 n_jobs = (end - start) / incr + 1; 109 111 110 112 fsd_calloc( job_ids, n_jobs+1, char* ); 113 job_desc.array_inx = fsd_asprintf( "%d-%d:%d", start, end, incr ); 114 } 111 115 112 for( idx = start, i = 0; idx <= (unsigned)end; idx += incr, i++ ) 113 { 114 connection_lock = fsd_mutex_lock( &self->drm_connection_mutex ); 115 slurmdrmaa_job_create_req( self, jt, (fsd_environ_t**)&env , &job_desc, idx); 116 if(slurm_submit_batch_job(&job_desc,&submit_response)){ 117 fsd_exc_raise_fmt( 118 FSD_ERRNO_INTERNAL_ERROR,"slurm_submit_batch_job: %s",slurm_strerror(slurm_get_errno())); 116 connection_lock = fsd_mutex_lock( &self->drm_connection_mutex ); 117 slurmdrmaa_job_create_req( self, jt, (fsd_environ_t**)&env , &job_desc ); 118 if(slurm_submit_batch_job(&job_desc,&submit_response)){ 119 fsd_exc_raise_fmt( 120 FSD_ERRNO_INTERNAL_ERROR,"slurm_submit_batch_job: %s",slurm_strerror(slurm_get_errno())); 121 } 122 123 connection_lock = fsd_mutex_unlock( &self->drm_connection_mutex ); 124 125 fsd_log_debug(("job %u submitted", submit_response->job_id)); 126 127 if( start != end ) 128 { 129 if ( SLURM_SUCCESS == slurm_load_job( &job_info, submit_response->job_id, 0) ) 130 { 131 fsd_assert( job_info->record_count == n_jobs ); 132 for(i=0; i < job_info->record_count; i++) 133 { 134 job_ids[i] = fsd_asprintf( "%d", job_info->job_array[i].job_id); 135 136 job = slurmdrmaa_job_new( fsd_strdup(job_ids[i]) ); 137 job->session = self; 138 job->submit_time = time(NULL); 139 self->jobs->add( self->jobs, job ); 140 job->release( job ); 141 job = NULL; 119 142 } 120 121 fsd_log_debug(("job %u submitted", submit_response->job_id)); 122 connection_lock = fsd_mutex_unlock( &self->drm_connection_mutex ); 123 124 job_ids[i] = fsd_asprintf("%d",submit_response->job_id); /*TODO */ 125 126 job = slurmdrmaa_job_new( fsd_strdup(job_ids[i]) ); 127 job->session = self; 128 job->submit_time = time(NULL); 129 self->jobs->add( self->jobs, job ); 130 job->release( job ); 131 job = NULL; 132 } 133 fsd_assert( i == n_jobs ); 134 } 135 else /* ! bulk */ 136 { 143 } else { 144 fsd_exc_raise_fmt( FSD_ERRNO_INTERNAL_ERROR,"slurm_load_job: %s",slurm_strerror(slurm_get_errno())); 145 } 146 } else { 137 147 fsd_calloc( job_ids, n_jobs+1, char* ); 138 148 139 connection_lock = fsd_mutex_lock( &self->drm_connection_mutex );140 slurmdrmaa_job_create_req( self, jt, (fsd_environ_t**)&env , &job_desc, 0);141 if(slurm_submit_batch_job(&job_desc,&submit_response)){142 fsd_exc_raise_fmt(143 FSD_ERRNO_INTERNAL_ERROR,"slurm_submit_batch_job: %s",slurm_strerror(slurm_get_errno()));144 }145 146 connection_lock = fsd_mutex_unlock( &self->drm_connection_mutex );147 148 fsd_log_debug(("job %u submitted", submit_response->job_id));149 150 149 job_ids[0] = fsd_asprintf( "%d", submit_response->job_id); /* .0*/ 151 150 … … 156 155 job->release( job ); 157 156 job = NULL; 158 157 } 159 158 } 160 159 ELSE … … 194 193 return job; 195 194 } 196 -
branches/slurm-drmaa-1.2.0/slurm_drmaa/util.c
r37 r38 168 168 fsd_free(job_desc->exc_nodes); 169 169 fsd_free(job_desc->gres); 170 fsd_free(job_desc->array_inx); 170 171 171 172 fsd_log_return(( "" ));
Note: See TracChangeset
for help on using the changeset viewer.