本文整理汇总了Java中org.apache.tajo.master.querymaster.Query.getState方法的典型用法代码示例。如果您正苦于以下问题:Java Query.getState方法的具体用法?Java Query.getState怎么用?Java Query.getState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tajo.master.querymaster.Query
的用法示例。
在下文中一共展示了Query.getState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import org.apache.tajo.master.querymaster.Query; //导入方法依赖的package包/类
public void stop() {
if(stopped.get()) {
return;
}
LOG.info("un-registering ApplicationMaster(QueryMaster):" + appAttemptId);
stopped.set(true);
try {
FinalApplicationStatus status = FinalApplicationStatus.UNDEFINED;
Query query = context.getQuery();
if (query != null) {
TajoProtos.QueryState state = query.getState();
if (state == TajoProtos.QueryState.QUERY_SUCCEEDED) {
status = FinalApplicationStatus.SUCCEEDED;
} else if (state == TajoProtos.QueryState.QUERY_FAILED || state == TajoProtos.QueryState.QUERY_ERROR) {
status = FinalApplicationStatus.FAILED;
} else if (state == TajoProtos.QueryState.QUERY_ERROR) {
status = FinalApplicationStatus.FAILED;
}
}
unregisterApplicationMaster(status, "tajo query finished", null);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
}
allocatorThread.interrupt();
LOG.info("un-registered ApplicationMAster(QueryMaster) stopped:" + appAttemptId);
super.stop();
}
示例2: getQueryResult
import org.apache.tajo.master.querymaster.Query; //导入方法依赖的package包/类
@Override
public ClientProtos.GetQueryResultResponse getQueryResult(
RpcController controller,
ClientProtos.GetQueryResultRequest request) throws ServiceException {
QueryId queryId = new QueryId(request.getQueryId());
Query query = workerContext.getQueryMaster().getQueryMasterTask(queryId, true).getQuery();
ClientProtos.GetQueryResultResponse.Builder builder = ClientProtos.GetQueryResultResponse.newBuilder();
try {
builder.setTajoUserName(UserGroupInformation.getCurrentUser().getUserName());
} catch (IOException e) {
LOG.warn("Can't get current user name");
}
if(query == null) {
builder.setErrorMessage("No Query for " + queryId);
} else {
switch (query.getState()) {
case QUERY_SUCCEEDED:
builder.setTableDesc(query.getResultDesc().getProto());
break;
case QUERY_FAILED:
case QUERY_ERROR:
builder.setErrorMessage("Query " + queryId + " is failed");
default:
builder.setErrorMessage("Query " + queryId + " is still running");
}
}
return builder.build();
}
示例3: getQueryStatus
import org.apache.tajo.master.querymaster.Query; //导入方法依赖的package包/类
@Override
public ClientProtos.GetQueryStatusResponse getQueryStatus(
RpcController controller,
ClientProtos.GetQueryStatusRequest request) throws ServiceException {
ClientProtos.GetQueryStatusResponse.Builder builder
= ClientProtos.GetQueryStatusResponse.newBuilder();
QueryId queryId = new QueryId(request.getQueryId());
builder.setQueryId(request.getQueryId());
if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
builder.setResultCode(ClientProtos.ResultCode.OK);
builder.setState(TajoProtos.QueryState.QUERY_SUCCEEDED);
} else {
QueryMasterTask queryMasterTask = workerContext.getQueryMaster().getQueryMasterTask(queryId);
builder.setResultCode(ClientProtos.ResultCode.OK);
builder.setQueryMasterHost(bindAddr.getHostName());
builder.setQueryMasterPort(bindAddr.getPort());
if (queryMasterTask == null) {
queryMasterTask = workerContext.getQueryMaster().getQueryMasterTask(queryId, true);
}
if (queryMasterTask == null) {
builder.setState(TajoProtos.QueryState.QUERY_NOT_ASSIGNED);
return builder.build();
}
queryMasterTask.touchSessionTime();
Query query = queryMasterTask.getQuery();
builder.setState(query.getState());
builder.setProgress(query.getProgress());
builder.setSubmitTime(query.getAppSubmitTime());
builder.setHasResult(
!(queryMasterTask.getQueryTaskContext().getQueryContext().isCreateTable() ||
queryMasterTask.getQueryTaskContext().getQueryContext().isInsert())
);
if (query.getState() == TajoProtos.QueryState.QUERY_SUCCEEDED) {
builder.setFinishTime(query.getFinishTime());
} else {
builder.setFinishTime(System.currentTimeMillis());
}
}
return builder.build();
}
示例4: getQueryStatus
import org.apache.tajo.master.querymaster.Query; //导入方法依赖的package包/类
@Override
public ClientProtos.GetQueryStatusResponse getQueryStatus(
RpcController controller,
ClientProtos.GetQueryStatusRequest request) throws ServiceException {
ClientProtos.GetQueryStatusResponse.Builder builder
= ClientProtos.GetQueryStatusResponse.newBuilder();
QueryId queryId = new QueryId(request.getQueryId());
builder.setQueryId(request.getQueryId());
if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
builder.setResultCode(ClientProtos.ResultCode.OK);
builder.setState(TajoProtos.QueryState.QUERY_SUCCEEDED);
} else {
QueryMasterTask queryMasterTask = workerContext.getQueryMaster().getQueryMasterTask(queryId);
builder.setResultCode(ClientProtos.ResultCode.OK);
builder.setQueryMasterHost(bindAddr.getHostName());
builder.setQueryMasterPort(bindAddr.getPort());
if (queryMasterTask == null) {
queryMasterTask = workerContext.getQueryMaster().getQueryMasterTask(queryId, true);
}
if (queryMasterTask == null) {
builder.setState(TajoProtos.QueryState.QUERY_NOT_ASSIGNED);
return builder.build();
}
builder.setHasResult(
!(queryMasterTask.getQueryTaskContext().getQueryContext().isCreateTable() ||
queryMasterTask.getQueryTaskContext().getQueryContext().isInsert())
);
queryMasterTask.touchSessionTime();
Query query = queryMasterTask.getQuery();
if (query != null) {
builder.setState(query.getState());
builder.setProgress(query.getProgress());
builder.setSubmitTime(query.getAppSubmitTime());
if (query.getState() == TajoProtos.QueryState.QUERY_SUCCEEDED) {
builder.setFinishTime(query.getFinishTime());
} else {
builder.setFinishTime(System.currentTimeMillis());
}
} else {
builder.setState(queryMasterTask.getState());
builder.setErrorMessage(queryMasterTask.getErrorMessage());
}
}
return builder.build();
}