Skip to content

Commit

Permalink
Merge pull request #1122 from wangyu096/feature/rolling
Browse files Browse the repository at this point in the history
feature: 原子操作能力支持滚动执行 #446
  • Loading branch information
jsonwan authored Jul 13, 2022
2 parents dfced08 + d37dba6 commit b1b35d5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public EsbResp<EsbJobExecuteV3DTO> fastTransferFile(EsbFastTransferFileV3Request
private ValidateResult checkFileSource(EsbFileSourceV3DTO fileSource) {
Integer fileType = fileSource.getFileType();
// fileType是后加的字段,为null则默认为服务器文件不校验
if (fileType != null && TaskFileTypeEnum.valueOf(fileType) == null) {
if (TaskFileTypeEnum.isValid(fileType)) {
return ValidateResult.fail(ErrorCode.MISSING_PARAM_WITH_PARAM_NAME, "file_source.file_type");
}
List<String> files = fileSource.getFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,15 +526,16 @@ private List<FileSourceDTO> convertFileSource(List<ExecuteFileSourceInfoVO> file
}
List<FileSourceDTO> fileSourceDTOS = new ArrayList<>();
fileSources.forEach(fileSource -> {
TaskFileTypeEnum fileType = TaskFileTypeEnum.valueOf(fileSource.getFileType());
FileSourceDTO fileSourceDTO = new FileSourceDTO();
fileSourceDTO.setAccountId(fileSource.getAccountId());
fileSourceDTO.setLocalUpload(TaskFileTypeEnum.LOCAL.getType() == fileSource.getFileType());
fileSourceDTO.setFileType(fileSource.getFileType());
fileSourceDTO.setLocalUpload(TaskFileTypeEnum.LOCAL == fileType);
fileSourceDTO.setFileType(fileType.getType());
fileSourceDTO.setFileSourceId(fileSource.getFileSourceId());
List<FileDetailDTO> files = new ArrayList<>();
if (fileSource.getFileLocation() != null) {
for (String file : fileSource.getFileLocation()) {
if (TaskFileTypeEnum.LOCAL.getType() == fileSource.getFileType()) {
if (TaskFileTypeEnum.LOCAL == fileType) {
files.add(new FileDetailDTO(true, file, fileSource.getFileHash(),
Long.valueOf(fileSource.getFileSize())));
} else {
Expand All @@ -544,7 +545,10 @@ private List<FileSourceDTO> convertFileSource(List<ExecuteFileSourceInfoVO> file
}
}
fileSourceDTO.setFiles(files);
fileSourceDTO.setServers(convertToServersDTO(fileSource.getHost()));
if (fileType == TaskFileTypeEnum.SERVER) {
// 服务器文件分发才需要解析主机参数
fileSourceDTO.setServers(convertToServersDTO(fileSource.getHost()));
}
fileSourceDTOS.add(fileSourceDTO);
});
return fileSourceDTOS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ public List<StepExecutionRecordDTO> listStepExecutionHistory(String username,
}

List<StepExecutionRecordDTO> records;
if (batch == null) {
if (batch == null || batch == 0) {
// 获取步骤维度的重试记录
records = queryStepRetryRecords(stepInstance);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,26 @@ public enum TaskFileTypeEnum {
*/
BASE64_FILE(4);

private int type;
private final int type;

public static TaskFileTypeEnum valueOf(int type) {
for (TaskFileTypeEnum fileType : values()) {
if (fileType.type == type) {
return fileType;
}
}
return null;
throw new IllegalArgumentException("No TaskFileTypeEnum constant: " + type);
}

public static boolean isValid(Integer type) {
if (type == null) {
return false;
}
for (TaskFileTypeEnum fileType : values()) {
if (fileType.type == type) {
return true;
}
}
return false;
}
}

0 comments on commit b1b35d5

Please sign in to comment.