Ignore:
Timestamp:
01/07/13 17:03:23 (11 years ago)
Author:
mmamonski
Message:

PBS Sumbit API i single class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pbs_drmaa/pbs_conn.c

    r76 r83  
    5454 
    5555static void pbsdrmaa_pbs_reconnect_internal( pbsdrmaa_pbs_conn_t *self, bool reconnect); 
     56 
     57static void pbsdrmaa_pbs_check_connect_internal( pbsdrmaa_pbs_conn_t *self, bool reconnect); 
     58 
     59#define IS_TRANSIENT_ERROR (pbs_errno == PBSE_PROTOCOL || pbs_errno == PBSE_EXPIRED || pbs_errno == PBSOLDE_PROTOCOL || pbs_errno == PBSOLDE_EXPIRED) 
     60 
    5661         
    5762pbsdrmaa_pbs_conn_t *  
     
    8085                self->connection_fd = -1; 
    8186                self->last_usage = time(NULL); 
    82                  
    83                 /*ignore SIGPIPE - otheriwse pbs_disconnect cause the program to exit */ 
     87 
     88                /*ignore SIGPIPE - otherwise pbs_disconnect cause the program to exit */ 
    8489                signal(SIGPIPE, SIG_IGN);        
    8590 
     
    111116{ 
    112117        fsd_log_enter(("")); 
     118 
    113119        TRY 
    114120        { 
     
    134140pbsdrmaa_pbs_submit( pbsdrmaa_pbs_conn_t *self, struct attropl *attrib, char *script, char *destination ) 
    135141{ 
    136  
    137  
     142        char *volatile job_id = NULL; 
     143        volatile bool first_try = true; 
     144        volatile bool conn_lock = false; 
     145 
     146        fsd_log_enter(("")); 
     147 
     148        TRY 
     149         { 
     150                conn_lock = fsd_mutex_lock(&self->session->super.drm_connection_mutex); 
     151 
     152                pbsdrmaa_pbs_reconnect_internal(self, false); 
     153 
     154retry: 
     155                job_id = pbs_submit(self->connection_fd, attrib, script, destination, NULL); 
     156 
     157                fsd_log_info(("pbs_submit(%s, %s) = %s", script, destination, job_id)); 
     158 
     159                if(job_id == NULL) 
     160                 { 
     161                        fsd_log_error(( "pbs_submit failed, pbs_errno = %d", pbs_errno )); 
     162                        if (IS_TRANSIENT_ERROR && first_try) 
     163                         { 
     164                                pbsdrmaa_pbs_reconnect_internal(self, true); 
     165                                first_try = false; 
     166                                goto retry; 
     167                         } 
     168                        else 
     169                         { 
     170                                pbsdrmaa_exc_raise_pbs( "pbs_submit"); 
     171                         } 
     172                 } 
     173         } 
     174        EXCEPT_DEFAULT 
     175         { 
     176                fsd_free(job_id); 
     177                fsd_exc_reraise(); 
     178         } 
     179        FINALLY 
     180         { 
     181                if(conn_lock) 
     182                        conn_lock = fsd_mutex_unlock(&self->session->super.drm_connection_mutex); 
     183         } 
     184        END_TRY 
     185 
     186 
     187        fsd_log_return(("%s", job_id)); 
     188 
     189        return job_id; 
    138190} 
    139191 
     
    182234        int tries_left = self->session->max_retries_count; 
    183235        int sleep_time = 1; 
    184  
    185236 
    186237        fsd_log_enter(("(%d)", self->connection_fd)); 
Note: See TracChangeset for help on using the changeset viewer.