Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

added new button to terminate all crawls

orbiter469e0a62f1ba
diff --git a/htroot/Crawler_p.html b/htroot/Crawler_p.html
index 2b5657137..a3ad10e33 100644
--- a/htroot/Crawler_p.html
+++ b/htroot/Crawler_p.html
@@ -25,14 +25,15 @@
<h2>Crawler</h2>
<noscript><p>(Please enable JavaScript to automatically update this page!)</p></noscript>
-<fieldset id="queues" style="width:180px;float:left;">
+<fieldset id="queues" style="width:210px;float:left;">
<legend>Queues</legend>
<table border="0" class="watchCrawler">
<tbody>
<tr class="TableHeader">
- <th width="110">Queue<br/>&nbsp;</th>
- <th>Size<br/>&nbsp;</th>
- <th width="50">Pause/<br/>Resume</th>
+ <th width="120">Queue<br/>&nbsp;</th>
+ <th width="60">Size<br/>&nbsp;</th>
+ <th width="30"><span class="glyphicon glyphicon-wrench"></span>
+</th>
</tr>
<tr class="TableCellLight">
<td align="left">Local Crawler</td>
@@ -77,15 +78,20 @@
</tr>
</tbody>
</table>
- <div class="warning" id="message">&nbsp;#[queuemessage]#<div>
+ #(terminate-button)#::
+ <form action="/Crawler_p.html" method="get" role="form">
+ <input type="hidden" name="queues_terminate_all" value="" />
+ <button type="submit" class="btn btn-inverse navbar-btn label-danger" onclick="return confirm('Confirm Termination of All Crawls')"><span class="glyphicon glyphicon-remove-circle"></span> Terminate All</button>
+ </form>
+ #(/terminate-button)#
</fieldset>
-<fieldset id="indexsize" style="width:280px;float:left;">
+<fieldset id="indexsize" style="width:240px;float:left;">
<legend>Index Size</legend>
<table border="0" class="watchCrawler">
<tbody>
<tr class="TableHeader">
- <th width="170">Database<br/>&nbsp;</th>
- <th width="80">Entries<br/>&nbsp;</th>
+ <th width="130">Database<br/>&nbsp;</th>
+ <th width="50">Entries<br/>&nbsp;</th>
<th width="40">Seg-<br/>ments</th>
</tr>
<tr class="TableCellLight">
@@ -163,6 +169,7 @@
</table>
</form>
</fieldset>
+
<script>
var maxh = Math.max(document.getElementById("progress").clientHeight, document.getElementById("indexsize").clientHeight, document.getElementById("queues").clientHeight);
document.getElementById("indexsize").style.height = maxh + "px";
@@ -200,6 +207,8 @@ document.getElementById("queues").style.height = maxh + "px";
</p>
<!-- crawl queues -->
+#(info-queue)#::<div class="alert alert-warning">#[message]#</div>#(/info-queue)#
+
<!-- crawl profile list -->
#(crawlProfilesShow)#::
<fieldset>
diff --git a/htroot/Crawler_p.java b/htroot/Crawler_p.java
index 544ed68be..2b4d90fad 100644
--- a/htroot/Crawler_p.java
+++ b/htroot/Crawler_p.java
@@ -45,6 +45,7 @@ import net.yacy.cora.util.SpaceExceededException;
import net.yacy.crawler.CrawlSwitchboard;
import net.yacy.crawler.data.Cache;
import net.yacy.crawler.data.CrawlProfile;
+import net.yacy.crawler.data.NoticedURL.StackType;
import net.yacy.crawler.retrieval.SitemapImporter;
import net.yacy.crawler.robots.RobotsTxt;
import net.yacy.data.WorkTables;
@@ -96,14 +97,22 @@ public class Crawler_p {
prop.put("loaderSize", 0);
prop.put("loaderMax", 0);
prop.put("list-loader", 0);
- prop.put("localCrawlSize", sb.crawlQueues.coreCrawlJobSize());
+
+ int coreCrawlJobSize = sb.crawlQueues.coreCrawlJobSize();
+ int limitCrawlJobSize = sb.crawlQueues.limitCrawlJobSize();
+ int remoteTriggeredCrawlJobSize = sb.crawlQueues.remoteTriggeredCrawlJobSize();
+ int noloadCrawlJobSize = sb.crawlQueues.noloadCrawlJobSize();
+ int allsize = coreCrawlJobSize + limitCrawlJobSize + remoteTriggeredCrawlJobSize + noloadCrawlJobSize;
+
+ prop.put("localCrawlSize", coreCrawlJobSize);
prop.put("localCrawlState", "");
- prop.put("limitCrawlSize", sb.crawlQueues.limitCrawlJobSize());
+ prop.put("limitCrawlSize", limitCrawlJobSize);
prop.put("limitCrawlState", "");
- prop.put("remoteCrawlSize", sb.crawlQueues.remoteTriggeredCrawlJobSize());
+ prop.put("remoteCrawlSize", remoteTriggeredCrawlJobSize);
prop.put("remoteCrawlState", "");
- prop.put("noloadCrawlSize", sb.crawlQueues.noloadCrawlJobSize());
+ prop.put("noloadCrawlSize", noloadCrawlJobSize);
prop.put("noloadCrawlState", "");
+ prop.put("terminate-button", allsize == 0 ? 0 : 1);
prop.put("list-remote", 0);
prop.put("forwardToCrawlStart", "0");
@@ -115,6 +124,19 @@ public class Crawler_p {
if (c.length() < 1000) ConcurrentLog.info("Crawl Start", c);
}
+ if (post != null && post.containsKey("queues_terminate_all")) {
+ // clear stacks
+ for (StackType stackType: StackType.values()) sb.crawlQueues.noticeURL.clear(stackType);
+ try { sb.cleanProfiles(); } catch (final InterruptedException e) {/* ignore this */}
+
+ // remove pause
+ sb.continueCrawlJob(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
+ sb.setConfig(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL + "_isPaused_cause", "");
+ sb.continueCrawlJob(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
+ sb.setConfig(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL + "_isPaused_cause", "");
+ prop.put("terminate-button", 0);
+ }
+
if (post != null && post.containsKey("continue")) {
// continue queue
final String queue = post.get("continue", "");
@@ -137,7 +159,12 @@ public class Crawler_p {
}
}
String queuemessage = sb.getConfig(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL + "_isPaused_cause", "");
- prop.putHTML("queuemessage", queuemessage.length() == 0 ? "" : "pause reason: " + queuemessage);
+ if (queuemessage.length() == 0) {
+ prop.put("info-queue", 0);
+ } else {
+ prop.put("info-queue", 1);
+ prop.putHTML("info-queue_message", "pause reason: " + queuemessage);
+ }
if (post != null && post.containsKey("terminate")) try {
final String handle = post.get("handle", "");