f1948b9353cdb2bed5efc8488cb1578408cd5cd1 kent Fri Jan 3 23:18:00 2014 -0800 Adding -all option to list batches, to see finished ones too. diff --git src/parasol/paraHub/paraHub.c src/parasol/paraHub/paraHub.c index 14b70c0..93ff967 100644 --- src/parasol/paraHub/paraHub.c +++ src/parasol/paraHub/paraHub.c @@ -2586,53 +2586,67 @@ { char shortBatchName[512]; splitPath(batch->name, shortBatchName, NULL, NULL); pmClear(pm); pmPrintf(pm, "%-8s %4d %6d %6d %5d %3d %3d %3d %4.1fg %4d %3d %s", user->name, batch->runningCount, batch->queuedCount, batch->doneCount, batch->crashCount, batch->priority, batch->maxJob, batch->cpu, ((float)batch->ram*ramUnit)/(1024*1024*1024), batch->planCount, (avgBatchTime(batch)+30)/60, shortBatchName); pmSend(pm, rudpOut); } -void listBatches(struct paraMessage *pm) +void listSomeBatches(struct paraMessage *pm, int runThreshold) /* Write list of batches. Format is one batch per * line followed by a blank line. */ { struct user *user; pmSendString(pm, rudpOut, "#user run wait done crash pri max cpu ram plan min batch"); for (user = userList; user != NULL; user = user->next) { struct dlNode *bNode; for (bNode = user->curBatches->head; !dlEnd(bNode); bNode = bNode->next) { writeOneBatchInfo(pm, user, bNode->val); } for (bNode = user->oldBatches->head; !dlEnd(bNode); bNode = bNode->next) { struct batch *batch = bNode->val; - if (batch->runningCount > 0) + if (batch->runningCount >= runThreshold) writeOneBatchInfo(pm, user, batch); } } pmSendString(pm, rudpOut, ""); } +void listBatches(struct paraMessage *pm) +/* Write list of all active batches. Format is one batch per + * line followed by a blank line. */ +{ +listSomeBatches(pm, 1); +} + +void listAllBatches(struct paraMessage *pm) +/* Write list of batches including inactive ones. Format is one batch per + * line followed by a blank line. */ +{ +listSomeBatches(pm, 0); +} + void appendLocalTime(struct paraMessage *pm, time_t t) /* Append time t converted to day/time format to dy. */ { struct tm *tm; tm = localtime(&t); pmPrintf(pm, "%04d/%02d/%02d %02d:%02d:%02d", 1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); } char *upToFirstDot(char *s, bool dotQ) /* Return string up to first dot. */ { static char ret[128]; int size; char *e = strchr(s, '.'); @@ -3395,30 +3409,32 @@ respondToPing(pm); else if (sameWord(command, "addMachine")) addMachine(line); else if (sameWord(command, "removeMachine")) removeMachineAcknowledge(line, pm); else if (sameWord(command, "listJobs")) listJobs(pm, FALSE); else if (sameWord(command, "listJobsExtended")) listJobs(pm, TRUE); else if (sameWord(command, "listMachines")) listMachines(pm); else if (sameWord(command, "listUsers")) listUsers(pm); else if (sameWord(command, "listBatches")) listBatches(pm); + else if (sameWord(command, "listAllBatches")) + listAllBatches(pm); else if (sameWord(command, "listSick")) listSickNodes(pm); else if (sameWord(command, "status")) status(pm); else if (sameWord(command, "pstat")) pstat(line, pm, FALSE); else if (sameWord(command, "pstat2")) pstat(line, pm, TRUE); else if (sameWord(command, "addSpoke")) addSpoke(); else if (sameWord(command, "plan")) plan(pm); if (sameWord(command, "quit")) break; pmFree(&pm);