Changeset 31 for trunk/pbs_drmaa
- Timestamp:
- 10/17/11 09:04:20 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/pbs_drmaa/log_reader.c
r30 r31 217 217 fsd_log_debug(("WT - Date changed. Closing log file")); 218 218 self->date_changed = true; 219 fsd_free(line); 220 break; 219 goto cleanup; 221 220 } 222 221 … … 235 234 else 236 235 { 237 fsd_free(line); 238 break; /*we are interested only in the above log messages */ 236 goto cleanup; /*we are interested only in the above log messages */ 239 237 } 240 238 } … … 247 245 if (strncmp(field_token, "Job", 3) != 0) 248 246 { 249 fsd_free(line); 250 break; /* we are interested only in job events */ 247 goto cleanup; /* we are interested only in job events */ 251 248 } 252 249 } … … 254 251 { 255 252 const char *event_jobid = field_token; 256 257 TRY 258 { 259 job = self->session->get_job( self->session, event_jobid ); 260 261 if( job ) 262 { 263 fsd_log_debug(("WT - Found job event: %s", event_jobid)); 264 } 265 else 266 { 267 fsd_log_debug(("WT - Unknown job: %s", event_jobid)); /* Not a DRMAA job */ 268 fsd_free(line); 269 break; 270 } 271 } 272 END_TRY 273 } 253 254 if (!isdigit(event_jobid[0])) 255 { 256 fsd_log_debug(("WT - Invalid job: %s", event_jobid)); 257 goto cleanup; 258 } 259 260 job = self->session->get_job( self->session, event_jobid ); 261 262 if( job ) 263 { 264 fsd_log_debug(("WT - Found job event: %s", event_jobid)); 265 } 266 else 267 { 268 fsd_log_debug(("WT - Unknown job: %s", event_jobid)); /* Not a DRMAA job */ 269 goto cleanup; 270 } 271 } 274 272 else if (field_id == PBSDRMAA_FLD_ID_MSG) 275 273 { … … 287 285 char *p_queue = NULL; 288 286 289 fsd_log_info(("WT - Detected queu edof job %s", job->job_id));287 fsd_log_info(("WT - Detected queuing of job %s", job->job_id)); 290 288 291 289 if ((p_queue = strstr(msg,"queue =")) == NULL) … … 351 349 else 352 350 { 353 job->release( job ); 354 fsd_free(line); 355 break; /* job was started, ignore, wait for Exit_status message */ 351 goto cleanup; /* job was started, ignore, wait for Exit_status message */ 356 352 } 357 353 } 358 else if (event_type == pbsdrmaa_event_0010 && strncmp(msg, "Exit_status=", 12))354 else if (event_type == pbsdrmaa_event_0010 && (strncmp(msg, "Exit_status=", 12) == 0)) 359 355 { 360 356 /* Completed: … … 375 371 if (strncmp(token, "Exit_status=", 12) == 0) 376 372 { 377 token[1 2] = '\0';373 token[11] = '\0'; 378 374 attribs = pbsdrmaa_add_attr(attribs, token, token + 12); 379 375 fsd_log_info(("WT - Completion of job %s (Exit_status=%s) detected after %d seconds", job->job_id, token+12, (int)(time(NULL) - timestamp_time_t) )); … … 381 377 else if (strncmp(token, "resources_used.cput=", 20) == 0) 382 378 { 383 token[ 20] = '\0';379 token[19] = '\0'; 384 380 attribs = pbsdrmaa_add_attr(attribs, token, token + 20); 385 381 } 386 382 else if (strncmp(token, "resources_used.mem=", 19) == 0) 387 383 { 388 token[1 9] = '\0';384 token[18] = '\0'; 389 385 attribs = pbsdrmaa_add_attr(attribs, token, token + 19); 390 386 } 391 387 else if (strncmp(token, "resources_used.vmem=", 20) == 0) 392 388 { 393 token[ 20] = '\0';389 token[19] = '\0'; 394 390 attribs = pbsdrmaa_add_attr(attribs, token, token + 20); 395 391 } 396 392 else if (strncmp(token, "resources_used.walltime=", 24) == 0) 397 393 { 398 token[2 4] = '\0';394 token[23] = '\0'; 399 395 attribs = pbsdrmaa_add_attr(attribs, token, token + 24); 400 396 } … … 412 408 else 413 409 { 414 job->release( job ); 415 fsd_free(line); 416 break; /* ignore other job events*/ 410 goto cleanup; /* ignore other job events*/ 417 411 } 418 412 … … 445 439 fsd_cond_broadcast( &self->session->wait_condition ); 446 440 447 if ( job )448 job->release( job );449 450 fsd_free(line); /* TODO free on exception */451 441 } 452 442 else … … 455 445 } 456 446 } 447 cleanup: 448 fsd_free(line); /* TODO what about exceptions */ 449 if ( job ) 450 job->release( job ); 451 452 457 453 458 454 } /* end of while getline loop */ … … 470 466 timeout_tv.tv_sec = 1; 471 467 timeout_tv.tv_usec = 0; 472 468 fsd_log_debug(("Polling log file for %d seconds", timeout_tv.tv_sec)); 473 469 /* ignore return value - the next get line call will handle IO errors */ 474 470 (void)select(1, &log_fds, NULL, NULL, &timeout_tv); … … 534 530 535 531 retry: 536 if ((self->fhandle = fopen(log_path," ")) == NULL && (num_tries > DRMAA_WAIT_THREAD_MAX_TRIES || self->first_open))532 if ((self->fhandle = fopen(log_path,"r")) == NULL && (num_tries > DRMAA_WAIT_THREAD_MAX_TRIES || self->first_open)) 537 533 { 538 534 fsd_log_error(("Can't open log file. Verify pbs_home. Running standard wait_thread."));
Note: See TracChangeset
for help on using the changeset viewer.