forked from TencentBlueKing/bk-job
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Job 支持容器执行 - 脚本任务 TencentBlueKing#2631
- Loading branch information
Showing
23 changed files
with
1,034 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
241 changes: 198 additions & 43 deletions
241
...cute/src/main/java/com/tencent/bk/job/execute/api/web/WebTaskExecutionResultResource.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...execute/src/main/java/com/tencent/bk/job/execute/model/web/vo/ExecuteObjectFileLogVO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. | ||
* | ||
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. | ||
* | ||
* License for BK-JOB蓝鲸智云作业平台: | ||
* -------------------------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | ||
* to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | ||
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
* IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bk.job.execute.model.web.vo; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@ApiModel("文件任务-执行对象执行日志") | ||
@Data | ||
public class ExecuteObjectFileLogVO { | ||
@ApiModelProperty(name = "isIncludingLogContent", value = "是否包含日志内容") | ||
private boolean includingLogContent; | ||
@ApiModelProperty("文件分发执行详情") | ||
private List<FileDistributionDetailV2VO> fileDistributionDetails; | ||
@ApiModelProperty(name = "finished", value = "日志是否拉取完成") | ||
private boolean finished; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
...ute/src/main/java/com/tencent/bk/job/execute/model/web/vo/FileDistributionDetailV2VO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. | ||
* | ||
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. | ||
* | ||
* License for BK-JOB蓝鲸智云作业平台: | ||
* -------------------------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | ||
* to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | ||
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
* IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bk.job.execute.model.web.vo; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
|
||
@ApiModel("文件分发执行详情") | ||
@Data | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class FileDistributionDetailV2VO implements Comparable<FileDistributionDetailV2VO> { | ||
@ApiModelProperty(name = "taskId", value = "文件任务ID,用于检索单个文件分发的结果") | ||
private String taskId; | ||
@ApiModelProperty(name = "srcExecuteObject", value = "文件源执行对象") | ||
private ExecuteObjectVO srcExecuteObject; | ||
@ApiModelProperty(name = "destExecuteObject", value = "目标执行对象") | ||
private ExecuteObjectVO destExecuteObject; | ||
@ApiModelProperty("文件名称") | ||
private String fileName; | ||
@ApiModelProperty("文件大小") | ||
private String fileSize; | ||
@ApiModelProperty("状态,0-Pulling,1-Waiting,2-Uploading,3-Downloading,4-Finished,5-Failed") | ||
private Integer status; | ||
@ApiModelProperty("状态描述") | ||
private String statusDesc; | ||
@ApiModelProperty("速率") | ||
private String speed; | ||
@ApiModelProperty("进度") | ||
private String progress; | ||
@ApiModelProperty("文件任务上传下载标识,0-上传,1-下载") | ||
private Integer mode; | ||
@ApiModelProperty("日志内容") | ||
private String logContent; | ||
|
||
@Override | ||
public int compareTo(FileDistributionDetailV2VO other) { | ||
if (other == null) { | ||
return 1; | ||
} | ||
// 从文件源拉取文件的详情日志放在最前面 | ||
if (this.status == 0 && other.status > 0) { | ||
return -1; | ||
} | ||
int compareFileNameResult = compareString(this.fileName, other.getFileName()); | ||
if (compareFileNameResult != 0) { | ||
return compareFileNameResult; | ||
} | ||
return this.srcExecuteObject.getExecuteObjectResourceId() | ||
.compareTo(other.getSrcExecuteObject().getExecuteObjectResourceId()); | ||
} | ||
|
||
|
||
private int compareString(String a, String b) { | ||
if (a == null && b == null) { | ||
return 0; | ||
} else if (a != null && b == null) { | ||
return 1; | ||
} else if (a == null) { | ||
return -1; | ||
} else { | ||
return a.compareTo(b); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.