7689c570a2b6bbd480d09cdc162ba56d86426b07
kent
  Fri Dec 27 19:50:04 2013 -0800
Moving a couple of routines to library so they can be shared.
diff --git src/parasol/para/para.c src/parasol/para/para.c
index bf01e0d..0d87bf9 100644
--- src/parasol/para/para.c
+++ src/parasol/para/para.c
@@ -1590,69 +1590,38 @@
 
 void paraStatus(char *batch)
 /* Print status of all jobs. */
 {
 struct jobDb *db = readBatch(batch);
 struct job *job;
 time_t now = time(NULL);
 
 markQueuedJobs(db);
 markRunJobStatus(db);
 printf("%s", jobStatusHdr);
 for (job = db->jobList; job != NULL; job = job->next)
     paraJobStatus(job, now);
 }
 
-void fetchOpenFile(struct paraMessage *pm, struct rudp *ru, char *fileName)
-/* Read everything you can from socket and output to file. */
-{
-struct paraMultiMessage pmm;
-FILE *f = mustOpen(fileName, "w");
-/* ensure the multi-message response comes from the correct ip and has no duplicate msgs*/
-pmmInit(&pmm, pm, pm->ipAddress.sin_addr);
-while (pmmReceive(&pmm, ru))
-    {
-    if (pm->size == 0)
-	break;
-    mustWrite(f, pm->data, pm->size);
-    }
-carefulClose(&f);
-}
-
-void fetchFile(char *host, char *sourceName, char *destName)
-/* Fetch small file. */
-{
-struct rudp *ru = rudpOpen();
-struct paraMessage pm;
-if (ru != NULL)
-    {
-    pmInitFromName(&pm, host, paraNodePort);
-    pmPrintf(&pm, "fetch %s %s", getUser(), sourceName);
-    if (pmSend(&pm, ru))
-	fetchOpenFile(&pm, ru, destName);
-    rudpClose(&ru);
-    }
-}
-
 void printErrFile(struct submission *sub)
 /* Print error file if it exists. */
 {
 char localName[PATH_LEN];
 safef(localName, sizeof(localName), "%s/%s", errDir, sub->id);
 if (!fileExists(localName))
     {
-    fetchFile(sub->host, sub->errFile, localName);
+    pmFetchFile(sub->host, sub->errFile, localName);
     }
 if (fileExists(localName))
     {
     char *buf;
     size_t size;
     printf("stderr:\n");
     readInGulp(localName, &buf, &size);
     mustWrite(stdout, buf, size);
     freez(&buf);
     }
 }
 
 void problemReport(struct job *job, struct submission *sub, char *type)
 /* Print report on one problem. */
 {