Changeset 56 for trunk/pbs_drmaa/job.c


Ignore:
Timestamp:
01/08/12 17:21:05 (12 years ago)
Author:
mmamonski
Message:

handle job killing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pbs_drmaa/job.c

    r55 r56  
    508508pbsdrmaa_job_read_exit_status( const char *job_id, const char *job_state_dir_prefix) 
    509509{ 
    510         char *status_file = NULL; 
     510        char *status_file = NULL, start_file = NULL; 
    511511        FILE *fhandle = NULL; 
    512512        int exit_status = -1; 
     
    515515 
    516516        status_file = fsd_asprintf("%s/%s.exitcode", job_state_dir_prefix, job_id); 
     517        start_file = fsd_asprintf("%s/%s.started", job_id, job_state_dir_prefix); 
    517518 
    518519        if ((fhandle = fopen(status_file, "r")) == NULL) 
    519520         { 
     521                struct stat tmpstat; 
     522 
    520523                fsd_log_error(("Failed to open job status file: %s", status_file)); 
     524                if (stat(start_file, &tmpstat) == 0 && (tmpstat.st_mode & S_IFREG)) 
     525                 { 
     526                        exit_status = 143; /* SIGTERM */ 
     527                        fsd_log_info("But start file exist %s. Assuming that job was killed (exit_status=%d).", start_file, exit_status); 
     528                 } 
    521529         } 
    522530        else 
     
    527535 
    528536        fsd_free(status_file); 
     537        fsd_free(start_file); 
    529538 
    530539        return exit_status; 
Note: See TracChangeset for help on using the changeset viewer.