ea752b0065368a5b24ba8dac7d28819b0869d873 chmalee Fri Dec 3 14:55:35 2021 -0800 Fix some of the hubCheck timeout error messages as requested by qa, refs #28412 diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index b2ad100..74402b1 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -368,57 +368,60 @@ if (hub->trackHub != NULL) printGenomes(hub->trackHub, count, !hubHasError); else ourPrintCell(""); puts("</tr>"); } printf("</tbody></TABLE>\n"); puts("</FORM>"); printf("</div>"); // .tabSection printf("</div>"); // #unlistedHubs } -void doValidateNewHub(char *hubUrl) +int doValidateNewHub(char *hubUrl) /* Run hubCheck on a hub. */ { +int ret = 0; udcSetCacheTimeout(1); char *expireTime = cfgOptionDefault("browser.cgiExpireMinutes", "20"); unsigned expireMinutes = sqlUnsigned(expireTime); int hubCheckTimeout = (expireMinutes - 1) * 60 > 0 ? (expireMinutes - 1) * 60 : 60; printf("<div id=\"validateHubResult\" class=\"hubTdbTree\" style=\"overflow: auto\"></div>"); char *cmd[] = {"loader/hubCheck", "-htmlOut", "-noTracks", hubUrl, NULL}; struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { struct pipeline *pl = pipelineOpen1(cmd, pipelineRead | pipelineNoAbort, NULL, NULL, hubCheckTimeout); struct lineFile *lf = pipelineLineFile(pl); char *line; while (lineFileNext(lf, &line, NULL)) jsInlineF("%s", line); pipelineClose(&pl); // the 'false' below prevents a few hub-search specific jstree configuration options jsInline("hubSearchTree.init(false);"); } errCatchEnd(errCatch); if (errCatch->gotError || errCatch->gotWarning) { - printf("hubCheck timed out after running for %d seconds. Please try on a Unix command line", hubCheckTimeout); + printf("hubCheck timed out after running for %d minute%s. Please try on a Unix command line", hubCheckTimeout / 60, hubCheckTimeout/60 > 1 ? "s" : ""); + ret = 1; } errCatchFree(&errCatch); +return ret; } void hgHubConnectDeveloperMode() /* Put up the controls for the "Hub Development" Tab, which includes a button to run the * hubCheck utility on a hub and load a hub with the udcTimeout and measureTiming * variables turned on */ { // put out the top of our page char *hubUrl = cartOptionalString(cart, "validateHubUrl"); // the outer div for all the elements in the tab puts("<div id=\"hubDeveloper\" class=\"hubList\">"); char *hubUrlVal = ""; if (hubUrl != NULL) @@ -1539,32 +1542,33 @@ "<a href='#' id='windowX' style='float: right' class='ui-dialog-titlebar-close ui-corner-all ui-state-hover' role='button'>" "<span class='ui-icon ui-icon-closethick'>close</span></a></div>"); puts("<div id='content' style='margin:10px; padding: 2px'>"); jsOnEventByIdF("click", "windowX", "closeIframe()"); if (isEmpty(hubUrl)) printf("Please wait, loading and checking hub, this can take 15 seconds to 5 minutes."); else { puts("<p><button id='reloadButton'>Check again</button>"); puts(" <button id='closeButton'>Close this window</button></p>"); jsOnEventByIdF("click", "reloadButton", "reloadIframe()"); jsOnEventByIdF("click", "closeButton", "closeIframe()"); jsInline("document.onkeydown = function(evt) { if (evt.keyCode===27) { closeIframe() } };"); + int retVal = doValidateNewHub(hubUrl); + if (retVal == 0) printf("<div>Finished checking %s</div>", hubUrl); - doValidateNewHub(hubUrl); puts("<hr>"); puts("<p>Our command line tool <a target=_blank href='https://hgdownload.soe.ucsc.edu/downloads.html#utilities_downloads'>hubCheck</a> " "can be used to obtain the same output from a Unix command line.</p>"); puts("<p>To download the hubCheck tool for Linux, run these commands" " (replace 'linux' with 'macOSX' on a x86 Mac):<br>" "<pre>wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/hubCheck\n" "chmod a+x hubCheck\n" "hubCheck https://genome.ucsc.edu/goldenPath/help/examples/hubDirectory/hub.txt</pre></p>"); puts("<p>You can use the 'Esc' key to close this window.</p>"); } puts("</div>"); // margin 10px puts("</div>"); // ui-dialog-titlebar puts("</div>"); // ui-dialog cartWebEnd(); return;