String topologyId = null;
if (ctx.getExternalContext().getRequestParameterMap().get("topologyId") != null) {
topologyId = ctx.getExternalContext().getRequestParameterMap()
.get("topologyId");
}
NimbusClient client = NimbusClient.getConfiguredClient(conf);
TopologyInfo summ = client.getClient().getTopologyInfo(topologyId);
logFileName = JStormUtils.genLogName(summ.get_name(), Integer.valueOf(workerPort));
}
return;
}
String topologyid = null;
String taskid = null;
String clusterName = null;
// resolve the arguments
if (ctx.getExternalContext().getRequestParameterMap().get("clusterName") != null) {
clusterName = (String) ctx.getExternalContext()
.getRequestParameterMap().get("clusterName");
}
if (ctx.getExternalContext().getRequestParameterMap().get("topologyid") != null) {
topologyid = ctx.getExternalContext().getRequestParameterMap()
.get("topologyid");
}
if (ctx.getExternalContext().getRequestParameterMap().get("taskid") != null) {
taskid = ctx.getExternalContext().getRequestParameterMap()
.get("taskid");
}
if (topologyid == null) {
throw new NotAliveException("Input topologyId is null ");
}
if (taskid == null) {
throw new NotAliveException("Input taskId is null ");
}
NimbusClient client = null;
try {
if(clusterName != null && !(clusterName.equals(""))) {
UIUtils.getClusterInfoByName(conf, clusterName);
}
client = NimbusClient.getConfiguredClient(conf);
TopologyInfo summ = client.getClient().getTopologyInfo(topologyid);
// find the specified task entity
TaskSummary taskSummary = null;
for (TaskSummary _taskSummary : summ.get_tasks()) {
if (taskid.equals(String.valueOf(_taskSummary.get_task_id()))) {
taskSummary = _taskSummary;
break;
}
}
if (taskSummary == null) {
throw new NotAliveException("topologyid=" + topologyid
+ ", taskid=" + taskid);
}
ComponentTask componentTask = UIUtils.getComponentTask(taskSummary,
topologyid);
host = componentTask.getHost();
// logFileName = componentTask.getTopologyid() + "-worker-"
// + componentTask.getPort() + ".log";
logFileName = JStormUtils.genLogName(summ.get_name(),
Integer.valueOf(componentTask.getPort()));
} catch (TException e) {
LOG.error(e.getCause(), e);
throw e;
} catch (NotAliveException e) {
LOG.error(e.getCause(), e);
throw e;
} finally {
if (client != null) {
client.close();
}
}
}