status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
|
import org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.plugin.storage.api.StorageEntity;
import org.apache.dolphinscheduler.plugin.storage.api.StorageOperate;
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import org.apache.commons.lang3.StringUtils;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.model.Bucket;
import com.aliyun.oss.model.OSSObject;
import com.aliyun.oss.model.ObjectMetadata;
import com.aliyun.oss.model.PutObjectRequest;
@Data
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
|
public class OssStorageOperator implements Closeable, StorageOperate {
private static final Logger logger = LoggerFactory.getLogger(OssStorageOperator.class);
private String accessKeyId;
private String accessKeySecret;
private String region;
private String bucketName;
private String endPoint;
private OssConnection ossConnection;
private OSS ossClient;
public OssStorageOperator() {
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
|
public void init() {
this.accessKeyId = readOssAccessKeyID();
this.accessKeySecret = readOssAccessKeySecret();
this.endPoint = readOssEndPoint();
this.region = readOssRegion();
this.bucketName = readOssBucketName();
this.ossConnection = buildOssConnection();
this.ossClient = buildOssClient();
ensureBucketSuccessfullyCreated(bucketName);
}
public void init(OssConnection ossConnection) {
this.accessKeyId = readOssAccessKeyID();
this.accessKeySecret = readOssAccessKeySecret();
this.endPoint = readOssEndPoint();
this.region = readOssRegion();
this.bucketName = readOssBucketName();
this.ossConnection = ossConnection;
this.ossClient = getOssClient();
ensureBucketSuccessfullyCreated(bucketName);
}
protected String readOssAccessKeyID() {
return PropertyUtils.getString(TaskConstants.ALIBABA_CLOUD_ACCESS_KEY_ID);
}
protected String readOssAccessKeySecret() {
return PropertyUtils.getString(TaskConstants.ALIBABA_CLOUD_ACCESS_KEY_SECRET);
}
protected String readOssRegion() {
return PropertyUtils.getString(TaskConstants.ALIBABA_CLOUD_REGION);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
|
protected String readOssBucketName() {
return PropertyUtils.getString(Constants.ALIBABA_CLOUD_OSS_BUCKET_NAME);
}
protected String readOssEndPoint() {
return PropertyUtils.getString(Constants.ALIBABA_CLOUD_OSS_END_POINT);
}
protected OssConnection buildOssConnection() {
return new OssConnection(accessKeyId, accessKeySecret, endPoint);
}
@Override
public void close() throws IOException {
ossClient.shutdown();
}
@Override
public void createTenantDirIfNotExists(String tenantCode) throws Exception {
mkdir(tenantCode, getOssResDir(tenantCode));
mkdir(tenantCode, getOssUdfDir(tenantCode));
}
@Override
public String getResDir(String tenantCode) {
return getOssResDir(tenantCode) + FOLDER_SEPARATOR;
}
@Override
public String getUdfDir(String tenantCode) {
return getOssUdfDir(tenantCode) + FOLDER_SEPARATOR;
}
@Override
public boolean mkdir(String tenantCode, String path) throws IOException {
final String key = path + FOLDER_SEPARATOR;
if (!ossClient.doesObjectExist(bucketName, key)) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
|
createOssPrefix(bucketName, key);
}
return true;
}
protected void createOssPrefix(final String bucketName, final String key) {
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(0);
InputStream emptyContent = new ByteArrayInputStream(new byte[0]);
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key, emptyContent, metadata);
ossClient.putObject(putObjectRequest);
}
@Override
public String getResourceFileName(String tenantCode, String fileName) {
if (fileName.startsWith(FOLDER_SEPARATOR)) {
fileName = fileName.replaceFirst(FOLDER_SEPARATOR, "");
}
return String.format(FORMAT_S_S, getOssResDir(tenantCode), fileName);
}
@Override
public String getResourceFileName(String fullName) {
return null;
}
@Override
public String getFileName(ResourceType resourceType, String tenantCode, String fileName) {
if (fileName.startsWith(FOLDER_SEPARATOR)) {
fileName = fileName.replaceFirst(FOLDER_SEPARATOR, "");
}
return getDir(resourceType, tenantCode) + fileName;
}
@Override
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
|
public boolean delete(String filePath, List<String> childrenPathArray, boolean recursive) throws IOException {
return false;
}
@Override
public void download(String tenantCode, String srcFilePath, String dstFilePath, boolean deleteSource,
boolean overwrite) throws IOException {
File dstFile = new File(dstFilePath);
if (dstFile.isDirectory()) {
Files.delete(dstFile.toPath());
} else {
Files.createDirectories(dstFile.getParentFile().toPath());
}
OSSObject ossObject = ossClient.getObject(bucketName, srcFilePath);
try (
InputStream ossInputStream = ossObject.getObjectContent();
FileOutputStream fos = new FileOutputStream(dstFilePath)) {
byte[] readBuf = new byte[1024];
int readLen;
while ((readLen = ossInputStream.read(readBuf)) > 0) {
fos.write(readBuf, 0, readLen);
}
} catch (OSSException e) {
throw new IOException(e);
} catch (FileNotFoundException e) {
logger.error("cannot fin the destination file {}", dstFilePath);
throw e;
}
}
@Override
public boolean exists(String fileName) throws IOException {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
|
return ossClient.doesObjectExist(bucketName, fileName);
}
@Override
public boolean delete(String filePath, boolean recursive) throws IOException {
try {
ossClient.deleteObject(bucketName, filePath);
return true;
} catch (OSSException e) {
logger.error("fail to delete the object, the resource path is {}", filePath, e);
return false;
}
}
@Override
public boolean copy(String srcPath, String dstPath, boolean deleteSource, boolean overwrite) throws IOException {
ossClient.copyObject(bucketName, srcPath, bucketName, dstPath);
ossClient.deleteObject(bucketName, srcPath);
return true;
}
@Override
public String getDir(ResourceType resourceType, String tenantCode) {
switch (resourceType) {
case UDF:
return getUdfDir(tenantCode);
case FILE:
return getResDir(tenantCode);
default:
return "";
}
}
@Override
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
|
public boolean upload(String tenantCode, String srcFile, String dstPath, boolean deleteSource,
boolean overwrite) throws IOException {
try {
ossClient.putObject(bucketName, dstPath, new File(srcFile));
return true;
} catch (OSSException e) {
logger.error("upload failed, the bucketName is {}, the filePath is {}", bucketName, dstPath, e);
return false;
}
}
@Override
public List<String> vimFile(String tenantCode, String filePath, int skipLineNums, int limit) throws IOException {
if (StringUtils.isBlank(filePath)) {
logger.error("file path:{} is empty", filePath);
return Collections.emptyList();
}
OSSObject ossObject = ossClient.getObject(bucketName, filePath);
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(ossObject.getObjectContent()))) {
Stream<String> stream = bufferedReader.lines().skip(skipLineNums).limit(limit);
return stream.collect(Collectors.toList());
}
}
@Override
public ResUploadType returnStorageType() {
return ResUploadType.OSS;
}
@Override
public List<StorageEntity> listFilesStatusRecursively(String path, String defaultPath, String tenantCode,
ResourceType type) {
return null;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
|
}
@Override
public List<StorageEntity> listFilesStatus(String path, String defaultPath, String tenantCode,
ResourceType type) throws Exception {
return null;
}
@Override
public StorageEntity getFileStatus(String path, String defaultPath, String tenantCode,
ResourceType type) throws Exception {
return null;
}
@Override
public void deleteTenant(String tenantCode) throws Exception {
deleteTenantCode(tenantCode);
}
public String getOssResDir(String tenantCode) {
return String.format("%s/" + RESOURCE_TYPE_FILE, getOssTenantDir(tenantCode));
}
public String getOssUdfDir(String tenantCode) {
return String.format("%s/" + RESOURCE_TYPE_UDF, getOssTenantDir(tenantCode));
}
public String getOssTenantDir(String tenantCode) {
return String.format(FORMAT_S_S, getOssDataBasePath(), tenantCode);
}
public String getOssDataBasePath() {
if (FOLDER_SEPARATOR.equals(RESOURCE_UPLOAD_PATH)) {
return "";
} else {
return RESOURCE_UPLOAD_PATH.replaceFirst(FOLDER_SEPARATOR, "");
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
|
}
protected void deleteTenantCode(String tenantCode) {
deleteDir(getResDir(tenantCode));
deleteDir(getUdfDir(tenantCode));
}
public void ensureBucketSuccessfullyCreated(String bucketName) {
if (StringUtils.isBlank(bucketName)) {
throw new IllegalArgumentException("resource.alibaba.cloud.oss.bucket.name is empty");
}
Bucket existsBucket = ossClient.listBuckets()
.stream()
.filter(
bucket -> bucket.getName().equals(bucketName))
.findFirst()
.orElseThrow(() -> {
return new IllegalArgumentException(
"bucketName: " + bucketName + " does not exist, you need to create them by yourself");
});
logger.info("bucketName: {} has been found, the current regionName is {}", existsBucket.getName(), region);
}
protected void deleteDir(String directoryName) {
if (ossClient.doesObjectExist(bucketName, directoryName)) {
ossClient.deleteObject(bucketName, directoryName);
}
}
protected OSS buildOssClient() {
return OssClientFactory.buildOssClient(ossConnection);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/test/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperatorTest.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/test/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperatorTest.java
|
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.storage.oss;
import static org.apache.dolphinscheduler.common.constants.Constants.FOLDER_SEPARATOR;
import static org.apache.dolphinscheduler.common.constants.Constants.FORMAT_S_S;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import java.io.IOException;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import com.aliyun.oss.OSS;
@ExtendWith(MockitoExtension.class)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/test/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperatorTest.java
|
public class OssStorageOperatorTest {
private static final String ACCESS_KEY_ID_MOCK = "ACCESS_KEY_ID_MOCK";
private static final String ACCESS_KEY_SECRET_MOCK = "ACCESS_KEY_SECRET_MOCK";
private static final String REGION_MOCK = "REGION_MOCK";
private static final String END_POINT_MOCK = "END_POINT_MOCK";
private static final String BUCKET_NAME_MOCK = "BUCKET_NAME_MOCK";
private static final String TENANT_CODE_MOCK = "TENANT_CODE_MOCK";
private static final String DIR_MOCK = "DIR_MOCK";
private static final String FILE_NAME_MOCK = "FILE_NAME_MOCK";
private static final String FILE_PATH_MOCK = "FILE_PATH_MOCK";
@Mock
private OSS ossClientMock;
private OssStorageOperator ossOperator;
@BeforeEach
public void setUp() throws Exception {
ossOperator = spy(new OssStorageOperator());
doReturn(ACCESS_KEY_ID_MOCK).when(ossOperator)
.readOssAccessKeyID();
doReturn(ACCESS_KEY_SECRET_MOCK).when(ossOperator)
.readOssAccessKeySecret();
doReturn(REGION_MOCK).when(ossOperator).readOssRegion();
doReturn(BUCKET_NAME_MOCK).when(ossOperator).readOssBucketName();
doReturn(END_POINT_MOCK).when(ossOperator).readOssEndPoint();
doReturn(ossClientMock).when(ossOperator).buildOssClient();
doNothing().when(ossOperator).ensureBucketSuccessfullyCreated(any());
ossOperator.init();
}
@Test
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/test/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperatorTest.java
|
public void initOssOperator() {
verify(ossOperator, times(1)).buildOssClient();
Assertions.assertEquals(ACCESS_KEY_ID_MOCK, ossOperator.getAccessKeyId());
Assertions.assertEquals(ACCESS_KEY_SECRET_MOCK, ossOperator.getAccessKeySecret());
Assertions.assertEquals(REGION_MOCK, ossOperator.getRegion());
Assertions.assertEquals(BUCKET_NAME_MOCK, ossOperator.getBucketName());
}
@Test
public void tearDownOssOperator() throws IOException {
doNothing().when(ossClientMock).shutdown();
ossOperator.close();
verify(ossClientMock, times(1)).shutdown();
}
@Test
public void createTenantResAndUdfDir() throws Exception {
doReturn(DIR_MOCK).when(ossOperator).getOssResDir(TENANT_CODE_MOCK);
doReturn(DIR_MOCK).when(ossOperator).getOssUdfDir(TENANT_CODE_MOCK);
doReturn(true).when(ossOperator).mkdir(TENANT_CODE_MOCK, DIR_MOCK);
ossOperator.createTenantDirIfNotExists(TENANT_CODE_MOCK);
verify(ossOperator, times(2)).mkdir(TENANT_CODE_MOCK, DIR_MOCK);
}
@Test
public void getResDir() {
final String expectedResourceDir = String.format("dolphinscheduler/%s/resources/", TENANT_CODE_MOCK);
final String dir = ossOperator.getResDir(TENANT_CODE_MOCK);
Assertions.assertEquals(expectedResourceDir, dir);
}
@Test
public void getUdfDir() {
final String expectedUdfDir = String.format("dolphinscheduler/%s/udfs/", TENANT_CODE_MOCK);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/test/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperatorTest.java
|
final String dir = ossOperator.getUdfDir(TENANT_CODE_MOCK);
Assertions.assertEquals(expectedUdfDir, dir);
}
@Test
public void mkdirWhenDirExists() {
boolean isSuccess = false;
try {
final String key = DIR_MOCK + FOLDER_SEPARATOR;
doReturn(true).when(ossClientMock).doesObjectExist(BUCKET_NAME_MOCK, key);
isSuccess = ossOperator.mkdir(TENANT_CODE_MOCK, DIR_MOCK);
verify(ossClientMock, times(1)).doesObjectExist(BUCKET_NAME_MOCK, key);
} catch (IOException e) {
Assertions.fail("test failed due to unexpected IO exception");
}
Assertions.assertTrue(isSuccess);
}
@Test
public void mkdirWhenDirNotExists() {
boolean isSuccess = true;
try {
final String key = DIR_MOCK + FOLDER_SEPARATOR;
doReturn(false).when(ossClientMock).doesObjectExist(BUCKET_NAME_MOCK, key);
doNothing().when(ossOperator).createOssPrefix(BUCKET_NAME_MOCK, key);
isSuccess = ossOperator.mkdir(TENANT_CODE_MOCK, DIR_MOCK);
verify(ossClientMock, times(1)).doesObjectExist(BUCKET_NAME_MOCK, key);
verify(ossOperator, times(1)).createOssPrefix(BUCKET_NAME_MOCK, key);
} catch (IOException e) {
Assertions.fail("test failed due to unexpected IO exception");
}
Assertions.assertTrue(isSuccess);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/test/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperatorTest.java
|
}
@Test
public void getResourceFileName() {
final String expectedResourceFileName =
String.format("dolphinscheduler/%s/resources/%s", TENANT_CODE_MOCK, FILE_NAME_MOCK);
final String resourceFileName = ossOperator.getResourceFileName(TENANT_CODE_MOCK, FILE_NAME_MOCK);
Assertions.assertEquals(expectedResourceFileName, resourceFileName);
}
@Test
public void getFileName() {
final String expectedFileName =
String.format("dolphinscheduler/%s/resources/%s", TENANT_CODE_MOCK, FILE_NAME_MOCK);
final String fileName = ossOperator.getFileName(ResourceType.FILE, TENANT_CODE_MOCK, FILE_NAME_MOCK);
Assertions.assertEquals(expectedFileName, fileName);
}
@Test
public void exists() {
boolean doesExist = false;
doReturn(true).when(ossClientMock).doesObjectExist(BUCKET_NAME_MOCK, FILE_NAME_MOCK);
try {
doesExist = ossOperator.exists(FILE_NAME_MOCK);
} catch (IOException e) {
Assertions.fail("unexpected IO exception in unit test");
}
Assertions.assertTrue(doesExist);
verify(ossClientMock, times(1)).doesObjectExist(BUCKET_NAME_MOCK, FILE_NAME_MOCK);
}
@Test
public void delete() {
boolean isDeleted = false;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/test/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperatorTest.java
|
doReturn(null).when(ossClientMock).deleteObject(anyString(), anyString());
try {
isDeleted = ossOperator.delete(FILE_NAME_MOCK, true);
} catch (IOException e) {
Assertions.fail("unexpected IO exception in unit test");
}
Assertions.assertTrue(isDeleted);
verify(ossClientMock, times(1)).deleteObject(anyString(), anyString());
}
@Test
public void copy() {
boolean isSuccess = false;
doReturn(null).when(ossClientMock).copyObject(anyString(), anyString(), anyString(), anyString());
doReturn(null).when(ossClientMock).deleteObject(anyString(), anyString());
try {
isSuccess = ossOperator.copy(FILE_PATH_MOCK, FILE_PATH_MOCK, false, false);
} catch (IOException e) {
Assertions.fail("unexpected IO exception in unit test");
}
Assertions.assertTrue(isSuccess);
verify(ossClientMock, times(1)).copyObject(anyString(), anyString(), anyString(), anyString());
verify(ossClientMock, times(1)).deleteObject(anyString(), anyString());
}
@Test
public void deleteTenant() {
doNothing().when(ossOperator).deleteTenantCode(anyString());
try {
ossOperator.deleteTenant(TENANT_CODE_MOCK);
} catch (Exception e) {
Assertions.fail("unexpected exception caught in unit test");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/test/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperatorTest.java
|
}
verify(ossOperator, times(1)).deleteTenantCode(anyString());
}
@Test
public void getOssResDir() {
final String expectedOssResDir = String.format("dolphinscheduler/%s/resources", TENANT_CODE_MOCK);
final String ossResDir = ossOperator.getOssResDir(TENANT_CODE_MOCK);
Assertions.assertEquals(expectedOssResDir, ossResDir);
}
@Test
public void getOssUdfDir() {
final String expectedOssUdfDir = String.format("dolphinscheduler/%s/udfs", TENANT_CODE_MOCK);
final String ossUdfDir = ossOperator.getOssUdfDir(TENANT_CODE_MOCK);
Assertions.assertEquals(expectedOssUdfDir, ossUdfDir);
}
@Test
public void getOssTenantDir() {
final String expectedOssTenantDir = String.format(FORMAT_S_S, DIR_MOCK, TENANT_CODE_MOCK);
doReturn(DIR_MOCK).when(ossOperator).getOssDataBasePath();
final String ossTenantDir = ossOperator.getOssTenantDir(TENANT_CODE_MOCK);
Assertions.assertEquals(expectedOssTenantDir, ossTenantDir);
}
@Test
public void deleteDir() {
doReturn(true).when(ossClientMock).doesObjectExist(anyString(), anyString());
ossOperator.deleteDir(DIR_MOCK);
verify(ossClientMock, times(1)).deleteObject(anyString(), anyString());
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.storage.s3;
import static org.apache.dolphinscheduler.common.constants.Constants.AWS_END_POINT;
import static org.apache.dolphinscheduler.common.constants.Constants.FOLDER_SEPARATOR;
import static org.apache.dolphinscheduler.common.constants.Constants.FORMAT_S_S;
import static org.apache.dolphinscheduler.common.constants.Constants.RESOURCE_TYPE_FILE;
import static org.apache.dolphinscheduler.common.constants.Constants.RESOURCE_TYPE_UDF;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.ResUploadType;
import org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.plugin.storage.api.StorageEntity;
import org.apache.dolphinscheduler.plugin.storage.api.StorageOperate;
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import org.apache.commons.lang3.StringUtils;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.util.ArrayList;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.AmazonS3Exception;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.DeleteObjectsRequest;
import com.amazonaws.services.s3.model.ListObjectsV2Request;
import com.amazonaws.services.s3.model.ListObjectsV2Result;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectRequest;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectInputStream;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.amazonaws.services.s3.transfer.MultipleFileDownload;
import com.amazonaws.services.s3.transfer.TransferManager;
import com.amazonaws.services.s3.transfer.TransferManagerBuilder;
import com.google.common.base.Joiner;
public class S3StorageOperator implements Closeable, StorageOperate {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
private static final Logger logger = LoggerFactory.getLogger(S3StorageOperator.class);
private static final String ACCESS_KEY_ID = PropertyUtils.getString(TaskConstants.AWS_ACCESS_KEY_ID);
private static final String SECRET_KEY_ID = PropertyUtils.getString(TaskConstants.AWS_SECRET_ACCESS_KEY);
private static final String REGION = PropertyUtils.getString(TaskConstants.AWS_REGION);
private static final String BUCKET_NAME = PropertyUtils.getString(Constants.AWS_S3_BUCKET_NAME);
private final AmazonS3 s3Client;
public S3StorageOperator() {
if (!StringUtils.isEmpty(PropertyUtils.getString(AWS_END_POINT))) {
s3Client = AmazonS3ClientBuilder
.standard()
.withPathStyleAccessEnabled(true)
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(
PropertyUtils.getString(AWS_END_POINT), Regions.fromName(REGION).getName()))
.withCredentials(
new AWSStaticCredentialsProvider(new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_KEY_ID)))
.build();
} else {
s3Client = AmazonS3ClientBuilder
.standard()
.withCredentials(
new AWSStaticCredentialsProvider(new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_KEY_ID)))
.withRegion(Regions.fromName(REGION))
.build();
}
checkBucketNameExists(BUCKET_NAME);
}
@Override
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
public void close() throws IOException {
s3Client.shutdown();
}
@Override
public void createTenantDirIfNotExists(String tenantCode) throws Exception {
mkdir(tenantCode, getS3ResDir(tenantCode));
mkdir(tenantCode, getS3UdfDir(tenantCode));
}
@Override
public String getResDir(String tenantCode) {
return getS3ResDir(tenantCode) + FOLDER_SEPARATOR;
}
@Override
public String getUdfDir(String tenantCode) {
return getS3UdfDir(tenantCode) + FOLDER_SEPARATOR;
}
@Override
public boolean mkdir(String tenantCode, String path) throws IOException {
String objectName = path + FOLDER_SEPARATOR;
if (!s3Client.doesObjectExist(BUCKET_NAME, objectName)) {
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(0);
InputStream emptyContent = new ByteArrayInputStream(new byte[0]);
PutObjectRequest putObjectRequest = new PutObjectRequest(BUCKET_NAME, objectName, emptyContent, metadata);
s3Client.putObject(putObjectRequest);
}
return true;
}
@Override
public String getResourceFileName(String tenantCode, String fileName) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
if (fileName.startsWith(FOLDER_SEPARATOR)) {
fileName = fileName.replaceFirst(FOLDER_SEPARATOR, "");
}
return String.format(FORMAT_S_S, getS3ResDir(tenantCode), fileName);
}
@Override
public String getResourceFileName(String fullName) {
String resourceUploadPath =
RESOURCE_UPLOAD_PATH.endsWith(FOLDER_SEPARATOR) ? StringUtils.chop(RESOURCE_UPLOAD_PATH)
: RESOURCE_UPLOAD_PATH;
String pathContainingTenantNResource = fullName.substring(
fullName.indexOf(resourceUploadPath)
+ resourceUploadPath.length() + 1);
String[] fileNameArr = pathContainingTenantNResource.split(FOLDER_SEPARATOR);
return Joiner.on(FOLDER_SEPARATOR).join(Arrays.stream(fileNameArr).skip(2).collect(Collectors.toList()));
}
@Override
public String getFileName(ResourceType resourceType, String tenantCode, String fileName) {
if (fileName.startsWith(FOLDER_SEPARATOR)) {
fileName = fileName.replaceFirst(FOLDER_SEPARATOR, "");
}
return getDir(resourceType, tenantCode) + fileName;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
}
@Override
public void download(String tenantCode, String srcFilePath, String dstFilePath, boolean deleteSource,
boolean overwrite) throws IOException {
File dstFile = new File(dstFilePath);
if (dstFile.isDirectory()) {
Files.delete(dstFile.toPath());
} else {
Files.createDirectories(dstFile.getParentFile().toPath());
}
S3Object o = s3Client.getObject(BUCKET_NAME, srcFilePath);
try (
S3ObjectInputStream s3is = o.getObjectContent();
FileOutputStream fos = new FileOutputStream(dstFilePath)) {
byte[] readBuf = new byte[1024];
int readLen;
while ((readLen = s3is.read(readBuf)) > 0) {
fos.write(readBuf, 0, readLen);
}
} catch (AmazonServiceException e) {
throw new IOException(e.getMessage());
} catch (FileNotFoundException e) {
logger.error("the destination file {} not found", dstFilePath);
throw e;
}
}
@Override
public boolean exists(String fullName) throws IOException {
return s3Client.doesObjectExist(BUCKET_NAME, fullName);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
@Override
public boolean delete(String fullName, boolean recursive) throws IOException {
try {
s3Client.deleteObject(BUCKET_NAME, fullName);
return true;
} catch (AmazonServiceException e) {
logger.error("delete the object error,the resource path is {}", fullName);
return false;
}
}
@Override
public boolean delete(String fullName, List<String> childrenPathList, boolean recursive) throws IOException {
childrenPathList.add(fullName);
DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(BUCKET_NAME)
.withKeys(childrenPathList.stream().toArray(String[]::new));
try {
s3Client.deleteObjects(deleteObjectsRequest);
} catch (AmazonServiceException e) {
logger.error("delete objects error", e);
return false;
}
return true;
}
@Override
public boolean copy(String srcPath, String dstPath, boolean deleteSource, boolean overwrite) throws IOException {
s3Client.copyObject(BUCKET_NAME, srcPath, BUCKET_NAME, dstPath);
s3Client.deleteObject(BUCKET_NAME, srcPath);
return true;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
@Override
public String getDir(ResourceType resourceType, String tenantCode) {
switch (resourceType) {
case UDF:
return getUdfDir(tenantCode);
case FILE:
return getResDir(tenantCode);
default:
return "";
}
}
@Override
public boolean upload(String tenantCode, String srcFile, String dstPath, boolean deleteSource,
boolean overwrite) throws IOException {
try {
s3Client.putObject(BUCKET_NAME, dstPath, new File(srcFile));
return true;
} catch (AmazonServiceException e) {
logger.error("upload failed,the bucketName is {},the filePath is {}", BUCKET_NAME, dstPath);
return false;
}
}
@Override
public List<String> vimFile(String tenantCode, String filePath, int skipLineNums, int limit) throws IOException {
if (StringUtils.isBlank(filePath)) {
logger.error("file path:{} is blank", filePath);
return Collections.emptyList();
}
S3Object s3Object = s3Client.getObject(BUCKET_NAME, filePath);
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(s3Object.getObjectContent()))) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
Stream<String> stream = bufferedReader.lines().skip(skipLineNums).limit(limit);
return stream.collect(Collectors.toList());
}
}
@Override
public void deleteTenant(String tenantCode) throws Exception {
deleteTenantCode(tenantCode);
}
/**
* S3 resource dir
*
* @param tenantCode tenant code
* @return S3 resource dir
*/
public static String getS3ResDir(String tenantCode) {
return String.format("%s/" + RESOURCE_TYPE_FILE, getS3TenantDir(tenantCode));
}
/**
* S3 udf dir
*
* @param tenantCode tenant code
* @return get udf dir on S3
*/
public static String getS3UdfDir(String tenantCode) {
return String.format("%s/" + RESOURCE_TYPE_UDF, getS3TenantDir(tenantCode));
}
/**
* @param tenantCode tenant code
* @return file directory of tenants on S3
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
public static String getS3TenantDir(String tenantCode) {
return String.format(FORMAT_S_S, getS3DataBasePath(), tenantCode);
}
/**
* get data S3 path
*
* @return data S3 path
*/
public static String getS3DataBasePath() {
if (FOLDER_SEPARATOR.equals(RESOURCE_UPLOAD_PATH)) {
return "";
} else {
return RESOURCE_UPLOAD_PATH.replaceFirst(FOLDER_SEPARATOR, "");
}
}
private void deleteTenantCode(String tenantCode) {
deleteDirectory(getResDir(tenantCode));
deleteDirectory(getUdfDir(tenantCode));
}
/**
* xxx untest
* upload local directory to S3
*
* @param tenantCode
* @param keyPrefix the name of directory
* @param strPath
*/
private void uploadDirectory(String tenantCode, String keyPrefix, String strPath) {
s3Client.putObject(BUCKET_NAME, tenantCode + FOLDER_SEPARATOR + keyPrefix, new File(strPath));
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
/**
* xxx untest
* download S3 Directory to local
*
* @param tenantCode
* @param keyPrefix the name of directory
* @param srcPath
*/
private void downloadDirectory(String tenantCode, String keyPrefix, String srcPath) {
TransferManager tm = TransferManagerBuilder.standard().withS3Client(s3Client).build();
try {
MultipleFileDownload download =
tm.downloadDirectory(BUCKET_NAME, tenantCode + FOLDER_SEPARATOR + keyPrefix, new File(srcPath));
download.waitForCompletion();
} catch (AmazonS3Exception | InterruptedException e) {
logger.error("download the directory failed with the bucketName is {} and the keyPrefix is {}", BUCKET_NAME,
tenantCode + FOLDER_SEPARATOR + keyPrefix);
Thread.currentThread().interrupt();
} finally {
tm.shutdownNow();
}
}
public void checkBucketNameExists(String bucketName) {
if (StringUtils.isBlank(bucketName)) {
throw new IllegalArgumentException("resource.aws.s3.bucket.name is blank");
}
Bucket existsBucket = s3Client.listBuckets()
.stream()
.filter(
bucket -> bucket.getName().equals(bucketName))
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
.findFirst()
.orElseThrow(() -> {
return new IllegalArgumentException(
"bucketName: " + bucketName + " is not exists, you need to create them by yourself");
});
logger.info("bucketName: {} has been found, the current regionName is {}", existsBucket.getName(),
s3Client.getRegionName());
}
/**
* only delete the object of directory ,it`s better to delete the files in it -r
*/
private void deleteDirectory(String directoryName) {
if (s3Client.doesObjectExist(BUCKET_NAME, directoryName)) {
s3Client.deleteObject(BUCKET_NAME, directoryName);
}
}
@Override
public ResUploadType returnStorageType() {
return ResUploadType.S3;
}
@Override
public List<StorageEntity> listFilesStatusRecursively(String path, String defaultPath, String tenantCode,
ResourceType type) {
List<StorageEntity> storageEntityList = new ArrayList<>();
LinkedList<StorageEntity> foldersToFetch = new LinkedList<>();
do {
String pathToExplore = "";
if (foldersToFetch.size() == 0) {
pathToExplore = path;
} else {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
pathToExplore = foldersToFetch.pop().getFullName();
}
try {
List<StorageEntity> tempList = listFilesStatus(pathToExplore, defaultPath, tenantCode, type);
for (StorageEntity temp : tempList) {
if (temp.isDirectory()) {
foldersToFetch.add(temp);
}
}
storageEntityList.addAll(tempList);
} catch (AmazonServiceException e) {
logger.error("Resource path: {}", pathToExplore, e);
return storageEntityList;
}
} while (foldersToFetch.size() != 0);
return storageEntityList;
}
@Override
public List<StorageEntity> listFilesStatus(String path, String defaultPath, String tenantCode,
ResourceType type) throws AmazonServiceException {
List<StorageEntity> storageEntityList = new ArrayList<>();
ListObjectsV2Request request = new ListObjectsV2Request();
request.setBucketName(BUCKET_NAME);
request.setPrefix(path);
request.setDelimiter("/");
ListObjectsV2Result v2Result;
do {
try {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
v2Result = s3Client.listObjectsV2(request);
} catch (AmazonServiceException e) {
throw new AmazonServiceException("Get S3 file list exception, error type:" + e.getErrorType(), e);
}
List<S3ObjectSummary> summaries = v2Result.getObjectSummaries();
for (S3ObjectSummary summary : summaries) {
if (!summary.getKey().endsWith("/")) {
String[] aliasArr = summary.getKey().split("/");
String alias = aliasArr[aliasArr.length - 1];
String fileName = StringUtils.difference(defaultPath, summary.getKey());
StorageEntity entity = new StorageEntity();
entity.setAlias(alias);
entity.setFileName(fileName);
entity.setFullName(summary.getKey());
entity.setDirectory(false);
entity.setDescription("");
entity.setUserName(tenantCode);
entity.setType(type);
entity.setSize(summary.getSize());
entity.setCreateTime(summary.getLastModified());
entity.setUpdateTime(summary.getLastModified());
entity.setPfullName(path);
storageEntityList.add(entity);
}
}
for (String commonPrefix : v2Result.getCommonPrefixes()) {
String suffix = StringUtils.difference(path, commonPrefix);
String fileName = StringUtils.difference(defaultPath, commonPrefix);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
StorageEntity entity = new StorageEntity();
entity.setAlias(suffix);
entity.setFileName(fileName);
entity.setFullName(commonPrefix);
entity.setDirectory(true);
entity.setDescription("");
entity.setUserName(tenantCode);
entity.setType(type);
entity.setSize(0);
entity.setCreateTime(null);
entity.setUpdateTime(null);
entity.setPfullName(path);
storageEntityList.add(entity);
}
request.setContinuationToken(v2Result.getContinuationToken());
} while (v2Result.isTruncated());
return storageEntityList;
}
@Override
public StorageEntity getFileStatus(String path, String defaultPath, String tenantCode,
ResourceType type) throws AmazonServiceException, FileNotFoundException {
ListObjectsV2Request request = new ListObjectsV2Request();
request.setBucketName(BUCKET_NAME);
request.setPrefix(path);
request.setDelimiter("/");
ListObjectsV2Result v2Result;
try {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
v2Result = s3Client.listObjectsV2(request);
} catch (AmazonServiceException e) {
throw new AmazonServiceException("Get S3 file list exception, error type:" + e.getErrorType(), e);
}
List<S3ObjectSummary> summaries = v2Result.getObjectSummaries();
if (path.endsWith("/")) {
String alias = findDirAlias(path);
String fileName = StringUtils.difference(defaultPath, path);
StorageEntity entity = new StorageEntity();
entity.setAlias(alias);
entity.setFileName(fileName);
entity.setFullName(path);
entity.setDirectory(true);
entity.setDescription("");
entity.setUserName(tenantCode);
entity.setType(type);
entity.setSize(0);
return entity;
} else {
if (summaries.size() > 0) {
S3ObjectSummary summary = summaries.get(0);
String[] aliasArr = summary.getKey().split("/");
String alias = aliasArr[aliasArr.length - 1];
String fileName = StringUtils.difference(defaultPath, summary.getKey());
StorageEntity entity = new StorageEntity();
entity.setAlias(alias);
entity.setFileName(fileName);
entity.setFullName(summary.getKey());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,434 |
[Bug] [Resource Center] NPE when use OSS as the resource center
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
* NPE when use OSS as the resource center
<img width="830" alt="截屏2023-01-20 10 18 21" src="https://user-images.githubusercontent.com/38122586/213605577-0734f363-08d5-4422-9132-905bbcf58e8f.png">
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/38122586/213605613-32a71789-26da-4f4c-8103-70a6abe9f633.png">
### What you expected to happen
no NPE
### How to reproduce
use OSS as the resource center
### Anything else
* After the resource center is refactored in #12076
* The new methods in `StorageOperate` is not implemented in `OSS`
<img width="882" alt="image" src="https://user-images.githubusercontent.com/38122586/213605852-8b50075f-bc13-41c8-a536-cc83d3409ef6.png">
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13434
|
https://github.com/apache/dolphinscheduler/pull/13435
|
9a6f83383be4858c710679cd2e44718408e7eacd
|
8a59ab44eb415274c70122c6d8e41621362fd351
| 2023-01-20T02:35:35Z |
java
| 2023-02-07T03:55:07Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
entity.setDirectory(false);
entity.setDescription("");
entity.setUserName(tenantCode);
entity.setType(type);
entity.setSize(summary.getSize());
entity.setCreateTime(summary.getLastModified());
entity.setUpdateTime(summary.getLastModified());
return entity;
}
}
throw new FileNotFoundException("Object is not found in S3 Bucket: " + BUCKET_NAME);
}
/**
* find alias for directories, NOT for files
* a directory is a path ending with "/"
*/
private String findDirAlias(String myStr) {
if (!myStr.endsWith("/")) {
return myStr;
}
int lastIndex = myStr.lastIndexOf("/");
String subbedString = myStr.substring(0, lastIndex);
int secondLastIndex = subbedString.lastIndexOf("/");
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(myStr, secondLastIndex + 1, lastIndex + 1);
return stringBuilder.toString();
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java
|
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.api.parameters;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.task.api.enums.Direct;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo;
import org.apache.dolphinscheduler.plugin.task.api.parameters.resource.ResourceParametersHelper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
/**
* job params related class
*/
public abstract class AbstractParameters implements IParameters {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java
|
@Override
public abstract boolean checkParameters();
@Override
public List<ResourceInfo> getResourceFilesList() {
return new ArrayList<>();
}
/**
* local parameters
*/
public List<Property> localParams;
/**
* var pool
*/
public List<Property> varPool;
/**
* get local parameters list
*
* @return Property list
*/
public List<Property> getLocalParams() {
return localParams;
}
public void setLocalParams(List<Property> localParams) {
this.localParams = localParams;
}
/**
* get local parameters map
* @return parameters map
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java
|
*/
public Map<String, Property> getLocalParametersMap() {
Map<String, Property> localParametersMaps = new LinkedHashMap<>();
if (localParams != null) {
for (Property property : localParams) {
localParametersMaps.put(property.getProp(), property);
}
}
return localParametersMaps;
}
/**
* get input local parameters map if the param direct is IN
* @return parameters map
*/
public Map<String, Property> getInputLocalParametersMap() {
Map<String, Property> localParametersMaps = new LinkedHashMap<>();
if (localParams != null) {
for (Property property : localParams) {
if (property.getDirect() == null || Objects.equals(Direct.IN, property.getDirect())) {
localParametersMaps.put(property.getProp(), property);
}
}
}
return localParametersMaps;
}
/**
* get varPool map
*
* @return parameters map
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java
|
*/
public Map<String, Property> getVarPoolMap() {
Map<String, Property> varPoolMap = new LinkedHashMap<>();
if (varPool != null) {
for (Property property : varPool) {
varPoolMap.put(property.getProp(), property);
}
}
return varPoolMap;
}
public List<Property> getVarPool() {
return varPool;
}
public void setVarPool(String varPool) {
if (StringUtils.isEmpty(varPool)) {
this.varPool = new ArrayList<>();
} else {
this.varPool = JSONUtils.toList(varPool, Property.class);
}
}
public void dealOutParam(String result) {
if (CollectionUtils.isEmpty(localParams)) {
return;
}
List<Property> outProperty = getOutProperty(localParams);
if (CollectionUtils.isEmpty(outProperty)) {
return;
}
if (StringUtils.isEmpty(result)) {
outProperty.forEach(this::addPropertyToValPool);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java
|
return;
}
Map<String, String> taskResult = getMapByString(result);
if (taskResult.size() == 0) {
return;
}
for (Property info : outProperty) {
String propValue = taskResult.get(info.getProp());
if (StringUtils.isNotEmpty(propValue)) {
info.setValue(propValue);
addPropertyToValPool(info);
}
}
}
public List<Property> getOutProperty(List<Property> params) {
if (CollectionUtils.isEmpty(params)) {
return new ArrayList<>();
}
List<Property> result = new ArrayList<>();
for (Property info : params) {
if (info.getDirect() == Direct.OUT) {
result.add(info);
}
}
return result;
}
public List<Map<String, String>> getListMapByString(String json) {
List<Map<String, String>> allParams = new ArrayList<>();
ArrayNode paramsByJson = JSONUtils.parseArray(json);
for (JsonNode jsonNode : paramsByJson) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java
|
Map<String, String> param = JSONUtils.toMap(jsonNode.toString());
allParams.add(param);
}
return allParams;
}
/**
* shell's result format is key=value$VarPool$key=value$VarPool$
* @param result
* @return
*/
public static Map<String, String> getMapByString(String result) {
String[] formatResult = result.split("\\$VarPool\\$");
Map<String, String> format = new HashMap<>();
for (String info : formatResult) {
if (StringUtils.isNotEmpty(info) && info.contains("=")) {
String[] keyValue = info.split("=");
format.put(keyValue[0], keyValue[1]);
}
}
return format;
}
public ResourceParametersHelper getResources() {
return new ResourceParametersHelper();
}
private void addPropertyToValPool(Property property) {
varPool.removeIf(p -> p.getProp().equals(property.getProp()));
varPool.add(property);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.http;
import static org.apache.dolphinscheduler.plugin.task.http.HttpTaskConstants.APPLICATION_JSON;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.task.api.AbstractTask;
import org.apache.dolphinscheduler.plugin.task.api.TaskCallBack;
import org.apache.dolphinscheduler.plugin.task.api.TaskException;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParamUtils;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.Charsets;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
|
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.ParseException;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.methods.RequestBuilder;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.node.ObjectNode;
public class HttpTask extends AbstractTask {
/**
* output
*/
protected String output;
/**
* http parameters
*/
private HttpParameters httpParameters;
/**
* taskExecutionContext
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
|
private TaskExecutionContext taskExecutionContext;
/**
* constructor
*
* @param taskExecutionContext taskExecutionContext
*/
public HttpTask(TaskExecutionContext taskExecutionContext) {
super(taskExecutionContext);
this.taskExecutionContext = taskExecutionContext;
}
@Override
public void init() {
this.httpParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), HttpParameters.class);
log.info("Initialize http task params {}", JSONUtils.toPrettyJsonString(httpParameters));
if (httpParameters == null || !httpParameters.checkParameters()) {
throw new RuntimeException("http task params is not valid");
}
}
@Override
public void handle(TaskCallBack taskCallBack) throws TaskException {
long startTime = System.currentTimeMillis();
String formatTimeStamp = DateUtils.formatTimeStamp(startTime);
String statusCode = null;
String body = null;
try (
CloseableHttpClient client = createHttpClient();
CloseableHttpResponse response = sendRequest(client)) {
statusCode = String.valueOf(getStatusCode(response));
body = getResponseBody(response);
exitStatusCode = validResponse(body, statusCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
|
long costTime = System.currentTimeMillis() - startTime;
log.info(
"startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {} milliseconds, statusCode : {}, body : {}, log : {}",
formatTimeStamp, httpParameters.getUrl(),
httpParameters.getHttpMethod(), costTime, statusCode, body, output);
} catch (Exception e) {
appendMessage(e.toString());
exitStatusCode = -1;
log.error("httpUrl[" + httpParameters.getUrl() + "] connection failed:" + output, e);
throw new TaskException("Execute http task failed", e);
}
}
@Override
public void cancel() throws TaskException {
}
/**
* send request
*
* @param client client
* @return CloseableHttpResponse
* @throws IOException io exception
*/
protected CloseableHttpResponse sendRequest(CloseableHttpClient client) throws IOException {
RequestBuilder builder = createRequestBuilder();
//
Map<String, Property> paramsMap = taskExecutionContext.getPrepareParamsMap();
List<HttpProperty> httpPropertyList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(httpParameters.getHttpParams())) {
for (HttpProperty httpProperty : httpParameters.getHttpParams()) {
String jsonObject = JSONUtils.toJsonString(httpProperty);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
|
String params = ParameterUtils.convertParameterPlaceholders(jsonObject, ParamUtils.convert(paramsMap));
log.info("http request params:{}", params);
httpPropertyList.add(JSONUtils.parseObject(params, HttpProperty.class));
}
}
addRequestParams(builder, httpPropertyList);
String requestUrl =
ParameterUtils.convertParameterPlaceholders(httpParameters.getUrl(), ParamUtils.convert(paramsMap));
HttpUriRequest request = builder.setUri(requestUrl).build();
setHeaders(request, httpPropertyList);
return client.execute(request);
}
/**
* get response body
*
* @param httpResponse http response
* @return response body
* @throws ParseException parse exception
* @throws IOException io exception
*/
protected String getResponseBody(CloseableHttpResponse httpResponse) throws ParseException, IOException {
if (httpResponse == null) {
return null;
}
HttpEntity entity = httpResponse.getEntity();
if (entity == null) {
return null;
}
return EntityUtils.toString(entity, StandardCharsets.UTF_8.name());
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
|
/**
* get status code
*
* @param httpResponse http response
* @return status code
*/
protected int getStatusCode(CloseableHttpResponse httpResponse) {
return httpResponse.getStatusLine().getStatusCode();
}
/**
* valid response
*
* @param body body
* @param statusCode status code
* @return exit status code
*/
protected int validResponse(String body, String statusCode) {
int exitStatusCode = 0;
switch (httpParameters.getHttpCheckCondition()) {
case BODY_CONTAINS:
if (StringUtils.isEmpty(body) || !body.contains(httpParameters.getCondition())) {
appendMessage(httpParameters.getUrl() + " doesn contain "
+ httpParameters.getCondition());
exitStatusCode = -1;
}
break;
case BODY_NOT_CONTAINS:
if (StringUtils.isEmpty(body) || body.contains(httpParameters.getCondition())) {
appendMessage(httpParameters.getUrl() + " contains "
+ httpParameters.getCondition());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
|
exitStatusCode = -1;
}
break;
case STATUS_CODE_CUSTOM:
if (!statusCode.equals(httpParameters.getCondition())) {
appendMessage(httpParameters.getUrl() + " statuscode: " + statusCode + ", Must be: "
+ httpParameters.getCondition());
exitStatusCode = -1;
}
break;
default:
if (!"200".equals(statusCode)) {
appendMessage(httpParameters.getUrl() + " statuscode: " + statusCode + ", Must be: 200");
exitStatusCode = -1;
}
break;
}
return exitStatusCode;
}
public String getOutput() {
return output;
}
/**
* append message
*
* @param message message
*/
protected void appendMessage(String message) {
if (output == null) {
output = "";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
|
}
if (message != null && !message.trim().isEmpty()) {
output += message;
}
}
/**
* add request params
*
* @param builder buidler
* @param httpPropertyList http property list
*/
protected void addRequestParams(RequestBuilder builder, List<HttpProperty> httpPropertyList) {
if (CollectionUtils.isNotEmpty(httpPropertyList)) {
ObjectNode jsonParam = JSONUtils.createObjectNode();
for (HttpProperty property : httpPropertyList) {
if (property.getHttpParametersType() != null) {
if (property.getHttpParametersType().equals(HttpParametersType.PARAMETER)) {
builder.addParameter(property.getProp(), property.getValue());
} else if (property.getHttpParametersType().equals(HttpParametersType.BODY)) {
jsonParam.put(property.getProp(), property.getValue());
}
}
}
StringEntity postingString = new StringEntity(jsonParam.toString(), Charsets.UTF_8);
postingString.setContentEncoding(StandardCharsets.UTF_8.name());
postingString.setContentType(APPLICATION_JSON);
builder.setEntity(postingString);
}
}
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
|
* set headers
*
* @param request request
* @param httpPropertyList http property list
*/
protected void setHeaders(HttpUriRequest request, List<HttpProperty> httpPropertyList) {
if (CollectionUtils.isNotEmpty(httpPropertyList)) {
for (HttpProperty property : httpPropertyList) {
if (HttpParametersType.HEADERS.equals(property.getHttpParametersType())) {
request.addHeader(property.getProp(), property.getValue());
}
}
}
}
/**
* create http client
*
* @return CloseableHttpClient
*/
protected CloseableHttpClient createHttpClient() {
final RequestConfig requestConfig = requestConfig();
HttpClientBuilder httpClientBuilder;
httpClientBuilder = HttpClients.custom().setDefaultRequestConfig(requestConfig);
return httpClientBuilder.build();
}
/**
* request config
*
* @return RequestConfig
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
|
private RequestConfig requestConfig() {
return RequestConfig.custom().setSocketTimeout(httpParameters.getSocketTimeout())
.setConnectTimeout(httpParameters.getConnectTimeout()).build();
}
/**
* create request builder
*
* @return RequestBuilder
*/
protected RequestBuilder createRequestBuilder() {
if (httpParameters.getHttpMethod().equals(HttpMethod.GET)) {
return RequestBuilder.get();
} else if (httpParameters.getHttpMethod().equals(HttpMethod.POST)) {
return RequestBuilder.post();
} else if (httpParameters.getHttpMethod().equals(HttpMethod.HEAD)) {
return RequestBuilder.head();
} else if (httpParameters.getHttpMethod().equals(HttpMethod.PUT)) {
return RequestBuilder.put();
} else if (httpParameters.getHttpMethod().equals(HttpMethod.DELETE)) {
return RequestBuilder.delete();
} else {
return null;
}
}
@Override
public AbstractParameters getParameters() {
return this.httpParameters;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
|
package org.apache.dolphinscheduler.plugin.task.http;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_FAILURE;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_SUCCESS;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpStatus;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import okhttp3.HttpUrl;
import okhttp3.mockwebserver.Dispatcher;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* Test HttpTask
*/
@ExtendWith(MockitoExtension.class)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
|
public class HttpTaskTest {
private static final String CONTENT_TYPE = "Content-Type";
private static final String APPLICATION_JSON_VALUE = "application/json";
private static final String MOCK_DISPATCH_PATH_REQ_BODY_TO_RES_BODY = "/requestBody/to/responseBody";
private static final String MOCK_DISPATCH_PATH_REQ_PARAMS_TO_RES_BODY = "/requestParams/to/responseBody";
private final List<MockWebServer> mockWebServers = new ArrayList<>();
@AfterEach
public void after() {
mockWebServers.forEach(IOUtils::closeQuietly);
mockWebServers.clear();
}
@Test
public void testHandleCheckCodeDefaultSuccess() throws Exception {
HttpTask getHttpTask = generateHttpTask(HttpMethod.GET, HttpStatus.SC_OK);
HttpTask postHttpTask = generateHttpTask(HttpMethod.POST, HttpStatus.SC_OK);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
|
HttpTask headHttpTask = generateHttpTask(HttpMethod.HEAD, HttpStatus.SC_OK);
HttpTask putHttpTask = generateHttpTask(HttpMethod.PUT, HttpStatus.SC_OK);
HttpTask deleteHttpTask = generateHttpTask(HttpMethod.DELETE, HttpStatus.SC_OK);
getHttpTask.handle(null);
postHttpTask.handle(null);
headHttpTask.handle(null);
putHttpTask.handle(null);
deleteHttpTask.handle(null);
Assertions.assertEquals(EXIT_CODE_SUCCESS, getHttpTask.getExitStatusCode());
Assertions.assertEquals(EXIT_CODE_SUCCESS, postHttpTask.getExitStatusCode());
Assertions.assertEquals(EXIT_CODE_SUCCESS, headHttpTask.getExitStatusCode());
Assertions.assertEquals(EXIT_CODE_SUCCESS, putHttpTask.getExitStatusCode());
Assertions.assertEquals(EXIT_CODE_SUCCESS, deleteHttpTask.getExitStatusCode());
}
@Test
public void testHandleCheckCodeDefaultError() throws Exception {
HttpTask getHttpTask = generateHttpTask(HttpMethod.GET, HttpStatus.SC_BAD_REQUEST);
getHttpTask.handle(null);
Assertions.assertEquals(EXIT_CODE_FAILURE, getHttpTask.getExitStatusCode());
}
@Test
public void testHandleCheckCodeCustom() throws Exception {
String condition = HttpStatus.SC_CREATED + "";
HttpTask httpTask = generateHttpTask(HttpMethod.GET, HttpCheckCondition.STATUS_CODE_CUSTOM,
condition, HttpStatus.SC_CREATED, "");
HttpTask httpErrorTask = generateHttpTask(HttpMethod.GET, HttpCheckCondition.STATUS_CODE_CUSTOM,
condition, HttpStatus.SC_OK, "");
httpTask.handle(null);
httpErrorTask.handle(null);
Assertions.assertEquals(EXIT_CODE_SUCCESS, httpTask.getExitStatusCode());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
|
Assertions.assertEquals(EXIT_CODE_FAILURE, httpErrorTask.getExitStatusCode());
}
@Test
public void testHandleCheckBodyContains() throws Exception {
HttpTask httpTask = generateHttpTask(HttpMethod.GET, HttpCheckCondition.BODY_CONTAINS,
"success", HttpStatus.SC_OK, "{\"status\": \"success\"}");
HttpTask httpErrorTask = generateHttpTask(HttpMethod.GET, HttpCheckCondition.BODY_CONTAINS,
"success", HttpStatus.SC_OK, "{\"status\": \"failed\"}");
httpTask.handle(null);
httpErrorTask.handle(null);
Assertions.assertEquals(EXIT_CODE_SUCCESS, httpTask.getExitStatusCode());
Assertions.assertEquals(EXIT_CODE_FAILURE, httpErrorTask.getExitStatusCode());
}
@Test
public void testHandleCheckBodyNotContains() throws Exception {
HttpTask httpTask = generateHttpTask(HttpMethod.GET, HttpCheckCondition.BODY_NOT_CONTAINS,
"failed", HttpStatus.SC_OK, "{\"status\": \"success\"}");
HttpTask httpErrorTask = generateHttpTask(HttpMethod.GET, HttpCheckCondition.BODY_NOT_CONTAINS,
"failed", HttpStatus.SC_OK, "{\"status\": \"failed\"}");
httpTask.handle(null);
httpErrorTask.handle(null);
Assertions.assertEquals(EXIT_CODE_SUCCESS, httpTask.getExitStatusCode());
Assertions.assertEquals(EXIT_CODE_FAILURE, httpErrorTask.getExitStatusCode());
}
@Test
public void testHandleWithHttpBodyParams() throws Exception {
List<HttpProperty> httpParams = new ArrayList<>();
HttpProperty property = new HttpProperty();
property.setProp("day");
property.setValue("${day}");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
|
property.setHttpParametersType(HttpParametersType.BODY);
httpParams.add(property);
Map<String, String> prepareParamsMap = new HashMap<>();
prepareParamsMap.put("day", "20220812");
HttpTask httpTask = generateHttpTask(MOCK_DISPATCH_PATH_REQ_BODY_TO_RES_BODY, HttpMethod.POST,
httpParams, prepareParamsMap, HttpCheckCondition.BODY_CONTAINS, "20220812",
HttpStatus.SC_OK, "");
httpTask.handle(null);
Assertions.assertEquals(EXIT_CODE_SUCCESS, httpTask.getExitStatusCode());
}
@Test
public void testHandleWithHttpParameterParams() throws Exception {
List<HttpProperty> httpParams = new ArrayList<>();
HttpProperty property = new HttpProperty();
property.setProp("day");
property.setValue("${day}");
property.setHttpParametersType(HttpParametersType.PARAMETER);
httpParams.add(property);
Map<String, String> prepareParamsMap = new HashMap<>();
prepareParamsMap.put("day", "20220812");
HttpTask httpTask = generateHttpTask(MOCK_DISPATCH_PATH_REQ_PARAMS_TO_RES_BODY, HttpMethod.POST,
httpParams, prepareParamsMap, HttpCheckCondition.BODY_CONTAINS, "20220812",
HttpStatus.SC_OK, "");
httpTask.handle(null);
Assertions.assertEquals(EXIT_CODE_SUCCESS, httpTask.getExitStatusCode());
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
|
private String withMockWebServer(String path, int actualResponseCode,
String actualResponseBody) throws IOException {
MockWebServer server = new MockWebServer();
mockWebServers.add(server);
server.start();
server.setDispatcher(generateMockDispatcher(path, actualResponseCode, actualResponseBody));
return server.url(path).toString();
}
private HttpTask generateHttpTask(HttpMethod httpMethod, int actualResponseCode) throws IOException {
return generateHttpTask("/test", httpMethod, null, null,
HttpCheckCondition.STATUS_CODE_DEFAULT, "", actualResponseCode, "");
}
private HttpTask generateHttpTask(HttpMethod httpMethod, HttpCheckCondition httpCheckConditionType,
String condition, int actualResponseCode,
String actualResponseBody) throws IOException {
return generateHttpTask("/test", httpMethod, null, null,
httpCheckConditionType, condition, actualResponseCode, actualResponseBody);
}
private HttpTask generateHttpTask(String mockPath, HttpMethod httpMethod, List<HttpProperty> httpParams,
Map<String, String> prepareParamsMap, HttpCheckCondition httpCheckConditionType,
String condition, int actualResponseCode,
String actualResponseBody) throws IOException {
String url = withMockWebServer(mockPath, actualResponseCode, actualResponseBody);
String paramData = generateHttpParameters(url, httpMethod, httpParams, httpCheckConditionType, condition);
return generateHttpTaskFromParamData(paramData, prepareParamsMap);
}
private HttpTask generateHttpTaskFromParamData(String paramData, Map<String, String> prepareParamsMap) {
TaskExecutionContext taskExecutionContext = Mockito.mock(TaskExecutionContext.class);
Mockito.when(taskExecutionContext.getTaskParams()).thenReturn(paramData);
if (prepareParamsMap != null) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
|
Map<String, Property> propertyParamsMap = new HashMap<>();
prepareParamsMap.forEach((k, v) -> {
Property property = new Property();
property.setProp(k);
property.setValue(v);
propertyParamsMap.put(k, property);
});
Mockito.when(taskExecutionContext.getPrepareParamsMap()).thenReturn(propertyParamsMap);
}
HttpTask httpTask = new HttpTask(taskExecutionContext);
httpTask.init();
return httpTask;
}
private String generateHttpParameters(String url, HttpMethod httpMethod, List<HttpProperty> httpParams,
HttpCheckCondition httpCheckConditionType,
String condition) throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
HttpParameters httpParameters = new HttpParameters();
httpParameters.setUrl(url);
httpParameters.setHttpMethod(httpMethod);
httpParameters.setHttpCheckCondition(httpCheckConditionType);
httpParameters.setCondition(condition);
httpParameters.setConnectTimeout(10000);
httpParameters.setSocketTimeout(10000);
httpParameters.setHttpParams(httpParams);
return mapper.writeValueAsString(httpParameters);
}
private Dispatcher generateMockDispatcher(String path, int actualResponseCode, String actualResponseBody) {
return new Dispatcher() {
@Override
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
|
public MockResponse dispatch(RecordedRequest request) {
MockResponse mockResponse = new MockResponse()
.setResponseCode(actualResponseCode)
.setHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE);
if (request.getPath().startsWith(MOCK_DISPATCH_PATH_REQ_BODY_TO_RES_BODY)) {
mockResponse.setBody(request.getBody().readUtf8());
} else if (request.getPath().startsWith(MOCK_DISPATCH_PATH_REQ_PARAMS_TO_RES_BODY)) {
ObjectMapper mapper = new ObjectMapper();
HttpUrl httpUrl = request.getRequestUrl();
Set<String> parameterNames = httpUrl.queryParameterNames();
Map<String, String> resBodyMap = new HashMap<>();
parameterNames.forEach(name -> resBodyMap.put(name, httpUrl.queryParameter(name)));
try {
mockResponse.setBody(mapper.writeValueAsString(resBodyMap));
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e);
}
} else if (request.getPath().startsWith(path)) {
mockResponse.setBody(actualResponseBody);
} else {
mockResponse.setResponseCode(HttpStatus.SC_NOT_FOUND);
}
return mockResponse;
}
};
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/test/java/org/apache/dolphinscheduler/plugin/task/sqoop/EntityTestUtils.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.sqoop;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* entity test utils
*/
public class EntityTestUtils {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/test/java/org/apache/dolphinscheduler/plugin/task/sqoop/EntityTestUtils.java
|
private static final Map<String, Object> OBJECT_MAP = new HashMap<>();
private static final String SKIP_METHOD = "getClass,notify,notifyAll,wait,equals,hashCode,clone";
static {
OBJECT_MAP.put("java.lang.Long", 1L);
OBJECT_MAP.put("java.lang.String",
"[{\"direct\":\"OUT\",\"prop\":\"percentage5\",\"type\":\"VARCHAR\",\"value\":\"qwe\"}]");
OBJECT_MAP.put("java.lang.Integer", 1);
OBJECT_MAP.put("int", 1);
OBJECT_MAP.put("long", 1L);
OBJECT_MAP.put("java.util.Date", new Date());
OBJECT_MAP.put("char", '1');
OBJECT_MAP.put("java.util.Map", new HashMap());
OBJECT_MAP.put("boolean", true);
}
public static void run(List<Class> classList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
for (Class temp : classList) {
Object tempInstance = new Object();
Constructor[] constructors = temp.getConstructors();
for (Constructor constructor : constructors) {
final Class<?>[] parameterTypes = constructor.getParameterTypes();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,528 |
[Improvement][Task Plugin] Support Task Plugin output response as a parameter
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="997" alt="image" src="https://user-images.githubusercontent.com/31528124/217196099-efdff331-2eab-4498-8f71-a77433ddad50.png">
The downstream task **shell**
<img width="702" alt="image" src="https://user-images.githubusercontent.com/31528124/217196330-9903bcaf-c554-4183-924b-ae14a40e4104.png">
The downstream task **python**
<img width="720" alt="image" src="https://user-images.githubusercontent.com/31528124/217196378-bf9c7365-3451-43b4-b575-8f5f298d29d3.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13528
|
https://github.com/apache/dolphinscheduler/pull/13529
|
f3134c7ce7fffe775a6ea3ab74c296ece6b51545
|
16b193454b7519df712c6012eec776c90375198f
| 2023-02-07T08:49:59Z |
java
| 2023-02-08T15:03:21Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/test/java/org/apache/dolphinscheduler/plugin/task/sqoop/EntityTestUtils.java
|
if (parameterTypes.length == 0) {
tempInstance = constructor.newInstance();
} else {
Object[] objects = new Object[parameterTypes.length];
for (int i = 0; i < parameterTypes.length; i++) {
objects[i] = OBJECT_MAP.get(parameterTypes[i].getName());
}
tempInstance = constructor.newInstance(objects);
}
}
Method[] methods = temp.getMethods();
for (final Method method : methods) {
if (SKIP_METHOD.contains(method.getName())) {
break;
}
final Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length != 0) {
Object[] objects = new Object[parameterTypes.length];
for (int i = 0; i < parameterTypes.length; i++) {
objects[i] = OBJECT_MAP.get(parameterTypes[i].getName());
}
method.invoke(tempInstance, objects);
} else {
method.invoke(tempInstance);
}
}
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,045 |
[Improvement][Master] add max submit times of workflow
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
when submit workflow failure , will resubmit workflow . if have not maximum number of submissions,will cause print a lot log which takes up a lot of resources
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13045
|
https://github.com/apache/dolphinscheduler/pull/13051
|
e8b20def544a203bb9c927e19dae531b6f98d512
|
701d67c831227ae71d0ce903fe814f37548319c9
| 2022-11-29T12:32:59Z |
java
| 2023-02-20T06:10:59Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/StateEventType.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,045 |
[Improvement][Master] add max submit times of workflow
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
when submit workflow failure , will resubmit workflow . if have not maximum number of submissions,will cause print a lot log which takes up a lot of resources
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13045
|
https://github.com/apache/dolphinscheduler/pull/13051
|
e8b20def544a203bb9c927e19dae531b6f98d512
|
701d67c831227ae71d0ce903fe814f37548319c9
| 2022-11-29T12:32:59Z |
java
| 2023-02-20T06:10:59Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/StateEventType.java
|
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
public enum StateEventType {
PROCESS_STATE_CHANGE(0, "process state change"),
TASK_STATE_CHANGE(1, "task state change"),
PROCESS_TIMEOUT(2, "process timeout"),
TASK_TIMEOUT(3, "task timeout"),
WAKE_UP_TASK_GROUP(4, "wait task group"),
TASK_RETRY(5, "task retry"),
PROCESS_BLOCKED(6, "process blocked");
StateEventType(int code, String descp) {
this.code = code;
this.descp = descp;
}
@EnumValue
private final int code;
private final String descp;
public int getCode() {
return code;
}
public String getDescp() {
return descp;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,045 |
[Improvement][Master] add max submit times of workflow
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
when submit workflow failure , will resubmit workflow . if have not maximum number of submissions,will cause print a lot log which takes up a lot of resources
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13045
|
https://github.com/apache/dolphinscheduler/pull/13051
|
e8b20def544a203bb9c927e19dae531b6f98d512
|
701d67c831227ae71d0ce903fe814f37548319c9
| 2022-11-29T12:32:59Z |
java
| 2023-02-20T06:10:59Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/event/WorkflowStartEventHandler.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.event;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager;
import org.apache.dolphinscheduler.server.master.metrics.ProcessInstanceMetrics;
import org.apache.dolphinscheduler.server.master.runner.StateWheelExecuteThread;
import org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteRunnable;
import org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThreadPool;
import org.apache.dolphinscheduler.server.master.runner.WorkflowSubmitStatue;
import java.util.concurrent.CompletableFuture;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,045 |
[Improvement][Master] add max submit times of workflow
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
when submit workflow failure , will resubmit workflow . if have not maximum number of submissions,will cause print a lot log which takes up a lot of resources
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13045
|
https://github.com/apache/dolphinscheduler/pull/13051
|
e8b20def544a203bb9c927e19dae531b6f98d512
|
701d67c831227ae71d0ce903fe814f37548319c9
| 2022-11-29T12:32:59Z |
java
| 2023-02-20T06:10:59Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/event/WorkflowStartEventHandler.java
|
@Slf4j
public class WorkflowStartEventHandler implements WorkflowEventHandler {
@Autowired
private ProcessInstanceExecCacheManager processInstanceExecCacheManager;
@Autowired
private StateWheelExecuteThread stateWheelExecuteThread;
@Autowired
private WorkflowExecuteThreadPool workflowExecuteThreadPool;
@Autowired
private WorkflowEventQueue workflowEventQueue;
@Override
public void handleWorkflowEvent(final WorkflowEvent workflowEvent) throws WorkflowEventHandleError {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,045 |
[Improvement][Master] add max submit times of workflow
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
when submit workflow failure , will resubmit workflow . if have not maximum number of submissions,will cause print a lot log which takes up a lot of resources
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13045
|
https://github.com/apache/dolphinscheduler/pull/13051
|
e8b20def544a203bb9c927e19dae531b6f98d512
|
701d67c831227ae71d0ce903fe814f37548319c9
| 2022-11-29T12:32:59Z |
java
| 2023-02-20T06:10:59Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/event/WorkflowStartEventHandler.java
|
log.info("Handle workflow start event, begin to start a workflow, event: {}", workflowEvent);
WorkflowExecuteRunnable workflowExecuteRunnable = processInstanceExecCacheManager.getByProcessInstanceId(
workflowEvent.getWorkflowInstanceId());
if (workflowExecuteRunnable == null) {
throw new WorkflowEventHandleError(
"The workflow start event is invalid, cannot find the workflow instance from cache");
}
ProcessInstanceMetrics.incProcessInstanceByState("submit");
ProcessInstance processInstance = workflowExecuteRunnable.getProcessInstance();
CompletableFuture.supplyAsync(workflowExecuteRunnable::call, workflowExecuteThreadPool)
.thenAccept(workflowSubmitStatue -> {
if (WorkflowSubmitStatue.SUCCESS == workflowSubmitStatue) {
log.info("Success submit the workflow instance");
if (processInstance.getTimeout() > 0) {
stateWheelExecuteThread.addProcess4TimeoutCheck(processInstance);
}
} else {
log.error("Failed to submit the workflow instance, will resend the workflow start event: {}",
workflowEvent);
workflowEventQueue.addEvent(workflowEvent);
}
});
}
@Override
public WorkflowEventType getHandleWorkflowEventType() {
return WorkflowEventType.START_WORKFLOW;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,045 |
[Improvement][Master] add max submit times of workflow
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
when submit workflow failure , will resubmit workflow . if have not maximum number of submissions,will cause print a lot log which takes up a lot of resources
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13045
|
https://github.com/apache/dolphinscheduler/pull/13051
|
e8b20def544a203bb9c927e19dae531b6f98d512
|
701d67c831227ae71d0ce903fe814f37548319c9
| 2022-11-29T12:32:59Z |
java
| 2023-02-20T06:10:59Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/event/WorkflowStateEventHandler.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.event;
import org.apache.dolphinscheduler.common.enums.StateEventType;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.server.master.metrics.ProcessInstanceMetrics;
import org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteRunnable;
import lombok.extern.slf4j.Slf4j;
import com.google.auto.service.AutoService;
@AutoService(StateEventHandler.class)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,045 |
[Improvement][Master] add max submit times of workflow
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
when submit workflow failure , will resubmit workflow . if have not maximum number of submissions,will cause print a lot log which takes up a lot of resources
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13045
|
https://github.com/apache/dolphinscheduler/pull/13051
|
e8b20def544a203bb9c927e19dae531b6f98d512
|
701d67c831227ae71d0ce903fe814f37548319c9
| 2022-11-29T12:32:59Z |
java
| 2023-02-20T06:10:59Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/event/WorkflowStateEventHandler.java
|
@Slf4j
public class WorkflowStateEventHandler implements StateEventHandler {
@Override
public boolean handleStateEvent(WorkflowExecuteRunnable workflowExecuteRunnable,
StateEvent stateEvent) throws StateEventHandleException {
WorkflowStateEvent workflowStateEvent = (WorkflowStateEvent) stateEvent;
measureProcessState(workflowStateEvent);
ProcessInstance processInstance = workflowExecuteRunnable.getProcessInstance();
ProcessDefinition processDefinition = processInstance.getProcessDefinition();
log.info(
"Handle workflow instance state event, the current workflow instance state {} will be changed to {}",
processInstance.getState(), workflowStateEvent.getStatus());
if (workflowStateEvent.getStatus().isStop()) {
if (processDefinition.getExecutionType().typeIsSerialWait() || processDefinition.getExecutionType()
.typeIsSerialPriority()) {
workflowExecuteRunnable.endProcess();
return true;
}
workflowExecuteRunnable.updateProcessInstanceState(workflowStateEvent);
return true;
}
if (workflowExecuteRunnable.processComplementData()) {
return true;
}
if (workflowStateEvent.getStatus().isFinished()) {
workflowExecuteRunnable.endProcess();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,045 |
[Improvement][Master] add max submit times of workflow
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
when submit workflow failure , will resubmit workflow . if have not maximum number of submissions,will cause print a lot log which takes up a lot of resources
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13045
|
https://github.com/apache/dolphinscheduler/pull/13051
|
e8b20def544a203bb9c927e19dae531b6f98d512
|
701d67c831227ae71d0ce903fe814f37548319c9
| 2022-11-29T12:32:59Z |
java
| 2023-02-20T06:10:59Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/event/WorkflowStateEventHandler.java
|
}
if (processInstance.getState().isReadyStop()) {
workflowExecuteRunnable.killAllTasks();
}
return true;
}
@Override
public StateEventType getEventType() {
return StateEventType.PROCESS_STATE_CHANGE;
}
private void measureProcessState(WorkflowStateEvent processStateEvent) {
if (processStateEvent.getStatus().isFinished()) {
ProcessInstanceMetrics.incProcessInstanceByState("finish");
}
switch (processStateEvent.getStatus()) {
case STOP:
ProcessInstanceMetrics.incProcessInstanceByState("stop");
break;
case SUCCESS:
ProcessInstanceMetrics.incProcessInstanceByState("success");
break;
case FAILURE:
ProcessInstanceMetrics.incProcessInstanceByState("fail");
break;
default:
break;
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,603 |
[Bug] [DATAX] SQLServer not support special field
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
use ``` "" ``` instead of ``` ` ```
### How to reproduce
ATT
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13603
|
https://github.com/apache/dolphinscheduler/pull/13604
|
7bf3e3cdd66a68ac8d155b08fbd70365aa3a306b
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
| 2023-02-22T09:48:39Z |
java
| 2023-02-22T11:01:43Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.datax;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.alibaba.druid.sql.dialect.clickhouse.parser.ClickhouseStatementParser;
import com.alibaba.druid.sql.dialect.hive.parser.HiveStatementParser;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser;
import com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser;
import com.alibaba.druid.sql.dialect.presto.parser.PrestoStatementParser;
import com.alibaba.druid.sql.dialect.sqlserver.parser.SQLServerStatementParser;
import com.alibaba.druid.sql.parser.SQLStatementParser;
public class DataxUtils {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,603 |
[Bug] [DATAX] SQLServer not support special field
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
use ``` "" ``` instead of ``` ` ```
### How to reproduce
ATT
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13603
|
https://github.com/apache/dolphinscheduler/pull/13604
|
7bf3e3cdd66a68ac8d155b08fbd70365aa3a306b
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
| 2023-02-22T09:48:39Z |
java
| 2023-02-22T11:01:43Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java
|
public static final String DATAX_READER_PLUGIN_MYSQL = "mysqlreader";
public static final String DATAX_READER_PLUGIN_POSTGRESQL = "postgresqlreader";
public static final String DATAX_READER_PLUGIN_ORACLE = "oraclereader";
public static final String DATAX_READER_PLUGIN_SQLSERVER = "sqlserverreader";
public static final String DATAX_READER_PLUGIN_CLICKHOUSE = "clickhousereader";
public static final String DATAX_READER_PLUGIN_RDBMS = "rdbmsreader";
public static final String DATAX_WRITER_PLUGIN_MYSQL = "mysqlwriter";
public static final String DATAX_WRITER_PLUGIN_POSTGRESQL = "postgresqlwriter";
public static final String DATAX_WRITER_PLUGIN_ORACLE = "oraclewriter";
public static final String DATAX_WRITER_PLUGIN_SQLSERVER = "sqlserverwriter";
public static final String DATAX_WRITER_PLUGIN_CLICKHOUSE = "clickhousewriter";
public static final String DATAX_WRITER_PLUGIN_RDBMS = "rdbmswriter";
public static String getReaderPluginName(DbType dbType) {
switch (dbType) {
case MYSQL:
return DATAX_READER_PLUGIN_MYSQL;
case POSTGRESQL:
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,603 |
[Bug] [DATAX] SQLServer not support special field
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
use ``` "" ``` instead of ``` ` ```
### How to reproduce
ATT
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13603
|
https://github.com/apache/dolphinscheduler/pull/13604
|
7bf3e3cdd66a68ac8d155b08fbd70365aa3a306b
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
| 2023-02-22T09:48:39Z |
java
| 2023-02-22T11:01:43Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java
|
return DATAX_READER_PLUGIN_POSTGRESQL;
case ORACLE:
return DATAX_READER_PLUGIN_ORACLE;
case SQLSERVER:
return DATAX_READER_PLUGIN_SQLSERVER;
case CLICKHOUSE:
return DATAX_READER_PLUGIN_CLICKHOUSE;
case HIVE:
return DATAX_READER_PLUGIN_RDBMS;
case PRESTO:
return DATAX_READER_PLUGIN_RDBMS;
default:
return null;
}
}
public static String getWriterPluginName(DbType dbType) {
switch (dbType) {
case MYSQL:
return DATAX_WRITER_PLUGIN_MYSQL;
case POSTGRESQL:
return DATAX_WRITER_PLUGIN_POSTGRESQL;
case ORACLE:
return DATAX_WRITER_PLUGIN_ORACLE;
case SQLSERVER:
return DATAX_WRITER_PLUGIN_SQLSERVER;
case CLICKHOUSE:
return DATAX_WRITER_PLUGIN_CLICKHOUSE;
case HIVE:
return DATAX_WRITER_PLUGIN_RDBMS;
case PRESTO:
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,603 |
[Bug] [DATAX] SQLServer not support special field
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
use ``` "" ``` instead of ``` ` ```
### How to reproduce
ATT
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13603
|
https://github.com/apache/dolphinscheduler/pull/13604
|
7bf3e3cdd66a68ac8d155b08fbd70365aa3a306b
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
| 2023-02-22T09:48:39Z |
java
| 2023-02-22T11:01:43Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java
|
return DATAX_WRITER_PLUGIN_RDBMS;
default:
return null;
}
}
public static SQLStatementParser getSqlStatementParser(DbType dbType, String sql) {
switch (dbType) {
case MYSQL:
return new MySqlStatementParser(sql);
case POSTGRESQL:
return new PGSQLStatementParser(sql);
case ORACLE:
return new OracleStatementParser(sql);
case SQLSERVER:
return new SQLServerStatementParser(sql);
case CLICKHOUSE:
return new ClickhouseStatementParser(sql);
case HIVE:
return new HiveStatementParser(sql);
case PRESTO:
return new PrestoStatementParser(sql);
default:
return null;
}
}
public static String[] convertKeywordsColumns(DbType dbType, String[] columns) {
if (columns == null) {
return null;
}
String[] toColumns = new String[columns.length];
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,603 |
[Bug] [DATAX] SQLServer not support special field
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
use ``` "" ``` instead of ``` ` ```
### How to reproduce
ATT
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13603
|
https://github.com/apache/dolphinscheduler/pull/13604
|
7bf3e3cdd66a68ac8d155b08fbd70365aa3a306b
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
| 2023-02-22T09:48:39Z |
java
| 2023-02-22T11:01:43Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java
|
for (int i = 0; i < columns.length; i++) {
toColumns[i] = doConvertKeywordsColumn(dbType, columns[i]);
}
return toColumns;
}
public static String doConvertKeywordsColumn(DbType dbType, String column) {
if (column == null) {
return column;
}
column = column.trim();
column = column.replace("`", "");
column = column.replace("\"", "");
column = column.replace("'", "");
switch (dbType) {
case MYSQL:
return String.format("`%s`", column);
case POSTGRESQL:
return String.format("\"%s\"", column);
case ORACLE:
return String.format("\"%s\"", column);
case SQLSERVER:
return String.format("`%s`", column);
case CLICKHOUSE:
return String.format("`%s`", column);
default:
return column;
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.storage.s3;
import static org.apache.dolphinscheduler.common.constants.Constants.AWS_END_POINT;
import static org.apache.dolphinscheduler.common.constants.Constants.FOLDER_SEPARATOR;
import static org.apache.dolphinscheduler.common.constants.Constants.FORMAT_S_S;
import static org.apache.dolphinscheduler.common.constants.Constants.RESOURCE_TYPE_FILE;
import static org.apache.dolphinscheduler.common.constants.Constants.RESOURCE_TYPE_UDF;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.ResUploadType;
import org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.plugin.storage.api.StorageEntity;
import org.apache.dolphinscheduler.plugin.storage.api.StorageOperate;
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import org.apache.commons.lang3.StringUtils;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.extern.slf4j.Slf4j;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.AmazonS3Exception;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.DeleteObjectsRequest;
import com.amazonaws.services.s3.model.ListObjectsV2Request;
import com.amazonaws.services.s3.model.ListObjectsV2Result;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectRequest;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectInputStream;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.amazonaws.services.s3.transfer.MultipleFileDownload;
import com.amazonaws.services.s3.transfer.TransferManager;
import com.amazonaws.services.s3.transfer.TransferManagerBuilder;
import com.google.common.base.Joiner;
@Slf4j
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
public class S3StorageOperator implements Closeable, StorageOperate {
private static final String ACCESS_KEY_ID = PropertyUtils.getString(TaskConstants.AWS_ACCESS_KEY_ID);
private static final String SECRET_KEY_ID = PropertyUtils.getString(TaskConstants.AWS_SECRET_ACCESS_KEY);
private static final String REGION = PropertyUtils.getString(TaskConstants.AWS_REGION);
private static final String BUCKET_NAME = PropertyUtils.getString(Constants.AWS_S3_BUCKET_NAME);
private final AmazonS3 s3Client;
public S3StorageOperator() {
if (!StringUtils.isEmpty(PropertyUtils.getString(AWS_END_POINT))) {
s3Client = AmazonS3ClientBuilder
.standard()
.withPathStyleAccessEnabled(true)
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(
PropertyUtils.getString(AWS_END_POINT), Regions.fromName(REGION).getName()))
.withCredentials(
new AWSStaticCredentialsProvider(new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_KEY_ID)))
.build();
} else {
s3Client = AmazonS3ClientBuilder
.standard()
.withCredentials(
new AWSStaticCredentialsProvider(new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_KEY_ID)))
.withRegion(Regions.fromName(REGION))
.build();
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
checkBucketNameExists(BUCKET_NAME);
}
@Override
public void close() throws IOException {
s3Client.shutdown();
}
@Override
public void createTenantDirIfNotExists(String tenantCode) throws Exception {
mkdir(tenantCode, getS3ResDir(tenantCode));
mkdir(tenantCode, getS3UdfDir(tenantCode));
}
@Override
public String getResDir(String tenantCode) {
return getS3ResDir(tenantCode) + FOLDER_SEPARATOR;
}
@Override
public String getUdfDir(String tenantCode) {
return getS3UdfDir(tenantCode) + FOLDER_SEPARATOR;
}
@Override
public boolean mkdir(String tenantCode, String path) throws IOException {
String objectName = path + FOLDER_SEPARATOR;
if (!s3Client.doesObjectExist(BUCKET_NAME, objectName)) {
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(0);
InputStream emptyContent = new ByteArrayInputStream(new byte[0]);
PutObjectRequest putObjectRequest = new PutObjectRequest(BUCKET_NAME, objectName, emptyContent, metadata);
s3Client.putObject(putObjectRequest);
}
return true;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
}
@Override
public String getResourceFileName(String tenantCode, String fileName) {
if (fileName.startsWith(FOLDER_SEPARATOR)) {
fileName = fileName.replaceFirst(FOLDER_SEPARATOR, "");
}
return String.format(FORMAT_S_S, getS3ResDir(tenantCode), fileName);
}
@Override
public String getResourceFileName(String fullName) {
String resourceUploadPath =
RESOURCE_UPLOAD_PATH.endsWith(FOLDER_SEPARATOR) ? StringUtils.chop(RESOURCE_UPLOAD_PATH)
: RESOURCE_UPLOAD_PATH;
String pathContainingTenantNResource = fullName.substring(
fullName.indexOf(resourceUploadPath)
+ resourceUploadPath.length() + 1);
String[] fileNameArr = pathContainingTenantNResource.split(FOLDER_SEPARATOR);
return Joiner.on(FOLDER_SEPARATOR).join(Arrays.stream(fileNameArr).skip(2).collect(Collectors.toList()));
}
@Override
public String getFileName(ResourceType resourceType, String tenantCode, String fileName) {
if (fileName.startsWith(FOLDER_SEPARATOR)) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
fileName = fileName.replaceFirst(FOLDER_SEPARATOR, "");
}
return getDir(resourceType, tenantCode) + fileName;
}
@Override
public void download(String tenantCode, String srcFilePath, String dstFilePath, boolean deleteSource,
boolean overwrite) throws IOException {
File dstFile = new File(dstFilePath);
if (dstFile.isDirectory()) {
Files.delete(dstFile.toPath());
} else {
Files.createDirectories(dstFile.getParentFile().toPath());
}
S3Object o = s3Client.getObject(BUCKET_NAME, srcFilePath);
try (
S3ObjectInputStream s3is = o.getObjectContent();
FileOutputStream fos = new FileOutputStream(dstFilePath)) {
byte[] readBuf = new byte[1024];
int readLen;
while ((readLen = s3is.read(readBuf)) > 0) {
fos.write(readBuf, 0, readLen);
}
} catch (AmazonServiceException e) {
throw new IOException(e.getMessage());
} catch (FileNotFoundException e) {
log.error("the destination file {} not found", dstFilePath);
throw e;
}
}
@Override
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
public boolean exists(String fullName) throws IOException {
return s3Client.doesObjectExist(BUCKET_NAME, fullName);
}
@Override
public boolean delete(String fullName, boolean recursive) throws IOException {
try {
s3Client.deleteObject(BUCKET_NAME, fullName);
return true;
} catch (AmazonServiceException e) {
log.error("delete the object error,the resource path is {}", fullName);
return false;
}
}
@Override
public boolean delete(String fullName, List<String> childrenPathList, boolean recursive) throws IOException {
childrenPathList.add(fullName);
DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(BUCKET_NAME)
.withKeys(childrenPathList.stream().toArray(String[]::new));
try {
s3Client.deleteObjects(deleteObjectsRequest);
} catch (AmazonServiceException e) {
log.error("delete objects error", e);
return false;
}
return true;
}
@Override
public boolean copy(String srcPath, String dstPath, boolean deleteSource, boolean overwrite) throws IOException {
s3Client.copyObject(BUCKET_NAME, srcPath, BUCKET_NAME, dstPath);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
s3Client.deleteObject(BUCKET_NAME, srcPath);
return true;
}
@Override
public String getDir(ResourceType resourceType, String tenantCode) {
switch (resourceType) {
case UDF:
return getUdfDir(tenantCode);
case FILE:
return getResDir(tenantCode);
default:
return "";
}
}
@Override
public boolean upload(String tenantCode, String srcFile, String dstPath, boolean deleteSource,
boolean overwrite) throws IOException {
try {
s3Client.putObject(BUCKET_NAME, dstPath, new File(srcFile));
return true;
} catch (AmazonServiceException e) {
log.error("upload failed,the bucketName is {},the filePath is {}", BUCKET_NAME, dstPath);
return false;
}
}
@Override
public List<String> vimFile(String tenantCode, String filePath, int skipLineNums, int limit) throws IOException {
if (StringUtils.isBlank(filePath)) {
log.error("file path:{} is blank", filePath);
return Collections.emptyList();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
}
S3Object s3Object = s3Client.getObject(BUCKET_NAME, filePath);
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(s3Object.getObjectContent()))) {
Stream<String> stream = bufferedReader.lines().skip(skipLineNums).limit(limit);
return stream.collect(Collectors.toList());
}
}
@Override
public void deleteTenant(String tenantCode) throws Exception {
deleteTenantCode(tenantCode);
}
/**
* S3 resource dir
*
* @param tenantCode tenant code
* @return S3 resource dir
*/
public static String getS3ResDir(String tenantCode) {
return String.format("%s/" + RESOURCE_TYPE_FILE, getS3TenantDir(tenantCode));
}
/**
* S3 udf dir
*
* @param tenantCode tenant code
* @return get udf dir on S3
*/
public static String getS3UdfDir(String tenantCode) {
return String.format("%s/" + RESOURCE_TYPE_UDF, getS3TenantDir(tenantCode));
}
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
* @param tenantCode tenant code
* @return file directory of tenants on S3
*/
public static String getS3TenantDir(String tenantCode) {
return String.format(FORMAT_S_S, getS3DataBasePath(), tenantCode);
}
/**
* get data S3 path
*
* @return data S3 path
*/
public static String getS3DataBasePath() {
if (FOLDER_SEPARATOR.equals(RESOURCE_UPLOAD_PATH)) {
return "";
} else {
return RESOURCE_UPLOAD_PATH.replaceFirst(FOLDER_SEPARATOR, "");
}
}
private void deleteTenantCode(String tenantCode) {
deleteDirectory(getResDir(tenantCode));
deleteDirectory(getUdfDir(tenantCode));
}
/**
* xxx untest
* upload local directory to S3
*
* @param tenantCode
* @param keyPrefix the name of directory
* @param strPath
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
private void uploadDirectory(String tenantCode, String keyPrefix, String strPath) {
s3Client.putObject(BUCKET_NAME, tenantCode + FOLDER_SEPARATOR + keyPrefix, new File(strPath));
}
/**
* xxx untest
* download S3 Directory to local
*
* @param tenantCode
* @param keyPrefix the name of directory
* @param srcPath
*/
private void downloadDirectory(String tenantCode, String keyPrefix, String srcPath) {
TransferManager tm = TransferManagerBuilder.standard().withS3Client(s3Client).build();
try {
MultipleFileDownload download =
tm.downloadDirectory(BUCKET_NAME, tenantCode + FOLDER_SEPARATOR + keyPrefix, new File(srcPath));
download.waitForCompletion();
} catch (AmazonS3Exception | InterruptedException e) {
log.error("download the directory failed with the bucketName is {} and the keyPrefix is {}", BUCKET_NAME,
tenantCode + FOLDER_SEPARATOR + keyPrefix);
Thread.currentThread().interrupt();
} finally {
tm.shutdownNow();
}
}
public void checkBucketNameExists(String bucketName) {
if (StringUtils.isBlank(bucketName)) {
throw new IllegalArgumentException("resource.aws.s3.bucket.name is blank");
}
Bucket existsBucket = s3Client.listBuckets()
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
.stream()
.filter(
bucket -> bucket.getName().equals(bucketName))
.findFirst()
.orElseThrow(() -> {
return new IllegalArgumentException(
"bucketName: " + bucketName + " is not exists, you need to create them by yourself");
});
log.info("bucketName: {} has been found, the current regionName is {}", existsBucket.getName(),
s3Client.getRegionName());
}
/**
* only delete the object of directory ,it`s better to delete the files in it -r
*/
private void deleteDirectory(String directoryName) {
if (s3Client.doesObjectExist(BUCKET_NAME, directoryName)) {
s3Client.deleteObject(BUCKET_NAME, directoryName);
}
}
@Override
public ResUploadType returnStorageType() {
return ResUploadType.S3;
}
@Override
public List<StorageEntity> listFilesStatusRecursively(String path, String defaultPath, String tenantCode,
ResourceType type) {
List<StorageEntity> storageEntityList = new ArrayList<>();
LinkedList<StorageEntity> foldersToFetch = new LinkedList<>();
StorageEntity initialEntity = null;
try {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
initialEntity = getFileStatus(path, defaultPath, tenantCode, type);
} catch (Exception e) {
log.error("error while listing files status recursively, path: {}", path, e);
return storageEntityList;
}
foldersToFetch.add(initialEntity);
while (!foldersToFetch.isEmpty()) {
String pathToExplore = foldersToFetch.pop().getFullName();
try {
List<StorageEntity> tempList = listFilesStatus(pathToExplore, defaultPath, tenantCode, type);
for (StorageEntity temp : tempList) {
if (temp.isDirectory()) {
foldersToFetch.add(temp);
}
}
storageEntityList.addAll(tempList);
} catch (Exception e) {
log.error("error while listing files status recursively, path: {}", pathToExplore, e);
}
}
return storageEntityList;
}
@Override
public List<StorageEntity> listFilesStatus(String path, String defaultPath, String tenantCode,
ResourceType type) throws AmazonServiceException {
List<StorageEntity> storageEntityList = new ArrayList<>();
ListObjectsV2Request request = new ListObjectsV2Request();
request.setBucketName(BUCKET_NAME);
request.setPrefix(path);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
request.setDelimiter("/");
ListObjectsV2Result v2Result;
do {
try {
v2Result = s3Client.listObjectsV2(request);
} catch (AmazonServiceException e) {
throw new AmazonServiceException("Get S3 file list exception, error type:" + e.getErrorType(), e);
}
List<S3ObjectSummary> summaries = v2Result.getObjectSummaries();
for (S3ObjectSummary summary : summaries) {
if (!summary.getKey().endsWith("/")) {
String[] aliasArr = summary.getKey().split("/");
String alias = aliasArr[aliasArr.length - 1];
String fileName = StringUtils.difference(defaultPath, summary.getKey());
StorageEntity entity = new StorageEntity();
entity.setAlias(alias);
entity.setFileName(fileName);
entity.setFullName(summary.getKey());
entity.setDirectory(false);
entity.setDescription("");
entity.setUserName(tenantCode);
entity.setType(type);
entity.setSize(summary.getSize());
entity.setCreateTime(summary.getLastModified());
entity.setUpdateTime(summary.getLastModified());
entity.setPfullName(path);
storageEntityList.add(entity);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
for (String commonPrefix : v2Result.getCommonPrefixes()) {
String suffix = StringUtils.difference(path, commonPrefix);
String fileName = StringUtils.difference(defaultPath, commonPrefix);
StorageEntity entity = new StorageEntity();
entity.setAlias(suffix);
entity.setFileName(fileName);
entity.setFullName(commonPrefix);
entity.setDirectory(true);
entity.setDescription("");
entity.setUserName(tenantCode);
entity.setType(type);
entity.setSize(0);
entity.setCreateTime(null);
entity.setUpdateTime(null);
entity.setPfullName(path);
storageEntityList.add(entity);
}
request.setContinuationToken(v2Result.getContinuationToken());
} while (v2Result.isTruncated());
return storageEntityList;
}
@Override
public StorageEntity getFileStatus(String path, String defaultPath, String tenantCode,
ResourceType type) throws AmazonServiceException, FileNotFoundException {
ListObjectsV2Request request = new ListObjectsV2Request();
request.setBucketName(BUCKET_NAME);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
request.setPrefix(path);
request.setDelimiter("/");
ListObjectsV2Result v2Result;
try {
v2Result = s3Client.listObjectsV2(request);
} catch (AmazonServiceException e) {
throw new AmazonServiceException("Get S3 file list exception, error type:" + e.getErrorType(), e);
}
List<S3ObjectSummary> summaries = v2Result.getObjectSummaries();
if (path.endsWith("/")) {
String alias = findDirAlias(path);
String fileName = StringUtils.difference(defaultPath, path);
StorageEntity entity = new StorageEntity();
entity.setAlias(alias);
entity.setFileName(fileName);
entity.setFullName(path);
entity.setDirectory(true);
entity.setDescription("");
entity.setUserName(tenantCode);
entity.setType(type);
entity.setSize(0);
return entity;
} else {
if (summaries.size() > 0) {
S3ObjectSummary summary = summaries.get(0);
String[] aliasArr = summary.getKey().split("/");
String alias = aliasArr[aliasArr.length - 1];
String fileName = StringUtils.difference(defaultPath, summary.getKey());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperator.java
|
StorageEntity entity = new StorageEntity();
entity.setAlias(alias);
entity.setFileName(fileName);
entity.setFullName(summary.getKey());
entity.setDirectory(false);
entity.setDescription("");
entity.setUserName(tenantCode);
entity.setType(type);
entity.setSize(summary.getSize());
entity.setCreateTime(summary.getLastModified());
entity.setUpdateTime(summary.getLastModified());
return entity;
}
}
throw new FileNotFoundException("Object is not found in S3 Bucket: " + BUCKET_NAME);
}
/**
* find alias for directories, NOT for files
* a directory is a path ending with "/"
*/
private String findDirAlias(String myStr) {
if (!myStr.endsWith(FOLDER_SEPARATOR)) {
return myStr;
}
Path path = Paths.get(myStr);
return path.getName(path.getNameCount() - 1) + FOLDER_SEPARATOR;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperatorFactory.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.storage.s3;
import org.apache.dolphinscheduler.plugin.storage.api.StorageOperate;
import org.apache.dolphinscheduler.plugin.storage.api.StorageOperateFactory;
import org.apache.dolphinscheduler.plugin.storage.api.StorageType;
import com.google.auto.service.AutoService;
@AutoService(StorageOperateFactory.class)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,437 |
[Improvement][UT] Add UT for S3StorageOperator
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Add UT for S3StorageOperator
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13437
|
https://github.com/apache/dolphinscheduler/pull/13530
|
79d3ed0744aae76464b429d1e1d632d27b5457e7
|
0db916473e93d5e71f2475a487f08b6946952b2a
| 2023-01-20T07:42:16Z |
java
| 2023-02-22T11:57:18Z |
dolphinscheduler-storage-plugin/dolphinscheduler-storage-s3/src/main/java/org/apache/dolphinscheduler/plugin/storage/s3/S3StorageOperatorFactory.java
|
public class S3StorageOperatorFactory implements StorageOperateFactory {
@Override
public StorageOperate createStorageOperate() {
return new S3StorageOperator();
}
@Override
public StorageType getStorageOperate() {
return StorageType.S3;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/flow/batch/reader/JdbcReader.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.data.quality.flow.batch.reader;
import static org.apache.dolphinscheduler.data.quality.Constants.DB_TABLE;
import static org.apache.dolphinscheduler.data.quality.Constants.DOTS;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/flow/batch/reader/JdbcReader.java
|
import static org.apache.dolphinscheduler.data.quality.Constants.DRIVER;
import static org.apache.dolphinscheduler.data.quality.Constants.JDBC;
import static org.apache.dolphinscheduler.data.quality.Constants.PASSWORD;
import static org.apache.dolphinscheduler.data.quality.Constants.TABLE;
import static org.apache.dolphinscheduler.data.quality.Constants.URL;
import static org.apache.dolphinscheduler.data.quality.Constants.USER;
import org.apache.dolphinscheduler.data.quality.config.Config;
import org.apache.dolphinscheduler.data.quality.config.ValidateResult;
import org.apache.dolphinscheduler.data.quality.execution.SparkRuntimeEnvironment;
import org.apache.dolphinscheduler.data.quality.flow.batch.BatchReader;
import org.apache.dolphinscheduler.data.quality.utils.ConfigUtils;
import org.apache.spark.sql.DataFrameReader;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* AbstractJdbcSource
*/
public class JdbcReader implements BatchReader {
private final Config config;
public JdbcReader(Config config) {
this.config = config;
}
@Override
public Config getConfig() {
return config;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.