IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 10, 2008, 12:51:04 PM (18 years ago)
Author:
eugene
Message:

allow job stdout / stderr from pclient to arrive slowly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pcontrol/CheckDoneJob.c

    r12840 r20047  
    11# include "pcontrol.h"
     2# define DEBUG 0
    23
    34int CheckDoneJob (Job *job, Host *host) {
    45 
    5   int success;
     6  int status1, status2;
    67
    78  ASSERT (job, "job not set");
     
    1112  ASSERT (job == (Job *) host[0].job, "invalid job");
    1213
    13   success = TRUE;
    14   success &= GetJobOutput ("stdout", host, &job[0].stdout_buff, job[0].stdout_size);
    15   success &= GetJobOutput ("stderr", host, &job[0].stderr_buff, job[0].stderr_size);
     14  status1 = GetJobOutput ("stdout", host, &job[0].stdout);
     15  status2 = GetJobOutput ("stderr", host, &job[0].stderr);
    1616
    17   if (!success) {
    18     // XXX some kind of error?
    19     // XXX try again later?
     17  if ((status1 == PCLIENT_DOWN) || (status2 == PCLIENT_DOWN)) {
     18    // unlink host & job
     19    if (DEBUG || VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname);
     20    job[0].host = NULL;
     21    host[0].job = NULL;
     22       
     23    PutJob (job, PCONTROL_JOB_PENDING, STACK_BOTTOM);
     24
     25    // clear the response data
     26    host[0].response_state = PCONTROL_RESP_NONE;
     27    host[0].response = NULL;
     28
     29    // host has shutdown; harvest the defunct process
     30    HarvestHost (host[0].pid);
     31    PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
     32    return (FALSE);
     33  }
     34
     35  // try again if we are still waiting
     36  if ((status1 == PCLIENT_HUNG) || (status2 == PCLIENT_HUNG)) {
    2037    PutHost (host, PCONTROL_HOST_BUSY, STACK_BOTTOM);
    2138    PutJob (job, PCONTROL_JOB_DONE, STACK_BOTTOM);
     
    3249  return (TRUE);
    3350}
    34 
    35 /** need to add timeout check here **/
Note: See TracChangeset for help on using the changeset viewer.