refactor: 去除 TTY 提高性能
This commit is contained in:
parent
9f36f05452
commit
bafee17bc0
|
@ -26,8 +26,8 @@ public class KubernetesExecEngine implements ApiEngine {
|
||||||
/**
|
/**
|
||||||
* 单调执行构造函数
|
* 单调执行构造函数
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request 任务请求参数
|
||||||
* @param resource
|
* @param resource 资源池
|
||||||
*/
|
*/
|
||||||
public KubernetesExecEngine(TaskRequestDTO request, TestResourceDTO resource) {
|
public KubernetesExecEngine(TaskRequestDTO request, TestResourceDTO resource) {
|
||||||
this.request = request;
|
this.request = request;
|
||||||
|
@ -37,8 +37,8 @@ public class KubernetesExecEngine implements ApiEngine {
|
||||||
/**
|
/**
|
||||||
* 批量执行构造函数
|
* 批量执行构造函数
|
||||||
*
|
*
|
||||||
* @param batchRequestDTO
|
* @param batchRequestDTO 批量任务请求参数
|
||||||
* @param resource
|
* @param resource 资源池
|
||||||
*/
|
*/
|
||||||
public KubernetesExecEngine(TaskBatchRequestDTO batchRequestDTO, TestResourceDTO resource) {
|
public KubernetesExecEngine(TaskBatchRequestDTO batchRequestDTO, TestResourceDTO resource) {
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
|
@ -48,8 +48,8 @@ public class KubernetesExecEngine implements ApiEngine {
|
||||||
/**
|
/**
|
||||||
* 停止执行构造函数
|
* 停止执行构造函数
|
||||||
*
|
*
|
||||||
* @param reportIds
|
* @param reportIds 任务ID列表
|
||||||
* @param resource
|
* @param resource 资源池
|
||||||
*/
|
*/
|
||||||
public KubernetesExecEngine(List<String> reportIds, TestResourceDTO resource) {
|
public KubernetesExecEngine(List<String> reportIds, TestResourceDTO resource) {
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
|
|
|
@ -68,8 +68,8 @@ public class KubernetesProvider {
|
||||||
/**
|
/**
|
||||||
* 执行命令
|
* 执行命令
|
||||||
*
|
*
|
||||||
* @param resource
|
* @param resource 资源
|
||||||
* @param command
|
* @param command 命令
|
||||||
*/
|
*/
|
||||||
protected static void exec(TestResourceDTO resource, Object runRequest, String command) {
|
protected static void exec(TestResourceDTO resource, Object runRequest, String command) {
|
||||||
KubernetesClient client = getKubernetesClient(resource);
|
KubernetesClient client = getKubernetesClient(resource);
|
||||||
|
@ -150,7 +150,6 @@ public class KubernetesProvider {
|
||||||
.redirectingInput()
|
.redirectingInput()
|
||||||
.writingOutput(System.out)
|
.writingOutput(System.out)
|
||||||
.writingError(System.err)
|
.writingError(System.err)
|
||||||
.withTTY()
|
|
||||||
.usingListener(new SimpleListener(runRequest, client))
|
.usingListener(new SimpleListener(runRequest, client))
|
||||||
.exec(SHELL_COMMAND, "-c", command);
|
.exec(SHELL_COMMAND, "-c", command);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -167,7 +166,7 @@ public class KubernetesProvider {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable t, Response response) {
|
public void onFailure(Throwable t, Response response) {
|
||||||
LogUtils.error("K8s 监听失败", t);
|
LogUtils.error("K8s 监听失败", t);
|
||||||
if (runRequest != null && !(t instanceof SocketException)) {
|
if (runRequest != null) {
|
||||||
handleGeneralError(runRequest, t);
|
handleGeneralError(runRequest, t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue