IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33482


Ignore:
Timestamp:
Mar 12, 2012, 5:48:27 AM (14 years ago)
Author:
eugene
Message:

fix error in host selection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/HostTable.c

    r33478 r33482  
    289289
    290290      // find the host which has finished
    291       int j;
    292291      int found = FALSE;
    293       for (j = 0; (j < table->Nhosts) && !found; j++) {
    294         if (table->hosts[j].pid != pid) continue;
     292      for (i = 0; (i < table->Nhosts) && !found; i++) {
     293        if (table->hosts[i].pid != pid) continue;
    295294        found = TRUE;
    296295
     296        HostInfo *host = &table->hosts[i];
     297
    297298        // check on the status of this and report any output?
    298         fprintf (stdout, "job finished for %s (%d)\n", table->hosts[j].hostname, pid);
     299        fprintf (stdout, "job finished for %s (%d)\n", host->hostname, pid);
    299300
    300301        // read stdout
    301         EmptyIOBuffer (&table->hosts[j].stdout, 100, table->hosts[j].stdio[HOST_STDOUT]);
    302         fprintf (stdout, "--- stdout from %s ---\n", table->hosts[j].hostname);
    303         write (STDOUT_FILENO, table->hosts[j].stdout.buffer, table->hosts[j].stdout.Nbuffer);
    304         FlushIOBuffer (&table->hosts[i].stdout);
     302        EmptyIOBuffer (&host->stdout, 100, host->stdio[HOST_STDOUT]);
     303        fprintf (stdout, "--- stdout from %s ---\n", host->hostname);
     304        write (STDOUT_FILENO, host->stdout.buffer, host->stdout.Nbuffer);
     305        FlushIOBuffer (&host->stdout);
    305306        fprintf (stdout, "\n");
    306307           
    307308        // read stderr
    308         EmptyIOBuffer (&table->hosts[j].stderr, 100, table->hosts[j].stdio[HOST_STDERR]);
    309         fprintf (stdout, "--- stderr from %s ---\n", table->hosts[j].hostname);
    310         write (STDOUT_FILENO, table->hosts[j].stderr.buffer, table->hosts[j].stderr.Nbuffer);
    311         FlushIOBuffer (&table->hosts[i].stderr);
     309        EmptyIOBuffer (&host->stderr, 100, host->stdio[HOST_STDERR]);
     310        fprintf (stdout, "--- stderr from %s ---\n", host->hostname);
     311        write (STDOUT_FILENO, host->stderr.buffer, host->stderr.Nbuffer);
     312        FlushIOBuffer (&host->stderr);
    312313        fprintf (stdout, "\n");
    313314
    314315        if (WIFEXITED(status)) {
    315316          fprintf (stdout, "normal completion, exit status is %d\n", WEXITSTATUS(status));
    316           table->hosts[j].status = WEXITSTATUS(status);
    317           if (table->hosts[j].status) {
    318             fprintf (stdout, "job failed on %s\n", table->hosts[j].hostname);
     317          host->status = WEXITSTATUS(status);
     318          if (host->status) {
     319            fprintf (stdout, "job failed on %s\n", host->hostname);
    319320          }
    320321        } else {
    321           table->hosts[j].status = -1;
    322           fprintf (stdout, "job exited abnormally on %s\n", table->hosts[j].hostname);
     322          host->status = -1;
     323          fprintf (stdout, "job exited abnormally on %s\n", host->hostname);
    323324          continue;
    324325        }
Note: See TracChangeset for help on using the changeset viewer.