Ignore:
Timestamp:
07/22/14 11:17:42 (11 years ago)
Author:
pkopta
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/slurm-drmaa-1.2.0/slurm_drmaa/session.c

    r35 r38  
    9898        job_desc_msg_t job_desc; 
    9999        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 ); 
    100104         
    101105        TRY 
    102106         { 
    103  
     107        unsigned i; 
    104108                if( start != end ) 
    105109                 { 
    106                         unsigned idx, i; 
    107  
    108110                        n_jobs = (end - start) / incr + 1; 
    109111 
    110112                        fsd_calloc( job_ids, n_jobs+1, char* ); 
     113                        job_desc.array_inx = fsd_asprintf( "%d-%d:%d", start, end, incr ); 
     114         } 
    111115 
    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; 
    119142                                } 
    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 { 
    137147                        fsd_calloc( job_ids, n_jobs+1, char* ); 
    138148 
    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                          
    150149                        job_ids[0] = fsd_asprintf( "%d", submit_response->job_id); /* .0*/ 
    151150 
     
    156155                        job->release( job ); 
    157156                        job = NULL; 
    158                  } 
     157                } 
    159158         } 
    160159         ELSE 
     
    194193        return job; 
    195194} 
    196  
Note: See TracChangeset for help on using the changeset viewer.