static void slurmdrmaa_job_on_missing( fsd_job_t *self ) { fsd_log_enter(( "({job_id=%s})", self->job_id )); fsd_log_warning(( "Job %s missing from DRM queue", self->job_id )); fsd_log_info(( "job_on_missing: last job_ps: %s (0x%02x)", drmaa_job_ps_to_str(self->state), self->state)); if( self->state >= DRMAA_PS_RUNNING ) { /*if the job ever entered running state assume finished */ self->state = DRMAA_PS_DONE; self->exit_status = 0; } else { self->state = DRMAA_PS_FAILED; /* otherwise failed */ self->exit_status = -1; } fsd_log_info(("job_on_missing evaluation result: state=%d exit_status=%d", self->state, self->exit_status)); fsd_cond_broadcast( &self->status_cond); fsd_cond_broadcast( &self->session->wait_condition ); fsd_log_return(( "; job_ps=%s, exit_status=%d", drmaa_job_ps_to_str(self->state), self->exit_status )); }
static int oardrmaa_wifaborted( int *aborted, int stat, char *error_diagnosis, size_t error_diag_len ) { fsd_log_info(("wifaborted(%d)>>>>", stat)); fsd_log_debug(("wifaborted(%d)", stat)); if ( stat == -1 ) { *aborted = true; } else if ( stat <= 125 ) { *aborted = false; } else if ( stat == 126 || stat == 127 ) { *aborted = true; } else switch( stat & 0x7f ) { case SIGTERM: case SIGKILL: *aborted = true; break; default: *aborted = false; break; } return DRMAA_ERRNO_SUCCESS; }
void _fsd_log( int level, const char *file, const char *function, int kind, char *message ) { const bool color = false; char colorbeg[16]; const char *colorend; int tid; long int seconds, microseconds; const char *prefix; const char *p; if( level < (int)fsd_verbose_level ) { free( message ); return; } if( message == NULL ) return; tid = fsd_thread_id(); if( color ) { fsd_color( colorbeg, sizeof(colorbeg), tid ); colorend = "\033[0m"; } else { colorbeg[0] = '\0'; colorend = ""; } { struct timeval tv; gettimeofday( &tv, NULL ); seconds = tv.tv_sec; microseconds = tv.tv_usec; } if( fsd_logging_start.tv_sec == 0 ) { time_t t; struct tm utc; char rep[32]; fsd_log_check_verbosity(); fsd_logging_start.tv_sec = seconds; fsd_logging_start.tv_usec = microseconds; t = seconds; gmtime_r( &t, &utc ); strftime( rep, sizeof(rep), "%Y-%m-%d %H:%M:%S", &utc ); fsd_log_info(( "logging started at: %s.%02ld Z", rep, microseconds/10000 )); /* recheck */ if( level < (int)fsd_verbose_level ) { free( message ); return; } } if( microseconds < fsd_logging_start.tv_usec ) { seconds --; microseconds += 1000000; } seconds -= fsd_logging_start.tv_sec; microseconds -= fsd_logging_start.tv_usec; switch( kind ) { case _FSD_LOG_ENTER: prefix = "->"; break; case _FSD_LOG_RETURN: prefix = "<-"; break; default: prefix = " *"; function = ""; break; } p = message; do { if( *p == '\n' ) { prefix = " |"; function = ""; p++; } else { const char *end; char *line = NULL; int rc; end = strchr( p, '\n' ); if( end == NULL ) end = p + strlen(p); rc = asprintf( &line, "%c #%s%04x%s [%6ld.%02ld] %s %s%.*s\n", fsd_log_level_char(level), colorbeg, tid, colorend, seconds, microseconds/10000, prefix, function, (int)(end-p), p ); if( rc != -1 ) write( fsd_logging_output, line, strlen(line) ); else return; free( line ); p = end; } } while( *p != '\0' ); free( message ); }