Ignore:
Timestamp:
07/22/14 11:17:42 (11 years ago)
Author:
pkopta
Message:
 
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  
    261261                const fsd_template_t *jt, 
    262262                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) 
    266264{ 
    267265        fsd_expand_drmaa_ph_t *volatile expand = NULL; 
     
    269267        TRY 
    270268         { 
    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 ); 
    273271         } 
    274272        EXCEPT_DEFAULT 
     
    308306                fsd_environ_t **envp, 
    309307                fsd_expand_drmaa_ph_t *expand,  
    310                 job_desc_msg_t * job_desc, 
    311                 int n_job 
     308                job_desc_msg_t * job_desc 
    312309                ) 
    313310{ 
     
    326323        const char *job_category = "default"; 
    327324         
    328         slurmdrmaa_init_job_desc( job_desc ); 
    329  
    330         slurm_init_job_desc_msg( job_desc ); 
    331          
    332325        job_desc->user_id = getuid(); 
    333326        job_desc->group_id = getgid(); 
  • branches/slurm-drmaa-1.2.0/slurm_drmaa/job.h

    r27 r38  
    4343}; 
    4444 
    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); 
     45void slurmdrmaa_job_create_req(fsd_drmaa_session_t *session, const fsd_template_t *jt, fsd_environ_t **envp, job_desc_msg_t * job_desc ); 
     46void 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 ); 
    4747 
    4848#endif /* __SLURM_DRMAA__JOB_H */ 
  • 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  
  • branches/slurm-drmaa-1.2.0/slurm_drmaa/util.c

    r37 r38  
    168168        fsd_free(job_desc->exc_nodes); 
    169169        fsd_free(job_desc->gres); 
     170        fsd_free(job_desc->array_inx); 
    170171         
    171172        fsd_log_return(( "" )); 
Note: See TracChangeset for help on using the changeset viewer.