Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jieguangzhou committed Nov 2, 2022
1 parent adf9c98 commit a2fed15
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/docs/en/guide/parameter/file-parameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The configuration in the figure below indicates that the task gets the file iden
- The file transfer between upstream and downstream tasks is based on the resource center as a transfer, and the data is saved in the `DATA_TRANSFER` directory of the resource center. Therefore, **the resource center function must be enabled**, please refer to [Resource Center Configuration Details](../resource/configuration.md) for details, otherwise the file parameter function cannot be used.
- The file naming rule is `DATA_TRANSFER/DATE/ProcessDefineCode/ProcessDefineVersion_ProcessInstanceID/TaskName_TaskInstanceID_FileName`
- If the transferred file data is a folder, it will be packaged into a compressed file with a suffix of `.zip` and uploaded. The downstream task will unzip and save it in the corresponding directory after receiving it
- If you need to delete the file data, you can delete the corresponding folder in the `DATA_TRANSFER` directory of the resource center. If you delete the date subdirectory directly, you will delete all the file data on that date
- If you need to delete the file data, you can delete the corresponding folder in the `DATA_TRANSFER` directory of the resource center. If you delete the date subdirectory directly, all the file data under that date will be deleted. You can also use the [Open API interface](../open-api.md) (`resources/data-transfer`) to delete the corresponding file data (delete data N days ago).
- If there is a task chain task1->task2->tas3, then the downstream task task3 can also get the file data of task1
- Support one-to-many transmission and many-to-one transmission
- If you frequently transfer a large number of files, it is obvious that the system IO performance will be affected by the amount of transferred data
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/zh/guide/parameter/file-parameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
- 上下游任务间的文件传递基于资源中心作为中转,数据保存在资源中心`DATA_TRANSFER`的目录下, 因此**必须开启资源中心功能**,详情请参考[资源中心配置详情](../resource/configuration.md), 否则无法使用文件参数功能。
- 文件命名规则为 `DATA_TRANSFER/日期/工作流Code/工作流版本_工作流实例ID/任务名称_任务实例ID_文件名`
- 若传输的文件数据为文件夹,则会打包成后缀为`.zip`的压缩文件再上传,下游任务接到后会解压并保存在对应目录
- 若需要删除文件数据,可以在资源中心的`DATA_TRANSFER`目录下删除对应文件夹即可, 如直接按照日期子目录删除,会删除该日期下所有的文件数据
- 若需要删除文件数据,可以在资源中心的`DATA_TRANSFER`目录下删除对应文件夹即可, 如直接按照日期子目录删除,会删除该日期下所有的文件数据. 也可以使用`resources/data-transfer`[Open API 接口](../open-api.md)(删除N天前的数据)删除对应文件数据。
- 如果存在任务链 task1->task2->tas3, 则最下游任务task3也能获取task1的文件数据
- 支持一对多传输以及多对一传输
- 如果频繁大量传输文件,毫无疑问会因传输的数据量影响到系统IO性能
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ public Result<Object> deleteResource(@Parameter(hidden = true) @RequestAttribute
@Parameters({
@Parameter(name = "days", description = "N days ago", required = true, schema = @Schema(implementation = Integer.class))
})
@DeleteMapping(value = "/data-transfer-delete")
@DeleteMapping(value = "/data-transfer")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_RESOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Map<String, Object> deleteDataTransferData(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result<Object> deleteDataTransferData(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "days") Integer days) {
return resourceService.deleteDataTransferData(loginUser, days);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ Result<Object> updateResourceContent(User loginUser, String fullName, String ten
* @param loginUser user who query resource
* @param days number of days
*/
Map<String, Object> deleteDataTransferData(User loginUser, Integer days);
Result<Object> deleteDataTransferData(User loginUser, Integer days);

/**
* unauthorized file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1875,8 +1875,8 @@ public Resource queryResourcesFileInfo(String userName, String fileName) {
}

@Override
public Map<String, Object> deleteDataTransferData(User loginUser, Integer days) {
Map<String, Object> result = new HashMap<>();
public Result<Object> deleteDataTransferData(User loginUser, Integer days) {
Result<Object> result = new Result<>();

User user = userMapper.selectById(loginUser.getId());
if (user == null) {
Expand Down Expand Up @@ -1910,6 +1910,7 @@ public Map<String, Object> deleteDataTransferData(User loginUser, Integer days)

List<String> successList = new ArrayList<>();
List<String> failList = new ArrayList<>();

for (StorageEntity storageEntity : storageEntities) {
File path = new File(storageEntity.getFullName());
String date = path.getName();
Expand All @@ -1923,9 +1924,12 @@ public Map<String, Object> deleteDataTransferData(User loginUser, Integer days)
}
}
}

Map<String, Object> data = new HashMap<>();
data.put("successList", successList);
data.put("failList", failList);
putMsg(result, Status.SUCCESS);
result.put("successList", successList);
result.put("failList", failList);
result.setData(data);
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,9 @@ public static void uploadOutputFiles(TaskExecutionContext taskExecutionContext,
String resourceWholePath =
storageOperate.getResourceFileName(taskExecutionContext.getTenantCode(), resourcePath);
logger.info("{} --- Local:{} to Remote:{}", property, srcPath, resourceWholePath);
logger.info("123123123123");
storageOperate.upload(taskExecutionContext.getTenantCode(), srcPath, resourceWholePath, false, true);
} catch (IOException ex) {
throw new TaskException(ex.getMessage(), ex);
throw new TaskException("Upload file to storage error", ex);
}

// update varPool
Expand Down Expand Up @@ -167,7 +166,7 @@ public static void downloadUpstreamFiles(TaskExecutionContext taskExecutionConte
storageOperate.download(taskExecutionContext.getTenantCode(), resourceWholePath, downloadPath, false,
true);
} catch (IOException ex) {
throw new TaskException(ex.getMessage(), ex);
throw new TaskException("Download file from storage error", ex);
}

// unpack if the data is packaged
Expand Down

0 comments on commit a2fed15

Please sign in to comment.