2018-09-18 11:39:26 -04:00
|
|
|
/*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
* or more contributor license agreements. See the NOTICE file
|
|
|
|
* distributed with this work for additional information
|
|
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
|
|
* to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2013-03-06 13:38:40 -05:00
|
|
|
// requires tableHelper
|
|
|
|
|
|
|
|
var oTable = [];
|
|
|
|
|
2017-02-25 04:28:16 -05:00
|
|
|
var killTask = function(taskId) {
|
|
|
|
if(confirm('Do you really want to kill: '+taskId)) {
|
|
|
|
$.ajax({
|
|
|
|
type:'POST',
|
2018-11-30 02:45:28 -05:00
|
|
|
url: '/druid/indexer/v1/task/'+ taskId +'/shutdown',
|
2017-02-25 04:28:16 -05:00
|
|
|
data: ''
|
|
|
|
}).done(function(data) {
|
2017-03-08 12:00:34 -05:00
|
|
|
setTimeout(function() { location.reload(true) }, 750);
|
2017-02-25 04:28:16 -05:00
|
|
|
}).fail(function(data) {
|
|
|
|
alert('Kill request failed with status: '+data.status+' please check overlord logs');
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-13 17:42:18 -04:00
|
|
|
|
|
|
|
var suspendSupervisor = function(supervisorId) {
|
|
|
|
if(confirm('Do you really want to suspend: '+ supervisorId)) {
|
|
|
|
$.ajax({
|
|
|
|
type:'POST',
|
|
|
|
url: '/druid/indexer/v1/supervisor/' + supervisorId + '/suspend',
|
|
|
|
data: ''
|
|
|
|
}).done(function(data) {
|
|
|
|
setTimeout(function() { location.reload(true) }, 750);
|
|
|
|
}).fail(function(data) {
|
|
|
|
var errMsg = data && data.responseJSON && data.responseJSON.error ?
|
2019-01-31 20:26:41 -05:00
|
|
|
data.responseJSON.error :
|
|
|
|
'suspend request failed, please check overlord logs for details.';
|
2018-09-13 17:42:18 -04:00
|
|
|
alert(errMsg);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var resumeSupervisor = function(supervisorId) {
|
|
|
|
if(confirm('Do you really want to resume: '+ supervisorId)) {
|
|
|
|
$.ajax({
|
|
|
|
type:'POST',
|
|
|
|
url: '/druid/indexer/v1/supervisor/' + supervisorId + '/resume',
|
|
|
|
data: ''
|
|
|
|
}).done(function(data) {
|
|
|
|
setTimeout(function() { location.reload(true) }, 750);
|
|
|
|
}).fail(function(data) {
|
|
|
|
var errMsg = data && data.responseJSON && data.responseJSON.error ?
|
2019-01-31 20:26:41 -05:00
|
|
|
data.responseJSON.error :
|
|
|
|
'resume request failed, please check overlord logs for details.';
|
2018-09-13 17:42:18 -04:00
|
|
|
alert(errMsg);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-04 14:13:12 -04:00
|
|
|
var resetSupervisor = function(supervisorId) {
|
|
|
|
if(confirm('Do you really want to reset: '+ supervisorId)) {
|
|
|
|
$.ajax({
|
|
|
|
type:'POST',
|
|
|
|
url: '/druid/indexer/v1/supervisor/' + supervisorId + '/reset',
|
|
|
|
data: ''
|
|
|
|
}).done(function(data) {
|
|
|
|
setTimeout(function() { location.reload(true) }, 750);
|
|
|
|
}).fail(function(data) {
|
|
|
|
alert('Reset request failed, please check overlord logs for details.');
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var shutdownSupervisor = function(supervisorId) {
|
2018-09-13 17:42:18 -04:00
|
|
|
if(confirm('Do you really want to terminate: '+ supervisorId)) {
|
2017-05-04 14:13:12 -04:00
|
|
|
$.ajax({
|
|
|
|
type:'POST',
|
|
|
|
url: '/druid/indexer/v1/supervisor/' + supervisorId + '/shutdown',
|
|
|
|
data: ''
|
|
|
|
}).done(function(data) {
|
|
|
|
setTimeout(function() { location.reload(true) }, 750);
|
|
|
|
}).fail(function(data) {
|
2018-09-13 17:42:18 -04:00
|
|
|
alert('Terminate request failed, please check overlord logs for details.');
|
2017-05-04 14:13:12 -04:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-06 13:38:40 -05:00
|
|
|
$(document).ready(function() {
|
2017-02-25 04:28:16 -05:00
|
|
|
var augment = function(data, showKill) {
|
2019-08-21 16:52:48 -04:00
|
|
|
for (var i = 0 ; i < data.length ; i++) {
|
2013-12-13 14:36:36 -05:00
|
|
|
var taskId = encodeURIComponent(data[i].id)
|
|
|
|
data[i].more =
|
|
|
|
'<a href="/druid/indexer/v1/task/' + taskId + '">payload</a>' +
|
|
|
|
'<a href="/druid/indexer/v1/task/' + taskId + '/status">status</a>' +
|
|
|
|
'<a href="/druid/indexer/v1/task/' + taskId + '/log">log (all)</a>' +
|
2017-02-25 04:28:16 -05:00
|
|
|
'<a href="/druid/indexer/v1/task/' + taskId + '/log?offset=-8192">log (last 8kb)</a>';
|
|
|
|
if(showKill) {
|
|
|
|
data[i].more += '<a onclick="killTask(\''+ taskId +'\');">kill</a>';
|
|
|
|
}
|
2013-12-13 14:36:36 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-13 17:42:18 -04:00
|
|
|
$.get('/druid/indexer/v1/supervisor?full', function(dataList) {
|
|
|
|
|
2017-05-04 14:13:12 -04:00
|
|
|
var data = []
|
2019-08-21 16:52:48 -04:00
|
|
|
for (var i = 0 ; i < dataList.length ; i++) {
|
2018-09-13 17:42:18 -04:00
|
|
|
var supervisorId = encodeURIComponent(dataList[i].id)
|
|
|
|
var supervisorSpec = dataList[i].spec;
|
|
|
|
var statusText = supervisorSpec && supervisorSpec.suspended ?
|
2019-01-31 20:26:41 -05:00
|
|
|
'<span style="color:#FF6000">suspended</span>' :
|
|
|
|
'<span style="color:#08B157">running</span>';
|
2017-05-04 14:13:12 -04:00
|
|
|
data[i] = {
|
2019-01-15 11:33:31 -05:00
|
|
|
"dataSource" : dataList[i].id,
|
2017-05-04 14:13:12 -04:00
|
|
|
"more" :
|
|
|
|
'<a href="/druid/indexer/v1/supervisor/' + supervisorId + '">payload</a>' +
|
|
|
|
'<a href="/druid/indexer/v1/supervisor/' + supervisorId + '/status">status</a>' +
|
|
|
|
'<a href="/druid/indexer/v1/supervisor/' + supervisorId + '/history">history</a>' +
|
2018-09-13 17:42:18 -04:00
|
|
|
(supervisorSpec.suspended ?
|
2019-01-31 20:26:41 -05:00
|
|
|
'<a style="padding-right:5px;" onclick="resumeSupervisor(\'' + supervisorId + '\');">resume</a>' :
|
|
|
|
'<a onclick="suspendSupervisor(\'' + supervisorId + '\');">suspend</a>'
|
2018-09-13 17:42:18 -04:00
|
|
|
) +
|
2017-05-04 14:13:12 -04:00
|
|
|
'<a onclick="resetSupervisor(\'' + supervisorId + '\');">reset</a>' +
|
2018-09-13 17:42:18 -04:00
|
|
|
'<a onclick="shutdownSupervisor(\'' + supervisorId + '\');">terminate</a>',
|
|
|
|
"status": statusText
|
2017-05-04 14:13:12 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
buildTable((data), $('#supervisorsTable'));
|
|
|
|
if (dataList.length > 0) {
|
|
|
|
$('.supervisors_section').show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-09-26 20:44:21 -04:00
|
|
|
$.get('/druid/indexer/v1/runningTasks', function(data) {
|
2013-03-06 13:38:40 -05:00
|
|
|
$('.running_loading').hide();
|
2017-02-25 04:28:16 -05:00
|
|
|
augment(data, true);
|
2013-12-13 14:36:36 -05:00
|
|
|
buildTable(data, $('#runningTable'));
|
2013-03-06 13:38:40 -05:00
|
|
|
});
|
|
|
|
|
2013-09-26 20:44:21 -04:00
|
|
|
$.get('/druid/indexer/v1/pendingTasks', function(data) {
|
2013-03-06 13:38:40 -05:00
|
|
|
$('.pending_loading').hide();
|
2017-02-25 04:28:16 -05:00
|
|
|
augment(data, true);
|
2013-12-13 14:36:36 -05:00
|
|
|
buildTable(data, $('#pendingTable'));
|
|
|
|
});
|
|
|
|
|
|
|
|
$.get('/druid/indexer/v1/waitingTasks', function(data) {
|
|
|
|
$('.waiting_loading').hide();
|
2017-02-25 04:28:16 -05:00
|
|
|
augment(data, true);
|
2013-12-13 14:36:36 -05:00
|
|
|
buildTable(data, $('#waitingTable'));
|
|
|
|
});
|
|
|
|
|
|
|
|
$.get('/druid/indexer/v1/completeTasks', function(data) {
|
|
|
|
$('.complete_loading').hide();
|
2017-02-25 04:28:16 -05:00
|
|
|
augment(data, false);
|
2013-12-13 14:36:36 -05:00
|
|
|
buildTable(data, $('#completeTable'));
|
2013-03-06 13:38:40 -05:00
|
|
|
});
|
|
|
|
|
2013-09-26 20:44:21 -04:00
|
|
|
$.get('/druid/indexer/v1/workers', function(data) {
|
2013-03-06 13:38:40 -05:00
|
|
|
$('.workers_loading').hide();
|
|
|
|
buildTable(data, $('#workerTable'));
|
|
|
|
});
|
|
|
|
|
2013-09-26 20:44:21 -04:00
|
|
|
$.get('/druid/indexer/v1/scaling', function(data) {
|
2013-03-06 13:38:40 -05:00
|
|
|
$('.events_loading').hide();
|
|
|
|
buildTable(data, $('#eventTable'));
|
|
|
|
});
|
2013-12-13 14:36:36 -05:00
|
|
|
});
|