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 | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java | * fail retry interval
*/
private int failRetryInterval;
/**
* timeout flag
*/
private TimeoutFlag timeoutFlag;
/**
* timeout notify strategy
*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private TaskTimeoutStrategy timeoutNotifyStrategy;
/**
* task warning time out. unit: minute
*/
private int timeout;
/**
* delay execution time.
*/
private int delayTime;
/**
* resource ids
*/
private String resourceIds;
/**
* create time
*/
private Date createTime;
/**
* update time |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java | */
private Date updateTime;
/**
* modify user name
*/
@TableField(exist = false)
private String modifyBy;
/**
* task group id
*/
private int taskGroupId;
/**
* task group id
*/
private int taskGroupPriority;
public TaskDefinition() {
}
public TaskDefinition(long code, int version) {
this.code = code;
this.version = version;
}
public int getTaskGroupId() {
return taskGroupId;
}
public void setTaskGroupId(int taskGroupId) {
this.taskGroupId = taskGroupId;
}
public String getName() {
return name;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java | public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Flag getFlag() {
return flag;
}
public void setFlag(Flag flag) {
this.flag = flag;
}
public int getUserId() {
return userId;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java | public void setUserId(int userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public String getTaskParams() {
return taskParams;
}
public void setTaskParams(String taskParams) {
this.taskParams = taskParams;
}
public List<Property> getTaskParamList() {
JsonNode localParams = JSONUtils.parseObject(taskParams).findValue("localParams");
if (localParams != null) {
taskParamList = JSONUtils.toList(localParams.toString(), Property.class);
}
return taskParamList;
}
public void setTaskParamList(List<Property> taskParamList) {
this.taskParamList = taskParamList; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java | }
public void setTaskParamMap(Map<String, String> taskParamMap) {
this.taskParamMap = taskParamMap;
}
public Map<String, String> getTaskParamMap() {
if (taskParamMap == null && StringUtils.isNotEmpty(taskParams)) {
JsonNode localParams = JSONUtils.parseObject(taskParams).findValue("localParams");
if (localParams != null) {
List<Property> propList = JSONUtils.toList(localParams.toString(), Property.class);
taskParamMap = propList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue));
}
}
return taskParamMap;
}
public int getTimeout() {
return timeout;
}
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public long getCode() {
return code;
}
public void setCode(long code) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java | this.code = code;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
public long getProjectCode() {
return projectCode;
}
public void setProjectCode(long projectCode) {
this.projectCode = projectCode;
}
public String getTaskType() {
return taskType;
}
public void setTaskType(String taskType) {
this.taskType = taskType;
}
public Priority getTaskPriority() {
return taskPriority;
}
public void setTaskPriority(Priority taskPriority) {
this.taskPriority = taskPriority;
}
public String getWorkerGroup() {
return workerGroup;
}
public void setWorkerGroup(String workerGroup) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java | this.workerGroup = workerGroup;
}
public int getFailRetryTimes() {
return failRetryTimes;
}
public void setFailRetryTimes(int failRetryTimes) {
this.failRetryTimes = failRetryTimes;
}
public int getFailRetryInterval() {
return failRetryInterval;
}
public void setFailRetryInterval(int failRetryInterval) {
this.failRetryInterval = failRetryInterval;
}
public TaskTimeoutStrategy getTimeoutNotifyStrategy() {
return timeoutNotifyStrategy;
}
public void setTimeoutNotifyStrategy(TaskTimeoutStrategy timeoutNotifyStrategy) {
this.timeoutNotifyStrategy = timeoutNotifyStrategy;
}
public TimeoutFlag getTimeoutFlag() {
return timeoutFlag;
}
public void setTimeoutFlag(TimeoutFlag timeoutFlag) {
this.timeoutFlag = timeoutFlag;
}
public String getResourceIds() {
return resourceIds;
}
public void setResourceIds(String resourceIds) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java | this.resourceIds = resourceIds;
}
public int getDelayTime() {
return delayTime;
}
public void setDelayTime(int delayTime) {
this.delayTime = delayTime;
}
public String getDependence() {
return JSONUtils.getNodeString(this.taskParams, Constants.DEPENDENCE);
}
public String getModifyBy() {
return modifyBy;
}
public void setModifyBy(String modifyBy) {
this.modifyBy = modifyBy;
}
public long getEnvironmentCode() {
return this.environmentCode;
}
public void setEnvironmentCode(long environmentCode) {
this.environmentCode = environmentCode;
}
@Override
public boolean equals(Object o) {
if (o == null) {
return false;
}
TaskDefinition that = (TaskDefinition) o;
return failRetryTimes == that.failRetryTimes |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java | && failRetryInterval == that.failRetryInterval
&& timeout == that.timeout
&& delayTime == that.delayTime
&& Objects.equals(name, that.name)
&& Objects.equals(description, that.description)
&& Objects.equals(taskType, that.taskType)
&& Objects.equals(taskParams, that.taskParams)
&& flag == that.flag
&& taskPriority == that.taskPriority
&& Objects.equals(workerGroup, that.workerGroup)
&& timeoutFlag == that.timeoutFlag
&& timeoutNotifyStrategy == that.timeoutNotifyStrategy
&& (Objects.equals(resourceIds, that.resourceIds)
|| (StringUtils.EMPTY.equals(resourceIds) && that.resourceIds == null)
|| (StringUtils.EMPTY.equals(that.resourceIds) && resourceIds == null))
&& environmentCode == that.environmentCode
&& taskGroupId == that.taskGroupId
&& taskGroupPriority == that.taskGroupPriority;
}
@Override
public String toString() {
return "TaskDefinition{"
+ "id=" + id
+ ", code=" + code
+ ", name='" + name + '\''
+ ", version=" + version
+ ", description='" + description + '\''
+ ", projectCode=" + projectCode
+ ", userId=" + userId
+ ", taskType=" + taskType |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java | + ", taskParams='" + taskParams + '\''
+ ", taskParamList=" + taskParamList
+ ", taskParamMap=" + taskParamMap
+ ", flag=" + flag
+ ", taskPriority=" + taskPriority
+ ", userName='" + userName + '\''
+ ", projectName='" + projectName + '\''
+ ", workerGroup='" + workerGroup + '\''
+ ", failRetryTimes=" + failRetryTimes
+ ", environmentCode='" + environmentCode + '\''
+ ", taskGroupId='" + taskGroupId + '\''
+ ", taskGroupPriority='" + taskGroupPriority + '\''
+ ", failRetryInterval=" + failRetryInterval
+ ", timeoutFlag=" + timeoutFlag
+ ", timeoutNotifyStrategy=" + timeoutNotifyStrategy
+ ", timeout=" + timeout
+ ", delayTime=" + delayTime
+ ", resourceIds='" + resourceIds + '\''
+ ", createTime=" + createTime
+ ", updateTime=" + updateTime
+ '}';
}
public int getTaskGroupPriority() {
return taskGroupPriority;
}
public void setTaskGroupPriority(int taskGroupPriority) {
this.taskGroupPriority = taskGroupPriority;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapperTest.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.dao.mapper;
import org.apache.dolphinscheduler.dao.BaseDaoTest;
import org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
public class TaskDefinitionMapperTest extends BaseDaoTest { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapperTest.java | @Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private UserMapper userMapper;
public TaskDefinition insertOne() {
return insertOne(99);
}
public TaskDefinition insertOne(int userId) {
TaskDefinition taskDefinition = new TaskDefinition();
taskDefinition.setCode(888888L);
taskDefinition.setName("unit-test");
taskDefinition.setProjectCode(1L);
taskDefinition.setTaskType("SHELL");
taskDefinition.setUserId(userId);
taskDefinition.setResourceIds("1");
taskDefinition.setWorkerGroup("default");
taskDefinition.setEnvironmentCode(1L);
taskDefinition.setVersion(1);
taskDefinition.setCreateTime(new Date());
taskDefinition.setUpdateTime(new Date());
taskDefinitionMapper.insert(taskDefinition); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapperTest.java | return taskDefinition;
}
@Test
public void testInsert() {
TaskDefinition taskDefinition = insertOne();
Assert.assertNotEquals(taskDefinition.getId(), 0);
}
@Test
public void testQueryByDefinitionName() {
TaskDefinition taskDefinition = insertOne();
TaskDefinition result = taskDefinitionMapper.queryByName(taskDefinition.getProjectCode()
, taskDefinition.getName());
Assert.assertNotNull(result);
}
@Test
public void testQueryByDefinitionCode() {
TaskDefinition taskDefinition = insertOne();
TaskDefinition result = taskDefinitionMapper.queryByCode(taskDefinition.getCode());
Assert.assertNotNull(result);
}
@Test
public void testQueryAllDefinitionList() {
TaskDefinition taskDefinition = insertOne();
List<TaskDefinition> taskDefinitions = taskDefinitionMapper.queryAllDefinitionList(taskDefinition.getProjectCode());
Assert.assertNotEquals(taskDefinitions.size(), 0);
}
@Test
public void testCountDefinitionGroupByUser() {
User user = new User();
user.setUserName("un"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,608 | [Bug] [DAO] Due to the task param map, serialize the task definition failed | ### 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
TaskDefinition.java
When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object;
### What you expected to happen
When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value;
### How to reproduce
Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null;
Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value;
### Anything else
_No response_
### Version
2.0.5
### 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/9608 | https://github.com/apache/dolphinscheduler/pull/9622 | a863c6f8f121869a107611e1217c669da28c3d3e | 10f8c9d983528fe57c01a975e3e98d36fff7a4ff | 2022-04-20T06:08:21Z | java | 2022-04-21T03:38:41Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapperTest.java | userMapper.insert(user);
User un = userMapper.queryByUserNameAccurately("un");
TaskDefinition taskDefinition = insertOne(un.getId());
List<DefinitionGroupByUser> users = taskDefinitionMapper.countDefinitionGroupByUser(new Long[]{taskDefinition.getProjectCode()});
Assert.assertNotEquals(users.size(), 0);
}
@Test
public void testListResources() {
TaskDefinition taskDefinition = insertOne();
List<Map<String, Object>> maps = taskDefinitionMapper.listResources();
Assert.assertNotEquals(maps.size(), 0);
}
@Test
public void testListResourcesByUser() {
User user = new User();
user.setUserName("un");
userMapper.insert(user);
User un = userMapper.queryByUserNameAccurately("un");
TaskDefinition taskDefinition = insertOne(un.getId());
List<Map<String, Object>> maps = taskDefinitionMapper.listResourcesByUser(taskDefinition.getUserId());
Assert.assertNotEquals(maps.size(), 0);
}
@Test
public void testDeleteByCode() {
TaskDefinition taskDefinition = insertOne();
int i = taskDefinitionMapper.deleteByCode(taskDefinition.getCode());
Assert.assertNotEquals(i, 0);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.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.api; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_FAILURE;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_KILL;
import org.apache.dolphinscheduler.plugin.task.api.model.TaskResponse;
import org.apache.dolphinscheduler.plugin.task.api.utils.OSUtils;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
/**
* abstract command executor
*/
public abstract class AbstractCommandExecutor { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | /**
* rules for extracting application ID
*/
protected static final Pattern APPLICATION_REGEX = Pattern.compile(TaskConstants.APPLICATION_REGEX);
/**
* rules for extracting Var Pool
*/
protected static final Pattern SETVALUE_REGEX = Pattern.compile(TaskConstants.SETVALUE_REGEX);
protected StringBuilder varPool = new StringBuilder();
/**
* process
*/
private Process process;
/**
* log handler
*/
protected Consumer<LinkedBlockingQueue<String>> logHandler;
/**
* logger
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | protected Logger logger;
/**
* log list
*/
protected LinkedBlockingQueue<String> logBuffer;
protected boolean logOutputIsSuccess = false;
/*
* SHELL result string
*/
protected String taskResultString;
/**
* taskRequest
*/
protected TaskExecutionContext taskRequest;
public AbstractCommandExecutor(Consumer<LinkedBlockingQueue<String>> logHandler,
TaskExecutionContext taskRequest,
Logger logger) {
this.logHandler = logHandler;
this.taskRequest = taskRequest;
this.logger = logger;
this.logBuffer = new LinkedBlockingQueue<>();
}
public AbstractCommandExecutor(LinkedBlockingQueue<String> logBuffer) {
this.logBuffer = logBuffer;
}
/**
* build process
*
* @param commandFile command file
* @throws IOException IO Exception |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | */
private void buildProcess(String commandFile) throws IOException {
List<String> command = new LinkedList<>();
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.directory(new File(taskRequest.getExecutePath()));
processBuilder.redirectErrorStream(true);
if (OSUtils.isSudoEnable()) {
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
}
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
public TaskResponse run(String execCommand) throws IOException, InterruptedException {
TaskResponse result = new TaskResponse();
int taskInstanceId = taskRequest.getTaskInstanceId();
if (null == TaskExecutionContextCacheManager.getByTaskInstanceId(taskInstanceId)) {
result.setExitStatusCode(EXIT_CODE_KILL);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | }
if (StringUtils.isEmpty(execCommand)) {
TaskExecutionContextCacheManager.removeByTaskInstanceId(taskInstanceId);
return result;
}
String commandFilePath = buildCommandFilePath();
createCommandFileIfNotExists(execCommand, commandFilePath);
buildProcess(commandFilePath);
parseProcessOutput(process);
int processId = getProcessId(process);
result.setProcessId(processId);
taskRequest.setProcessId(processId);
boolean updateTaskExecutionContextStatus = TaskExecutionContextCacheManager.updateTaskExecutionContext(taskRequest);
if (Boolean.FALSE.equals(updateTaskExecutionContextStatus)) {
ProcessUtils.kill(taskRequest);
result.setExitStatusCode(EXIT_CODE_KILL);
return result;
}
logger.info("process start, process id is: {}", processId);
long remainTime = getRemainTime();
boolean status = process.waitFor(remainTime, TimeUnit.SECONDS);
if (status) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | List<String> appIds = getAppIds(taskRequest.getLogPath());
result.setAppIds(String.join(TaskConstants.COMMA, appIds));
result.setExitStatusCode(process.exitValue());
} else {
logger.error("process has failure , exitStatusCode:{}, processExitValue:{}, ready to kill ...",
result.getExitStatusCode(), process.exitValue());
ProcessUtils.kill(taskRequest);
result.setExitStatusCode(EXIT_CODE_FAILURE);
}
logger.info("process has exited, execute path:{}, processId:{} ,exitStatusCode:{} ,processWaitForStatus:{} ,processExitValue:{}",
taskRequest.getExecutePath(), processId, result.getExitStatusCode(), status, process.exitValue());
return result;
}
public String getVarPool() {
return varPool.toString();
}
/**
* cancel application
*
* @throws Exception exception
*/
public void cancelApplication() throws Exception {
if (process == null) {
return;
}
clear();
int processId = getProcessId(process); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | logger.info("cancel process: {}", processId);
boolean killed = softKill(processId);
if (!killed) {
hardKill(processId);
process.destroy();
process = null;
}
}
/**
* soft kill
*
* @param processId process id
* @return process is alive
*/
private boolean softKill(int processId) {
if (processId != 0 && process.isAlive()) {
try {
String cmd = String.format("kill %d", processId);
cmd = OSUtils.getSudoCmd(taskRequest.getTenantCode(), cmd);
logger.info("soft kill task:{}, process id:{}, cmd:{}", taskRequest.getTaskAppId(), processId, cmd);
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
logger.info("kill attempt failed", e);
}
}
return process.isAlive(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | }
/**
* hard kill
*
* @param processId process id
*/
private void hardKill(int processId) {
if (processId != 0 && process.isAlive()) {
try {
String cmd = String.format("kill -9 %d", processId);
cmd = OSUtils.getSudoCmd(taskRequest.getTenantCode(), cmd);
logger.info("hard kill task:{}, process id:{}, cmd:{}", taskRequest.getTaskAppId(), processId, cmd);
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
logger.error("kill attempt failed ", e);
}
}
}
private void printCommand(List<String> commands) {
logger.info("task run command: {}", String.join(" ", commands));
}
/**
* clear
*/
private void clear() {
LinkedBlockingQueue<String> markerLog = new LinkedBlockingQueue<>(1);
markerLog.add(ch.qos.logback.classic.ClassicConstants.FINALIZE_SESSION_MARKER.toString());
if (!logBuffer.isEmpty()) {
logHandler.accept(logBuffer); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | logBuffer.clear();
}
logHandler.accept(markerLog);
}
/**
* get the standard output of the process
*
* @param process process
*/
private void parseProcessOutput(Process process) {
String threadLoggerInfoName = taskRequest.getTaskLogName();
ExecutorService getOutputLogService = newDaemonSingleThreadExecutor(threadLoggerInfoName);
getOutputLogService.submit(() -> {
try (BufferedReader inReader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
String line;
while ((line = inReader.readLine()) != null) {
if (line.startsWith("${setValue(")) {
varPool.append(findVarPool(line));
varPool.append("$VarPool$");
} else {
logBuffer.add(line);
taskResultString = line;
}
}
logOutputIsSuccess = true;
} catch (Exception e) {
logger.error(e.getMessage(), e);
logOutputIsSuccess = true;
}
}); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | getOutputLogService.shutdown();
ExecutorService parseProcessOutputExecutorService = newDaemonSingleThreadExecutor(threadLoggerInfoName);
parseProcessOutputExecutorService.submit(() -> {
try {
long lastFlushTime = System.currentTimeMillis();
while (logBuffer.size() > 0 || !logOutputIsSuccess) {
if (logBuffer.size() > 0) {
lastFlushTime = flush(lastFlushTime);
} else {
Thread.sleep(TaskConstants.DEFAULT_LOG_FLUSH_INTERVAL);
}
}
} catch (Exception e) {
Thread.currentThread().interrupt();
logger.error(e.getMessage(), e);
} finally {
clear();
}
});
parseProcessOutputExecutorService.shutdown();
}
/**
* get app links
*
* @param logPath log path
* @return app id list
*/
private List<String> getAppIds(String logPath) {
List<String> logs = convertFile2List(logPath);
List<String> appIds = new ArrayList<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | /*
* analysis log?get submited yarn application id
*/
for (String log : logs) {
String appId = findAppId(log);
if (StringUtils.isNotEmpty(appId) && !appIds.contains(appId)) {
logger.info("find app id: {}", appId);
appIds.add(appId);
}
}
return appIds;
}
/**
* convert file to list
*
* @param filename file name
* @return line list
*/
private List<String> convertFile2List(String filename) {
List<String> lineList = new ArrayList<>(100);
File file = new File(filename);
if (!file.exists()) {
return lineList;
}
try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename), StandardCharsets.UTF_8))) {
String line;
while ((line = br.readLine()) != null) {
lineList.add(line);
}
} catch (Exception e) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | logger.error(String.format("read file: %s failed : ", filename), e);
}
return lineList;
}
/**
* find var pool
* @param line
* @return
*/
private String findVarPool(String line) {
Matcher matcher = SETVALUE_REGEX.matcher(line);
if (matcher.find()) {
return matcher.group(1);
}
return null;
}
/**
* find app id
*
* @param line line
* @return appid
*/
private String findAppId(String line) {
Matcher matcher = APPLICATION_REGEX.matcher(line);
if (matcher.find()) {
return matcher.group();
}
return null;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | /**
* get remain time(s)
*
* @return remain time
*/
private long getRemainTime() {
long usedTime = (System.currentTimeMillis() - taskRequest.getStartTime().getTime()) / 1000;
long remainTime = taskRequest.getTaskTimeout() - usedTime;
if (remainTime < 0) {
throw new RuntimeException("task execution time out");
}
return remainTime;
}
/**
* get process id
*
* @param process process
* @return process id
*/
private int getProcessId(Process process) {
int processId = 0;
try {
Field f = process.getClass().getDeclaredField(TaskConstants.PID);
f.setAccessible(true);
processId = f.getInt(process);
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
return processId;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | /**
* when log buffer siz or flush time reach condition , then flush
*
* @param lastFlushTime last flush time
* @return last flush time
*/
private long flush(long lastFlushTime) {
long now = System.currentTimeMillis();
/*
* when log buffer siz or flush time reach condition , then flush
*/
if (logBuffer.size() >= TaskConstants.DEFAULT_LOG_ROWS_NUM || now - lastFlushTime > TaskConstants.DEFAULT_LOG_FLUSH_INTERVAL) {
lastFlushTime = now;
logHandler.accept(logBuffer);
logBuffer.clear();
}
return lastFlushTime;
}
protected abstract String buildCommandFilePath();
protected abstract void createCommandFileIfNotExists(String execCommand, String commandFile) throws IOException;
ExecutorService newDaemonSingleThreadExecutor(String threadName) {
ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat(threadName)
.build();
return Executors.newSingleThreadExecutor(threadFactory);
}
protected abstract String commandInterpreter();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.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.api;
import java.util.Arrays;
import java.util.List;
public class TaskConstants { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java | private TaskConstants() {
throw new IllegalStateException("Utility class");
}
public static final String APPLICATION_REGEX = "application_\\d+_\\d+";
public static final String SETVALUE_REGEX = "\\$\\{setValue\\(([^)]*)\\)}";
/**
* string false
*/
public static final String STRING_FALSE = "false";
/**
* exit code kill
*/
public static final int EXIT_CODE_KILL = 137;
public static final String PID = "pid";
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java | * QUESTION ?
*/
public static final String QUESTION = "?";
/**
* comma ,
*/
public static final String COMMA = ",";
/**
* slash /
*/
public static final String SLASH = "/";
/**
* COLON :
*/
public static final String COLON = ":";
/**
* SPACE " "
*/
public static final String SPACE = " ";
/**
* SINGLE_SLASH /
*/
public static final String SINGLE_SLASH = "/";
/**
* DOUBLE_SLASH //
*/
public static final String DOUBLE_SLASH = "//";
/**
* SINGLE_QUOTES "'"
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java | public static final String SINGLE_QUOTES = "'";
/**
* DOUBLE_QUOTES "\""
*/
public static final String DOUBLE_QUOTES = "\"";
/**
* SEMICOLON ;
*/
public static final String SEMICOLON = ";";
/**
* EQUAL SIGN
*/
public static final String EQUAL_SIGN = "=";
/**
* AT SIGN
*/
public static final String AT_SIGN = "@";
/**
* UNDERLINE
*/
public static final String UNDERLINE = "_";
/**
* sleep time
*/
public static final int SLEEP_TIME_MILLIS = 1000;
/**
* exit code failure
*/
public static final int EXIT_CODE_FAILURE = -1;
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java | * exit code success
*/
public static final int EXIT_CODE_SUCCESS = 0;
public static final String SH = "sh";
/**
* default log cache rows num,output when reach the number
*/
public static final int DEFAULT_LOG_ROWS_NUM = 4 * 16;
/**
* log flush interval?output when reach the interval
*/
public static final int DEFAULT_LOG_FLUSH_INTERVAL = 1000;
/**
* pstree, get pud and sub pid
*/
public static final String PSTREE = "pstree";
public static final String RWXR_XR_X = "rwxr-xr-x";
/**
* task log info format
*/
public static final String TASK_LOG_LOGGER_NAME = "TaskLogLogger";
/**
* task log logger name format
*/
public static final String TASK_LOG_LOGGER_NAME_FORMAT = TASK_LOG_LOGGER_NAME + "-%s";
/**
* Task Logger's prefix
*/
public static final String TASK_LOGGER_INFO_PREFIX = "TASK";
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java | * Task Logger Thread's name
*/
public static final String TASK_APPID_LOG_FORMAT = "taskAppId";
/**
* get output log service
*/
public static final String GET_OUTPUT_LOG_SERVICE = "-getOutputLogService";
/**
* date format of yyyyMMdd
*/
public static final String PARAMETER_FORMAT_DATE = "yyyyMMdd";
/**
* date format of yyyyMMddHHmmss
*/
public static final String PARAMETER_FORMAT_TIME = "yyyyMMddHHmmss";
/**
* new
* schedule time
*/
public static final String PARAMETER_SHECDULE_TIME = "schedule.time";
/**
* system date(yyyyMMddHHmmss)
*/
public static final String PARAMETER_DATETIME = "system.datetime";
/**
* system date(yyyymmdd) today
*/
public static final String PARAMETER_CURRENT_DATE = "system.biz.curdate";
/**
* system date(yyyymmdd) yesterday |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java | */
public static final String PARAMETER_BUSINESS_DATE = "system.biz.date";
/**
* the absolute path of current executing task
*/
public static final String PARAMETER_TASK_EXECUTE_PATH = "system.task.execute.path";
/**
* the instance id of current task
*/
public static final String PARAMETER_TASK_INSTANCE_ID = "system.task.instance.id";
/**
* month_begin
*/
public static final String MONTH_BEGIN = "month_begin";
/**
* add_months
*/
public static final String ADD_MONTHS = "add_months";
/**
* month_end
*/
public static final String MONTH_END = "month_end";
/**
* week_begin
*/
public static final String WEEK_BEGIN = "week_begin";
/**
* week_end
*/
public static final String WEEK_END = "week_end"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java | /**
* timestamp
*/
public static final String TIMESTAMP = "timestamp";
public static final char SUBTRACT_CHAR = '-';
public static final char ADD_CHAR = '+';
public static final char MULTIPLY_CHAR = '*';
public static final char DIVISION_CHAR = '/';
public static final char LEFT_BRACE_CHAR = '(';
public static final char RIGHT_BRACE_CHAR = ')';
public static final String ADD_STRING = "+";
public static final String MULTIPLY_STRING = "*";
public static final String DIVISION_STRING = "/";
public static final String LEFT_BRACE_STRING = "(";
public static final char P = 'P';
public static final char N = 'N';
public static final String SUBTRACT_STRING = "-";
public static final String GLOBAL_PARAMS = "globalParams";
public static final String LOCAL_PARAMS = "localParams";
public static final String LOCAL_PARAMS_LIST = "localParamsList";
public static final String SUBPROCESS_INSTANCE_ID = "subProcessInstanceId";
public static final String PROCESS_INSTANCE_STATE = "processInstanceState";
public static final String PARENT_WORKFLOW_INSTANCE = "parentWorkflowInstance";
public static final String CONDITION_RESULT = "conditionResult";
public static final String SWITCH_RESULT = "switchResult";
public static final String DEPENDENCE = "dependence";
public static final String TASK_TYPE = "taskType";
public static final String TASK_LIST = "taskList";
public static final String QUEUE = "queue";
public static final String QUEUE_NAME = "queueName"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java | public static final int LOG_QUERY_SKIP_LINE_NUMBER = 0;
public static final int LOG_QUERY_LIMIT = 4096;
/**
* default display rows
*/
public static final int DEFAULT_DISPLAY_ROWS = 10;
/**
* jar
*/
public static final String JAR = "jar";
/**
* hadoop
*/
public static final String HADOOP = "hadoop";
/**
* -D <property>=<value>
*/
public static final String D = "-D";
/**
* jdbc url
*/
public static final String JDBC_MYSQL = "jdbc:mysql://";
public static final String JDBC_POSTGRESQL = "jdbc:postgresql://";
public static final String JDBC_HIVE_2 = "jdbc:hive2://";
public static final String JDBC_CLICKHOUSE = "jdbc:clickhouse://";
public static final String JDBC_ORACLE_SID = "jdbc:oracle:thin:@";
public static final String JDBC_ORACLE_SERVICE_NAME = "jdbc:oracle:thin:@//";
public static final String JDBC_SQLSERVER = "jdbc:sqlserver://";
public static final String JDBC_DB2 = "jdbc:db2://";
public static final String JDBC_PRESTO = "jdbc:presto://"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java | /**
* driver
*/
public static final String ORG_POSTGRESQL_DRIVER = "org.postgresql.Driver";
public static final String COM_MYSQL_CJ_JDBC_DRIVER = "com.mysql.cj.jdbc.Driver";
public static final String ORG_APACHE_HIVE_JDBC_HIVE_DRIVER = "org.apache.hive.jdbc.HiveDriver";
public static final String COM_CLICKHOUSE_JDBC_DRIVER = "ru.yandex.clickhouse.ClickHouseDriver";
public static final String COM_ORACLE_JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver";
public static final String COM_SQLSERVER_JDBC_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
public static final String COM_DB2_JDBC_DRIVER = "com.ibm.db2.jcc.DB2Driver";
public static final String COM_PRESTO_JDBC_DRIVER = "com.facebook.presto.jdbc.PrestoDriver";
/**
* datasource encryption salt
*/
public static final String DATASOURCE_ENCRYPTION_SALT_DEFAULT = "!@#$%^&*";
public static final String DATASOURCE_ENCRYPTION_ENABLE = "datasource.encryption.enable";
public static final String DATASOURCE_ENCRYPTION_SALT = "datasource.encryption.salt";
/**
* resource storage type
*/
/**
* kerberos
*/
public static final String KERBEROS = "kerberos";
/**
* kerberos expire time
*/
public static final String KERBEROS_EXPIRE_TIME = "kerberos.expire.time";
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java | * java.security.krb5.conf
*/
public static final String JAVA_SECURITY_KRB5_CONF = "java.security.krb5.conf";
/**
* java.security.krb5.conf.path
*/
public static final String JAVA_SECURITY_KRB5_CONF_PATH = "java.security.krb5.conf.path";
/**
* loginUserFromKeytab user
*/
public static final String LOGIN_USER_KEY_TAB_USERNAME = "login.user.keytab.username";
/**
* loginUserFromKeytab path
*/
public static final String LOGIN_USER_KEY_TAB_PATH = "login.user.keytab.path";
/**
* hadoop.security.authentication
*/
public static final String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication";
/**
* hadoop.security.authentication
*/
public static final String HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE = "hadoop.security.authentication.startup.state";
/**
* Task Logger Thread's name
*/
public static final String TASK_LOGGER_THREAD_NAME = "TaskLogInfo";
/**
* hdfs/s3 configuration
* resource.upload.path |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,576 | [Improvement][server] varPool support "#{setValue(key=value)}" | ### 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
Currently var pool only support '${setValue(key=value)}', which has a limitation that value cannot reference other variables.
For example,
```shell
d=$(date "+%F %H-%M-%S")
echo '${setValue(day=${d})}'
```
Since single quotes won't interpolate anything, we cannot use ${d} in ${setValue}, so I think we can support #{setValue(key=value)} to avoid this.
like follow:
```shell
d=$(date "+%F %H-%M-%S")
echo "#{setValue(day=${d})}"
```
### Use case
_No response_
### Related issues
_No response_
### 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/9576 | https://github.com/apache/dolphinscheduler/pull/9586 | 996790ce9ea48bd96aed6687d31afe931fc70893 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 2022-04-19T06:17:29Z | java | 2022-04-22T06:10:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java | */
public static final String RESOURCE_UPLOAD_PATH = "resource.upload.path";
/**
* data.quality.jar.name
*/
public static final String DATA_QUALITY_JAR_NAME = "data-quality.jar.name";
/**
* data.quality.error.output.path
*/
public static final String DATA_QUALITY_ERROR_OUTPUT_PATH = "data-quality.error.output.path";
public static final String TASK_TYPE_CONDITIONS = "CONDITIONS";
public static final String TASK_TYPE_SWITCH = "SWITCH";
public static final String TASK_TYPE_SUB_PROCESS = "SUB_PROCESS";
public static final String TASK_TYPE_DEPENDENT = "DEPENDENT";
public static final String TASK_TYPE_SQL = "SQL";
public static final String TASK_TYPE_DATA_QUALITY = "DATA_QUALITY";
public static final String TASK_TYPE_BLOCKING = "BLOCKING";
public static final List<String> COMPLEX_TASK_TYPES = Arrays.asList(new String[]{TASK_TYPE_CONDITIONS, TASK_TYPE_SWITCH, TASK_TYPE_SUB_PROCESS, TASK_TYPE_DEPENDENT});
/**
* aws config
*/
public static final String AWS_ACCESS_KEY_ID= "aws.access.key.id";
public static final String AWS_SECRET_ACCESS_KEY= "aws.secret.access.key";
public static final String AWS_REGION = "aws.region";
/**
* zeppelin config
*/
public static final String ZEPPELIN_REST_URL= "zeppelin.rest.url";
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.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.api.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.common.base.Joiner;
import com.google.common.io.Files;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent;
import org.apache.dolphinscheduler.api.dto.resources.filter.ResourceFilter;
import org.apache.dolphinscheduler.api.dto.resources.visitor.ResourceTreeVisitor;
import org.apache.dolphinscheduler.api.dto.resources.visitor.Visitor;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.ResourcesService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.RegexUtils;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ProgramType;
import org.apache.dolphinscheduler.common.enums.ResUploadType;
import org.apache.dolphinscheduler.common.storage.StorageOperate;
import org.apache.dolphinscheduler.common.utils.FileUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.dao.entity.Resource;
import org.apache.dolphinscheduler.dao.entity.ResourcesUser;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.UdfFunc;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | import org.apache.dolphinscheduler.dao.mapper.ResourceMapper;
import org.apache.dolphinscheduler.dao.mapper.ResourceUserMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.mapper.UdfFuncMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.dolphinscheduler.dao.utils.ResourceProcessDefinitionUtils;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.rmi.ServerException;
import java.text.MessageFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.stream.Collectors;
import static org.apache.dolphinscheduler.common.Constants.ALIAS;
import static org.apache.dolphinscheduler.common.Constants.CONTENT;
import static org.apache.dolphinscheduler.common.Constants.FOLDER_SEPARATOR;
import static org.apache.dolphinscheduler.common.Constants.FORMAT_SS;
import static org.apache.dolphinscheduler.common.Constants.FORMAT_S_S;
import static org.apache.dolphinscheduler.common.Constants.JAR;
/**
* resources service impl
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesService {
private static final Logger logger = LoggerFactory.getLogger(ResourcesServiceImpl.class);
@Autowired
private ResourceMapper resourcesMapper;
@Autowired
private UdfFuncMapper udfFunctionMapper;
@Autowired
private TenantMapper tenantMapper;
@Autowired
private UserMapper userMapper;
@Autowired
private ResourceUserMapper resourceUserMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired(required = false)
private StorageOperate storageOperate;
/**
* create directory
*
* @param loginUser login user
* @param name alias
* @param description description
* @param type type
* @param pid parent id
* @param currentDir current directory
* @return create directory result |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | */
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> createDirectory(User loginUser,
String name,
String description,
ResourceType type,
int pid,
String currentDir) {
Result<Object> result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
if (name.endsWith(FOLDER_SEPARATOR)) {
result.setCode(Status.VERIFY_PARAMETER_NAME_FAILED.getCode());
return result;
}
String fullName = getFullName(currentDir, name);
result = verifyResource(loginUser, type, fullName, pid);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
if (checkResourceExists(fullName, type.ordinal())) {
logger.error("resource directory {} has exist, can't recreate", fullName);
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
Date now = new Date();
Resource resource = new Resource(pid, name, fullName, true, description, name, loginUser.getId(), type, 0, now, now);
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | resourcesMapper.insert(resource);
putMsg(result, Status.SUCCESS);
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<Object, Object> entry : new BeanMap(resource).entrySet()) {
if (!"class".equalsIgnoreCase(entry.getKey().toString())) {
resultMap.put(entry.getKey().toString(), entry.getValue());
}
}
result.setData(resultMap);
} catch (DuplicateKeyException e) {
logger.error("resource directory {} has exist, can't recreate", fullName);
putMsg(result, Status.RESOURCE_EXIST);
return result;
} catch (Exception e) {
logger.error("resource already exists, can't recreate ", e);
throw new ServiceException("resource already exists, can't recreate");
}
createDirectory(loginUser, fullName, type, result);
return result;
}
private String getFullName(String currentDir, String name) {
return currentDir.equals(FOLDER_SEPARATOR) ? String.format(FORMAT_SS, currentDir, name) : String.format(FORMAT_S_S, currentDir, name);
}
/**
* create resource
*
* @param loginUser login user
* @param name alias
* @param desc description |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | * @param file file
* @param type type
* @param pid parent id
* @param currentDir current directory
* @return create result code
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> createResource(User loginUser,
String name,
String desc,
ResourceType type,
MultipartFile file,
int pid,
String currentDir) {
Result<Object> result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
result = verifyPid(loginUser, pid);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
result = verifyFile(name, type, file);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
String fullName = getFullName(currentDir, name);
if (checkResourceExists(fullName, type.ordinal())) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | logger.error("resource {} has exist, can't recreate", RegexUtils.escapeNRT(name));
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
Date now = new Date();
Resource resource = new Resource(pid, name, fullName, false, desc, file.getOriginalFilename(), loginUser.getId(), type, file.getSize(), now, now);
try {
resourcesMapper.insert(resource);
updateParentResourceSize(resource, resource.getSize());
putMsg(result, Status.SUCCESS);
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<Object, Object> entry : new BeanMap(resource).entrySet()) {
if (!"class".equalsIgnoreCase(entry.getKey().toString())) {
resultMap.put(entry.getKey().toString(), entry.getValue());
}
}
result.setData(resultMap);
} catch (Exception e) {
logger.error("resource already exists, can't recreate ", e);
throw new ServiceException("resource already exists, can't recreate");
}
if (!upload(loginUser, fullName, file, type)) {
logger.error("upload resource: {} file: {} failed.", RegexUtils.escapeNRT(name), RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.STORE_OPERATE_CREATE_ERROR);
throw new ServiceException(String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename()));
}
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | * update the folder's size of the resource
*
* @param resource the current resource
* @param size size
*/
private void updateParentResourceSize(Resource resource, long size) {
if (resource.getSize() > 0) {
String[] splits = resource.getFullName().split("/");
for (int i = 1; i < splits.length; i++) {
String parentFullName = Joiner.on("/").join(Arrays.copyOfRange(splits, 0, i));
if (StringUtils.isNotBlank(parentFullName)) {
List<Resource> resources = resourcesMapper.queryResource(parentFullName, resource.getType().ordinal());
if (CollectionUtils.isNotEmpty(resources)) {
Resource parentResource = resources.get(0);
if (parentResource.getSize() + size >= 0) {
parentResource.setSize(parentResource.getSize() + size);
} else {
parentResource.setSize(0L);
}
resourcesMapper.updateById(parentResource);
}
}
}
}
}
/**
* check resource is exists
*
* @param fullName fullName
* @param type type |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | * @return true if resource exists
*/
private boolean checkResourceExists(String fullName, int type) {
Boolean existResource = resourcesMapper.existResource(fullName, type);
return Boolean.TRUE.equals(existResource);
}
/**
* update resource
*
* @param loginUser login user
* @param resourceId resource id
* @param name name
* @param desc description
* @param type resource type
* @param file resource file
* @return update result code
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> updateResource(User loginUser,
int resourceId,
String name,
String desc,
ResourceType type,
MultipartFile file) {
Result<Object> result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
Resource resource = resourcesMapper.selectById(resourceId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | if (resource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
if (!PropertyUtils.getResUploadStartupState()){
putMsg(result, Status.STORAGE_NOT_STARTUP);
return result;
}
if (resource.isDirectory() && storageOperate.returnStorageType().equals(ResUploadType.S3) && !resource.getFileName().equals(name)) {
putMsg(result, Status.S3_CANNOT_RENAME);
return result;
}
if (!canOperator(loginUser, resource.getUserId())) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (file == null && name.equals(resource.getAlias()) && desc.equals(resource.getDescription())) {
putMsg(result, Status.SUCCESS);
return result;
}
String originFullName = resource.getFullName();
String originResourceName = resource.getAlias();
String fullName = String.format(FORMAT_SS, originFullName.substring(0, originFullName.lastIndexOf(FOLDER_SEPARATOR) + 1), name);
if (!originResourceName.equals(name) && checkResourceExists(fullName, type.ordinal())) {
logger.error("resource {} already exists, can't recreate", name);
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
result = verifyFile(name, type, file); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
String tenantCode = getTenantCode(resource.getUserId(), result);
if (StringUtils.isEmpty(tenantCode)) {
return result;
}
String originFileName = storageOperate.getFileName(resource.getType(), tenantCode, originFullName);
try {
if (!storageOperate.exists(tenantCode, originFileName)) {
logger.error("{} not exist", originFileName);
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
} catch (IOException e) {
logger.error(e.getMessage(), e);
throw new ServiceException(Status.HDFS_OPERATION_ERROR);
}
if (!resource.isDirectory()) {
String originSuffix = Files.getFileExtension(originFullName);
String suffix = Files.getFileExtension(fullName);
boolean suffixIsChanged = false;
if (StringUtils.isBlank(suffix) && StringUtils.isNotBlank(originSuffix)) {
suffixIsChanged = true;
}
if (StringUtils.isNotBlank(suffix) && !suffix.equals(originSuffix)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | suffixIsChanged = true;
}
if (suffixIsChanged) {
Map<String, Object> columnMap = new HashMap<>();
columnMap.put("resources_id", resourceId);
List<ResourcesUser> resourcesUsers = resourceUserMapper.selectByMap(columnMap);
if (CollectionUtils.isNotEmpty(resourcesUsers)) {
List<Integer> userIds = resourcesUsers.stream().map(ResourcesUser::getUserId).collect(Collectors.toList());
List<User> users = userMapper.selectBatchIds(userIds);
String userNames = users.stream().map(User::getUserName).collect(Collectors.toList()).toString();
logger.error("resource is authorized to user {},suffix not allowed to be modified", userNames);
putMsg(result, Status.RESOURCE_IS_AUTHORIZED, userNames);
return result;
}
}
}
Date now = new Date();
long originFileSize = resource.getSize();
resource.setAlias(name);
resource.setFileName(name);
resource.setFullName(fullName);
resource.setDescription(desc);
resource.setUpdateTime(now);
if (file != null) {
resource.setSize(file.getSize());
}
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | resourcesMapper.updateById(resource);
if (resource.isDirectory()) {
List<Integer> childrenResource = listAllChildren(resource, false);
if (CollectionUtils.isNotEmpty(childrenResource)) {
String matcherFullName = Matcher.quoteReplacement(fullName);
List<Resource> childResourceList;
Integer[] childResIdArray = childrenResource.toArray(new Integer[childrenResource.size()]);
List<Resource> resourceList = resourcesMapper.listResourceByIds(childResIdArray);
childResourceList = resourceList.stream().map(t -> {
t.setFullName(t.getFullName().replaceFirst(originFullName, matcherFullName));
t.setUpdateTime(now);
return t;
}).collect(Collectors.toList());
resourcesMapper.batchUpdateResource(childResourceList);
if (ResourceType.UDF.equals(resource.getType())) {
List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(childResIdArray);
if (CollectionUtils.isNotEmpty(udfFuncs)) {
udfFuncs = udfFuncs.stream().map(t -> {
t.setResourceName(t.getResourceName().replaceFirst(originFullName, matcherFullName));
t.setUpdateTime(now);
return t;
}).collect(Collectors.toList());
udfFunctionMapper.batchUpdateUdfFunc(udfFuncs);
}
}
}
} else if (ResourceType.UDF.equals(resource.getType())) {
List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(new Integer[]{resourceId});
if (CollectionUtils.isNotEmpty(udfFuncs)) {
udfFuncs = udfFuncs.stream().map(t -> { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | t.setResourceName(fullName);
t.setUpdateTime(now);
return t;
}).collect(Collectors.toList());
udfFunctionMapper.batchUpdateUdfFunc(udfFuncs);
}
}
putMsg(result, Status.SUCCESS);
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<Object, Object> entry : new BeanMap(resource).entrySet()) {
if (!Constants.CLASS.equalsIgnoreCase(entry.getKey().toString())) {
resultMap.put(entry.getKey().toString(), entry.getValue());
}
}
result.setData(resultMap);
} catch (Exception e) {
logger.error(Status.UPDATE_RESOURCE_ERROR.getMsg(), e);
throw new ServiceException(Status.UPDATE_RESOURCE_ERROR);
}
if (originResourceName.equals(name) && file == null) {
return result;
}
if (file != null) {
if (!upload(loginUser, fullName, file, type)) {
logger.error("upload resource: {} file: {} failed.", name, RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.HDFS_OPERATION_ERROR);
throw new ServiceException(String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename()));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | if (!fullName.equals(originFullName)) {
try {
storageOperate.delete(tenantCode, originFileName, false);
} catch (IOException e) {
logger.error(e.getMessage(), e);
throw new ServiceException(String.format("delete resource: %s failed.", originFullName));
}
}
updateParentResourceSize(resource, resource.getSize() - originFileSize);
return result;
}
String destHdfsFileName = storageOperate.getFileName(resource.getType(), tenantCode, fullName);
try {
logger.info("start copy {} -> {}", originFileName, destHdfsFileName);
storageOperate.copy(originFileName, destHdfsFileName, true, true);
} catch (Exception e) {
logger.error(MessageFormat.format(" copy {0} -> {1} fail", originFileName, destHdfsFileName), e);
putMsg(result, Status.HDFS_COPY_FAIL);
throw new ServiceException(Status.HDFS_COPY_FAIL);
}
return result;
}
private Result<Object> verifyFile(String name, ResourceType type, MultipartFile file) {
Result<Object> result = new Result<>();
putMsg(result, Status.SUCCESS);
if (file != null) {
if (file.isEmpty()) {
logger.error("file is empty: {}", RegexUtils.escapeNRT(file.getOriginalFilename())); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | putMsg(result, Status.RESOURCE_FILE_IS_EMPTY);
return result;
}
String fileSuffix = Files.getFileExtension(file.getOriginalFilename());
String nameSuffix = Files.getFileExtension(name);
if (!(StringUtils.isNotEmpty(fileSuffix) && fileSuffix.equalsIgnoreCase(nameSuffix))) {
logger.error("rename file suffix and original suffix must be consistent: {}", RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.RESOURCE_SUFFIX_FORBID_CHANGE);
return result;
}
if (Constants.UDF.equals(type.name()) && !JAR.equalsIgnoreCase(fileSuffix)) {
logger.error(Status.UDF_RESOURCE_SUFFIX_NOT_JAR.getMsg());
putMsg(result, Status.UDF_RESOURCE_SUFFIX_NOT_JAR);
return result;
}
if (file.getSize() > Constants.MAX_FILE_SIZE) {
logger.error("file size is too large: {}", RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.RESOURCE_SIZE_EXCEED_LIMIT);
return result;
}
}
return result;
}
/**
* query resources list paging
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | * @param loginUser login user
* @param type resource type
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size
* @return resource list page
*/
@Override
public Result queryResourceListPaging(User loginUser, int directoryId, ResourceType type, String searchVal, Integer pageNo, Integer pageSize) {
Result result = new Result();
Page<Resource> page = new Page<>(pageNo, pageSize);
int userId = loginUser.getId();
if (isAdmin(loginUser)) {
userId = 0;
}
if (directoryId != -1) {
Resource directory = resourcesMapper.selectById(directoryId);
if (directory == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
}
List<Integer> resourcesIds = resourceUserMapper.queryResourcesIdListByUserIdAndPerm(userId, 0);
IPage<Resource> resourceIPage = resourcesMapper.queryResourcePaging(page, userId, directoryId, type.ordinal(), searchVal, resourcesIds);
PageInfo<Resource> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) resourceIPage.getTotal());
pageInfo.setTotalList(resourceIPage.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | }
/**
* create directory
* xxx The steps to verify resources are cumbersome and can be optimized
*
* @param loginUser login user
* @param fullName full name
* @param type resource type
* @param result Result
*/
private void createDirectory(User loginUser, String fullName, ResourceType type, Result<Object> result) {
String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();
String directoryName = storageOperate.getFileName(type, tenantCode, fullName);
String resourceRootPath = storageOperate.getDir(type, tenantCode);
try {
if (!storageOperate.exists(tenantCode, resourceRootPath)) {
storageOperate.createTenantDirIfNotExists(tenantCode);
}
if (!storageOperate.mkdir(tenantCode, directoryName)) {
logger.error("create resource directory {} failed", directoryName);
putMsg(result, Status.STORE_OPERATE_CREATE_ERROR);
throw new ServiceException(String.format("create resource directory: %s failed.", directoryName));
}
} catch (Exception e) {
logger.error("create resource directory {} failed", directoryName);
putMsg(result, Status.STORE_OPERATE_CREATE_ERROR);
throw new ServiceException(String.format("create resource directory: %s failed.", directoryName));
}
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | * upload file to hdfs
*
* @param loginUser login user
* @param fullName full name
* @param file file
*/
private boolean upload(User loginUser, String fullName, MultipartFile file, ResourceType type) {
String fileSuffix = Files.getFileExtension(file.getOriginalFilename());
String nameSuffix = Files.getFileExtension(fullName);
if (!(StringUtils.isNotEmpty(fileSuffix) && fileSuffix.equalsIgnoreCase(nameSuffix))) {
return false;
}
String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();
String localFilename = FileUtils.getUploadFilename(tenantCode, UUID.randomUUID().toString());
String fileName = storageOperate.getFileName(type, tenantCode, fullName);
String resourcePath = storageOperate.getDir(type, tenantCode);
try {
if (!storageOperate.exists(tenantCode, resourcePath)) {
storageOperate.createTenantDirIfNotExists(tenantCode);
}
org.apache.dolphinscheduler.api.utils.FileUtils.copyInputStreamToFile(file, localFilename);
storageOperate.upload(tenantCode, localFilename, fileName, true, true);
} catch (Exception e) {
FileUtils.deleteFile(localFilename); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | logger.error(e.getMessage(), e);
return false;
}
return true;
}
/**
* query resource list
*
* @param loginUser login user
* @param type resource type
* @return resource list
*/
@Override
public Map<String, Object> queryResourceList(User loginUser, ResourceType type) {
Map<String, Object> result = new HashMap<>();
List<Resource> allResourceList = queryAuthoredResourceList(loginUser, type);
Visitor resourceTreeVisitor = new ResourceTreeVisitor(allResourceList);
result.put(Constants.DATA_LIST, resourceTreeVisitor.visit().getChildren());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query resource list by program type
*
* @param loginUser login user
* @param type resource type
* @return resource list
*/
@Override
public Map<String, Object> queryResourceByProgramType(User loginUser, ResourceType type, ProgramType programType) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | Map<String, Object> result = new HashMap<>();
List<Resource> allResourceList = queryAuthoredResourceList(loginUser, type);
String suffix = ".jar";
if (programType != null) {
switch (programType) {
case JAVA:
case SCALA:
break;
case PYTHON:
suffix = ".py";
break;
default:
}
}
List<Resource> resources = new ResourceFilter(suffix, new ArrayList<>(allResourceList)).filter();
Visitor resourceTreeVisitor = new ResourceTreeVisitor(resources);
result.put(Constants.DATA_LIST, resourceTreeVisitor.visit().getChildren());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete resource
*
* @param loginUser login user
* @param resourceId resource id
* @return delete result code
* @throws IOException exception
*/
@Override
@Transactional(rollbackFor = Exception.class) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | public Result<Object> delete(User loginUser, int resourceId) throws IOException {
Result<Object> result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
Resource resource = resourcesMapper.selectById(resourceId);
if (resource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
if (!canOperator(loginUser, resource.getUserId())) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
String tenantCode = getTenantCode(resource.getUserId(), result);
if (StringUtils.isEmpty(tenantCode)) {
return result;
}
List<Map<String, Object>> list = processDefinitionMapper.listResources();
Map<Integer, Set<Long>> resourceProcessMap = ResourceProcessDefinitionUtils.getResourceProcessDefinitionMap(list);
Set<Integer> resourceIdSet = resourceProcessMap.keySet();
List<Integer> allChildren = listAllChildren(resource, true);
Integer[] needDeleteResourceIdArray = allChildren.toArray(new Integer[allChildren.size()]);
if (resource.getType() == (ResourceType.UDF)) {
List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(needDeleteResourceIdArray);
if (CollectionUtils.isNotEmpty(udfFuncs)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | logger.error("can't be deleted,because it is bound by UDF functions:{}", udfFuncs);
putMsg(result, Status.UDF_RESOURCE_IS_BOUND, udfFuncs.get(0).getFuncName());
return result;
}
}
if (resourceIdSet.contains(resource.getPid())) {
logger.error("can't be deleted,because it is used of process definition");
putMsg(result, Status.RESOURCE_IS_USED);
return result;
}
resourceIdSet.retainAll(allChildren);
if (CollectionUtils.isNotEmpty(resourceIdSet)) {
logger.error("can't be deleted,because it is used of process definition");
for (Integer resId : resourceIdSet) {
logger.error("resource id:{} is used of process definition {}",resId,resourceProcessMap.get(resId));
}
putMsg(result, Status.RESOURCE_IS_USED);
return result;
}
String storageFilename = storageOperate.getFileName(resource.getType(), tenantCode, resource.getFullName());
resourcesMapper.selectBatchIds(Arrays.asList(needDeleteResourceIdArray)).forEach(item -> {
updateParentResourceSize(item, item.getSize() * -1);
});
resourcesMapper.deleteIds(needDeleteResourceIdArray);
resourceUserMapper.deleteResourceUserArray(0, needDeleteResourceIdArray);
storageOperate.delete(tenantCode, storageFilename, true); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | putMsg(result, Status.SUCCESS);
return result;
}
/**
* verify resource by name and type
*
* @param loginUser login user
* @param fullName resource full name
* @param type resource type
* @return true if the resource name not exists, otherwise return false
*/
@Override
public Result<Object> verifyResourceName(String fullName, ResourceType type, User loginUser) {
Result<Object> result = new Result<>();
putMsg(result, Status.SUCCESS);
if (checkResourceExists(fullName, type.ordinal())) {
logger.error("resource type:{} name:{} has exist, can't create again.", type, RegexUtils.escapeNRT(fullName));
putMsg(result, Status.RESOURCE_EXIST);
} else {
Tenant tenant = tenantMapper.queryById(loginUser.getTenantId());
if (tenant != null) {
String tenantCode = tenant.getTenantCode();
try {
String filename = storageOperate.getFileName(type, tenantCode, fullName);
if (storageOperate.exists(tenantCode, filename)) {
putMsg(result, Status.RESOURCE_FILE_EXIST, filename);
}
} catch (Exception e) {
logger.error("verify resource failed and the reason is {}", e.getMessage()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | putMsg(result, Status.STORE_OPERATE_CREATE_ERROR);
}
} else {
putMsg(result, Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST);
}
}
return result;
}
/**
* verify resource by full name or pid and type
*
* @param fullName resource full name
* @param id resource id
* @param type resource type
* @return true if the resource full name or pid not exists, otherwise return false
*/
@Override
public Result<Object> queryResource(String fullName, Integer id, ResourceType type) {
Result<Object> result = new Result<>();
if (StringUtils.isBlank(fullName) && id == null) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
return result;
}
if (StringUtils.isNotBlank(fullName)) {
List<Resource> resourceList = resourcesMapper.queryResource(fullName, type.ordinal());
if (CollectionUtils.isEmpty(resourceList)) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
putMsg(result, Status.SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | result.setData(resourceList.get(0));
} else {
Resource resource = resourcesMapper.selectById(id);
if (resource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
Resource parentResource = resourcesMapper.selectById(resource.getPid());
if (parentResource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
putMsg(result, Status.SUCCESS);
result.setData(parentResource);
}
return result;
}
/**
* get resource by id
* @param id resource id
* @return resource
*/
@Override
public Result<Object> queryResourceById(Integer id) {
Result<Object> result = new Result<>();
Resource resource = resourcesMapper.selectById(id);
if (resource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | putMsg(result, Status.SUCCESS);
result.setData(resource);
return result;
}
/**
* view resource file online
*
* @param resourceId resource id
* @param skipLineNum skip line number
* @param limit limit
* @return resource content
*/
@Override
public Result<Object> readResource(int resourceId, int skipLineNum, int limit) {
Result<Object> result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
Resource resource = resourcesMapper.selectById(resourceId);
if (resource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
String nameSuffix = Files.getFileExtension(resource.getAlias());
String resourceViewSuffixes = FileUtils.getResourceViewSuffixes();
if (StringUtils.isNotEmpty(resourceViewSuffixes)) {
List<String> strList = Arrays.asList(resourceViewSuffixes.split(","));
if (!strList.contains(nameSuffix)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | logger.error("resource suffix {} not support view, resource id {}", nameSuffix, resourceId);
putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW);
return result;
}
}
String tenantCode = getTenantCode(resource.getUserId(), result);
if (StringUtils.isEmpty(tenantCode)) {
return result;
}
String resourceFileName = storageOperate.getResourceFileName(tenantCode, resource.getFullName());
logger.info("resource path is {}", resourceFileName);
try {
if (storageOperate.exists(tenantCode, resourceFileName)) {
List<String> content = storageOperate.vimFile(tenantCode, resourceFileName, skipLineNum, limit);
putMsg(result, Status.SUCCESS);
Map<String, Object> map = new HashMap<>();
map.put(ALIAS, resource.getAlias());
map.put(CONTENT, String.join("\n", content));
result.setData(map);
} else {
logger.error("read file {} not exist in storage", resourceFileName);
putMsg(result, Status.RESOURCE_FILE_NOT_EXIST, resourceFileName);
}
} catch (Exception e) {
logger.error("Resource {} read failed", resourceFileName, e);
putMsg(result, Status.HDFS_OPERATION_ERROR);
}
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | /**
* create resource file online
*
* @param loginUser login user
* @param type resource type
* @param fileName file name
* @param fileSuffix file suffix
* @param desc description
* @param content content
* @param pid pid
* @param currentDir current directory
* @return create result code
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> onlineCreateResource(User loginUser, ResourceType type, String fileName, String fileSuffix, String desc, String content, int pid, String currentDir) {
Result<Object> result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
String nameSuffix = fileSuffix.trim();
String resourceViewSuffixes = FileUtils.getResourceViewSuffixes();
if (StringUtils.isNotEmpty(resourceViewSuffixes)) {
List<String> strList = Arrays.asList(resourceViewSuffixes.split(","));
if (!strList.contains(nameSuffix)) {
logger.error("resource suffix {} not support create", nameSuffix);
putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | }
String name = fileName.trim() + "." + nameSuffix;
String fullName = getFullName(currentDir, name);
result = verifyResource(loginUser, type, fullName, pid);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
Date now = new Date();
Resource resource = new Resource(pid, name, fullName, false, desc, name, loginUser.getId(), type, content.getBytes().length, now, now);
resourcesMapper.insert(resource);
updateParentResourceSize(resource, resource.getSize());
putMsg(result, Status.SUCCESS);
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<Object, Object> entry : new BeanMap(resource).entrySet()) {
if (!Constants.CLASS.equalsIgnoreCase(entry.getKey().toString())) {
resultMap.put(entry.getKey().toString(), entry.getValue());
}
}
result.setData(resultMap);
String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();
result = uploadContentToStorage(fullName, tenantCode, content);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
throw new ServiceException(result.getMsg());
}
return result;
}
private Result<Object> checkResourceUploadStartupState() {
Result<Object> result = new Result<>();
putMsg(result, Status.SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | if (!PropertyUtils.getResUploadStartupState()) {
logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState());
putMsg(result, Status.STORAGE_NOT_STARTUP);
return result;
}
return result;
}
private Result<Object> verifyResource(User loginUser, ResourceType type, String fullName, int pid) {
Result<Object> result = verifyResourceName(fullName, type, loginUser);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
return verifyPid(loginUser, pid);
}
private Result<Object> verifyPid(User loginUser, int pid) {
Result<Object> result = new Result<>();
putMsg(result, Status.SUCCESS);
if (pid != -1) {
Resource parentResource = resourcesMapper.selectById(pid);
if (parentResource == null) {
putMsg(result, Status.PARENT_RESOURCE_NOT_EXIST);
return result;
}
if (!canOperator(loginUser, parentResource.getUserId())) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
}
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | }
/**
* updateProcessInstance resource
*
* @param resourceId resource id
* @param content content
* @return update result cod
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> updateResourceContent(int resourceId, String content) {
Result<Object> result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
Resource resource = resourcesMapper.selectById(resourceId);
if (resource == null) {
logger.error("read file not exist, resource id {}", resourceId);
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
String nameSuffix = Files.getFileExtension(resource.getAlias());
String resourceViewSuffixes = FileUtils.getResourceViewSuffixes();
if (StringUtils.isNotEmpty(resourceViewSuffixes)) {
List<String> strList = Arrays.asList(resourceViewSuffixes.split(","));
if (!strList.contains(nameSuffix)) {
logger.error("resource suffix {} not support updateProcessInstance, resource id {}", nameSuffix, resourceId);
putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | }
}
String tenantCode = getTenantCode(resource.getUserId(), result);
if (StringUtils.isEmpty(tenantCode)) {
return result;
}
long originFileSize = resource.getSize();
resource.setSize(content.getBytes().length);
resource.setUpdateTime(new Date());
resourcesMapper.updateById(resource);
result = uploadContentToStorage(resource.getFullName(), tenantCode, content);
updateParentResourceSize(resource, resource.getSize() - originFileSize);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
throw new ServiceException(result.getMsg());
}
return result;
}
/**
* @param resourceName resource name
* @param tenantCode tenant code
* @param content content
* @return result
*/
private Result<Object> uploadContentToStorage(String resourceName, String tenantCode, String content) {
Result<Object> result = new Result<>();
String localFilename = "";
String storageFileName = "";
try {
localFilename = FileUtils.getUploadFilename(tenantCode, UUID.randomUUID().toString());
if (!FileUtils.writeContent2File(content, localFilename)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | logger.error("file {} fail, content is {}", localFilename, RegexUtils.escapeNRT(content));
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
storageFileName = storageOperate.getResourceFileName(tenantCode, resourceName);
String resourcePath = storageOperate.getResDir(tenantCode);
logger.info("resource path is {}, resource dir is {}", storageFileName, resourcePath);
if (!storageOperate.exists(tenantCode, resourcePath)) {
storageOperate.createTenantDirIfNotExists(tenantCode);
}
if (storageOperate.exists(tenantCode, storageFileName)) {
storageOperate.delete(tenantCode, storageFileName, false);
}
storageOperate.upload(tenantCode, localFilename, storageFileName, true, true);
} catch (Exception e) {
logger.error(e.getMessage(), e);
result.setCode(Status.HDFS_OPERATION_ERROR.getCode());
result.setMsg(String.format("copy %s to hdfs %s fail", localFilename, storageFileName));
return result;
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* download file
*
* @param resourceId resource id |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | * @return resource content
* @throws IOException exception
*/
@Override
public org.springframework.core.io.Resource downloadResource(int resourceId) throws IOException {
if (!PropertyUtils.getResUploadStartupState()) {
logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState());
throw new ServiceException("hdfs not startup");
}
Resource resource = resourcesMapper.selectById(resourceId);
if (resource == null) {
logger.error("download file not exist, resource id {}", resourceId);
return null;
}
if (resource.isDirectory()) {
logger.error("resource id {} is directory,can't download it", resourceId);
throw new ServiceException("can't download directory");
}
int userId = resource.getUserId();
User user = userMapper.selectById(userId);
if (user == null) {
logger.error("user id {} not exists", userId);
throw new ServiceException(String.format("resource owner id %d not exist", userId));
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (tenant == null) {
logger.error("tenant id {} not exists", user.getTenantId());
throw new ServiceException(String.format("The tenant id %d of resource owner not exist", user.getTenantId()));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | String tenantCode = tenant.getTenantCode();
String fileName = storageOperate.getFileName(resource.getType(), tenantCode, resource.getFullName());
String localFileName = FileUtils.getDownloadFilename(resource.getAlias());
logger.info("resource path is {}, download local filename is {}", fileName, localFileName);
try {
storageOperate.download(tenantCode, fileName, localFileName, false, true);
return org.apache.dolphinscheduler.api.utils.FileUtils.file2Resource(localFileName);
} catch (IOException e) {
logger.error("download resource error, the path is {}, and local filename is {}, the error message is {}", fileName, localFileName, e.getMessage());
throw new ServerException("download the resource file failed ,it may be related to your storage");
}
}
/**
* list all file
*
* @param loginUser login user
* @param userId user id
* @return unauthorized result code
*/
@Override
public Map<String, Object> authorizeResourceTree(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
List<Resource> resourceList;
if (isAdmin(loginUser)) {
resourceList = resourcesMapper.queryResourceExceptUserId(userId);
} else {
resourceList = resourcesMapper.queryResourceListAuthored(loginUser.getId(), -1);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | List<ResourceComponent> list;
if (CollectionUtils.isNotEmpty(resourceList)) {
Visitor visitor = new ResourceTreeVisitor(resourceList);
list = visitor.visit().getChildren();
} else {
list = new ArrayList<>(0);
}
result.put(Constants.DATA_LIST, list);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* unauthorized file
*
* @param loginUser login user
* @param userId user id
* @return unauthorized result code
*/
@Override
public Map<String, Object> unauthorizedFile(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
List<Resource> resourceList;
if (isAdmin(loginUser)) {
resourceList = resourcesMapper.queryResourceExceptUserId(userId);
} else {
resourceList = resourcesMapper.queryResourceListAuthored(loginUser.getId(), -1);
}
List<Resource> list; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | if (resourceList != null && !resourceList.isEmpty()) {
Set<Resource> resourceSet = new HashSet<>(resourceList);
List<Resource> authedResourceList = queryResourceList(userId, Constants.AUTHORIZE_WRITABLE_PERM);
getAuthorizedResourceList(resourceSet, authedResourceList);
list = new ArrayList<>(resourceSet);
} else {
list = new ArrayList<>(0);
}
Visitor visitor = new ResourceTreeVisitor(list);
result.put(Constants.DATA_LIST, visitor.visit().getChildren());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* unauthorized udf function
*
* @param loginUser login user
* @param userId user id
* @return unauthorized result code
*/
@Override
public Map<String, Object> unauthorizedUDFFunction(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
List<UdfFunc> udfFuncList;
if (isAdmin(loginUser)) {
udfFuncList = udfFunctionMapper.queryUdfFuncExceptUserId(userId);
} else {
udfFuncList = udfFunctionMapper.selectByMap(Collections.singletonMap("user_id", loginUser.getId())); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | }
List<UdfFunc> resultList = new ArrayList<>();
Set<UdfFunc> udfFuncSet;
if (CollectionUtils.isNotEmpty(udfFuncList)) {
udfFuncSet = new HashSet<>(udfFuncList);
List<UdfFunc> authedUDFFuncList = udfFunctionMapper.queryAuthedUdfFunc(userId);
getAuthorizedResourceList(udfFuncSet, authedUDFFuncList);
resultList = new ArrayList<>(udfFuncSet);
}
result.put(Constants.DATA_LIST, resultList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* authorized udf function
*
* @param loginUser login user
* @param userId user id
* @return authorized result code
*/
@Override
public Map<String, Object> authorizedUDFFunction(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
List<UdfFunc> udfFuncs = udfFunctionMapper.queryAuthedUdfFunc(userId);
result.put(Constants.DATA_LIST, udfFuncs);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* authorized file |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | *
* @param loginUser login user
* @param userId user id
* @return authorized result
*/
@Override
public Map<String, Object> authorizedFile(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
List<Resource> authedResources = queryResourceList(userId, Constants.AUTHORIZE_WRITABLE_PERM);
Visitor visitor = new ResourceTreeVisitor(authedResources);
String visit = JSONUtils.toJsonString(visitor.visit(), SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS);
logger.info(visit);
String jsonTreeStr = JSONUtils.toJsonString(visitor.visit().getChildren(), SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS);
logger.info(jsonTreeStr);
result.put(Constants.DATA_LIST, visitor.visit().getChildren());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get authorized resource list
*
* @param resourceSet resource set
* @param authedResourceList authorized resource list
*/
private void getAuthorizedResourceList(Set<?> resourceSet, List<?> authedResourceList) {
Set<?> authedResourceSet;
if (CollectionUtils.isNotEmpty(authedResourceList)) {
authedResourceSet = new HashSet<>(authedResourceList);
resourceSet.removeAll(authedResourceSet);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | }
/**
* get tenantCode by UserId
*
* @param userId user id
* @param result return result
* @return tenant code
*/
private String getTenantCode(int userId, Result<Object> result) {
User user = userMapper.selectById(userId);
if (user == null) {
logger.error("user {} not exists", userId);
putMsg(result, Status.USER_NOT_EXIST, userId);
return null;
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (tenant == null) {
logger.error("tenant not exists");
putMsg(result, Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST);
return null;
}
return tenant.getTenantCode();
}
/**
* list all children id
*
* @param resource resource
* @param containSelf whether add self to children list
* @return all children id
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | List<Integer> listAllChildren(Resource resource, boolean containSelf) {
List<Integer> childList = new ArrayList<>();
if (resource.getId() != -1 && containSelf) {
childList.add(resource.getId());
}
if (resource.isDirectory()) {
listAllChildren(resource.getId(), childList);
}
return childList;
}
/**
* list all children id
*
* @param resourceId resource id
* @param childList child list
*/
void listAllChildren(int resourceId, List<Integer> childList) {
List<Integer> children = resourcesMapper.listChildren(resourceId);
for (int childId : children) {
childList.add(childId);
listAllChildren(childId, childList);
}
}
/**
* query authored resource list (own and authorized)
*
* @param loginUser login user
* @param type ResourceType
* @return all authored resource list
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,502 | [Improvement][Api] Support to upload file without file type suffix | ### 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 uploading a file without file type suffix, an error will be reported as shown below, which is not the expected behavior by users.
We should support upload files without file type suffix.

### Use case
_No response_
### Related issues
_No response_
### 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/9502 | https://github.com/apache/dolphinscheduler/pull/9553 | 36f01155b5c528cd7551c0d79662ba62b3de1677 | 267b307632525b5a58a2dc593df1c140cd481a15 | 2022-04-14T07:41:23Z | java | 2022-04-22T06:42:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | private List<Resource> queryAuthoredResourceList(User loginUser, ResourceType type) {
List<Resource> relationResources;
int userId = loginUser.getId();
if (isAdmin(loginUser)) {
userId = 0;
relationResources = new ArrayList<>();
} else {
relationResources = queryResourceList(userId, 0);
}
List<Resource> relationTypeResources =
relationResources.stream().filter(rs -> rs.getType() == type).collect(Collectors.toList());
List<Resource> ownResourceList = resourcesMapper.queryResourceListAuthored(userId, type.ordinal());
ownResourceList.addAll(relationTypeResources);
return ownResourceList;
}
/**
* query resource list by userId and perm
*
* @param userId userId
* @param perm perm
* @return resource list
*/
private List<Resource> queryResourceList(Integer userId, int perm) {
List<Integer> resIds = resourceUserMapper.queryResourcesIdListByUserIdAndPerm(userId, perm);
return CollectionUtils.isEmpty(resIds) ? new ArrayList<>() : resourcesMapper.queryResourceListById(resIds);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.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.api.controller; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | import static org.apache.dolphinscheduler.api.enums.Status.BATCH_COPY_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.BATCH_DELETE_PROCESS_DEFINE_BY_CODES_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.BATCH_MOVE_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.CREATE_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_PROCESS_DEFINITION_VERSION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.ENCAPSULATION_TREEVIEW_STRUCTURE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.IMPORT_PROCESS_DEFINE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_DETAIL_OF_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROCESS_DEFINITION_LIST;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROCESS_DEFINITION_LIST_PAGING_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROCESS_DEFINITION_VERSIONS_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.RELEASE_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR;
import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import springfox.documentation.annotations.ApiIgnore;
/**
* process definition controller
*/
@Api(tags = "PROCESS_DEFINITION_TAG") |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @RestController
@RequestMapping("projects/{projectCode}/process-definition")
public class ProcessDefinitionController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionController.class);
@Autowired
private ProcessDefinitionService processDefinitionService;
/**
* create process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams globalParams
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return create result code
*/
@ApiOperation(value = "createProcessDefinition", notes = "CREATE_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"),
@ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"),
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String")
})
@PostMapping()
@ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result createProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "name", required = true) String name,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "globalParams", required = false, defaultValue = "[]") String globalParams,
@RequestParam(value = "locations", required = false) String locations,
@RequestParam(value = "timeout", required = false, defaultValue = "0") int timeout,
@RequestParam(value = "tenantCode", required = true) String tenantCode,
@RequestParam(value = "taskRelationJson", required = true) String taskRelationJson,
@RequestParam(value = "taskDefinitionJson", required = true) String taskDefinitionJson,
@RequestParam(value = "executionType", defaultValue = "PARALLEL") ProcessExecutionTypeEnum executionType) {
Map<String, Object> result = processDefinitionService.createProcessDefinition(loginUser, projectCode, name, description, globalParams,
locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson,executionType);
return returnDataList(result);
}
/**
* copy process definition
*
* @param loginUser login user
* @param projectCode project code
* @param codes process definition codes
* @param targetProjectCode target project code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | * @return copy result code
*/
@ApiOperation(value = "batchCopyByCodes", notes = "COPY_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "codes", value = "PROCESS_DEFINITION_CODES", required = true, dataType = "String", example = "3,4"),
@ApiImplicitParam(name = "targetProjectCode", value = "TARGET_PROJECT_CODE", required = true, dataType = "Long", example = "123")
})
@PostMapping(value = "/batch-copy")
@ResponseStatus(HttpStatus.OK)
@ApiException(BATCH_COPY_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result copyProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "codes", required = true) String codes,
@RequestParam(value = "targetProjectCode", required = true) long targetProjectCode) {
return returnDataList(processDefinitionService.batchCopyProcessDefinition(loginUser, projectCode, codes, targetProjectCode));
}
/**
* move process definition
*
* @param loginUser login user
* @param projectCode project code
* @param codes process definition codes
* @param targetProjectCode target project code
* @return move result code
*/
@ApiOperation(value = "batchMoveByCodes", notes = "MOVE_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "codes", value = "PROCESS_DEFINITION_CODES", required = true, dataType = "String", example = "3,4"),
@ApiImplicitParam(name = "targetProjectCode", value = "TARGET_PROJECT_CODE", required = true, dataType = "Long", example = "123") |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | })
@PostMapping(value = "/batch-move")
@ResponseStatus(HttpStatus.OK)
@ApiException(BATCH_MOVE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result moveProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "codes", required = true) String codes,
@RequestParam(value = "targetProjectCode", required = true) long targetProjectCode) {
return returnDataList(processDefinitionService.batchMoveProcessDefinition(loginUser, projectCode, codes, targetProjectCode));
}
/**
* verify process definition name unique
*
* @param loginUser login user
* @param projectCode project code
* @param name name
* @return true if process definition name not exists, otherwise false
*/
@ApiOperation(value = "verify-name", notes = "VERIFY_PROCESS_DEFINITION_NAME_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String")
})
@GetMapping(value = "/verify-name")
@ResponseStatus(HttpStatus.OK)
@ApiException(VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result verifyProcessDefinitionName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "name", required = true) String name) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | Map<String, Object> result = processDefinitionService.verifyProcessDefinitionName(loginUser, projectCode, name);
return returnDataList(result);
}
/**
* update process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams globalParams
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return update result code
*/
@ApiOperation(value = "update", notes = "UPDATE_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"),
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789"),
@ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"),
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String"),
@ApiImplicitParam(name = "releaseState", value = "RELEASE_PROCESS_DEFINITION_NOTES", required = false, dataType = "ReleaseState")
})
@PutMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_PROCESS_DEFINITION_ERROR) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "name", required = true) String name,
@PathVariable(value = "code", required = true) long code,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "globalParams", required = false, defaultValue = "[]") String globalParams,
@RequestParam(value = "locations", required = false) String locations,
@RequestParam(value = "timeout", required = false, defaultValue = "0") int timeout,
@RequestParam(value = "tenantCode", required = true) String tenantCode,
@RequestParam(value = "taskRelationJson", required = true) String taskRelationJson,
@RequestParam(value = "taskDefinitionJson", required = true) String taskDefinitionJson,
@RequestParam(value = "executionType", defaultValue = "PARALLEL") ProcessExecutionTypeEnum executionType,
@RequestParam(value = "releaseState", required = false, defaultValue = "OFFLINE") ReleaseState releaseState) {
Map<String, Object> result = processDefinitionService.updateProcessDefinition(loginUser, projectCode, name, code, description, globalParams,
locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson,executionType);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return returnDataList(result);
}
if (releaseState == ReleaseState.ONLINE) {
result = processDefinitionService.releaseProcessDefinition(loginUser, projectCode, code, releaseState);
}
return returnDataList(result);
}
/**
* query process definition version paging list info
*
* @param loginUser login user info |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | * @param projectCode project code
* @param pageNo the process definition version list current page number
* @param pageSize the process definition version list page size
* @param code the process definition code
* @return the process definition version list
*/
@ApiOperation(value = "queryVersions", notes = "QUERY_PROCESS_DEFINITION_VERSIONS_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10"),
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "1")
})
@GetMapping(value = "/{code}/versions")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_VERSIONS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProcessDefinitionVersions(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "pageNo") int pageNo,
@RequestParam(value = "pageSize") int pageSize,
@PathVariable(value = "code") long code) {
Result result = checkPageParams(pageNo, pageSize);
if (!result.checkResult()) {
return result;
}
result = processDefinitionService.queryProcessDefinitionVersions(loginUser, projectCode, pageNo, pageSize, code);
return result;
}
/**
* switch certain process definition version |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | *
* @param loginUser login user info
* @param projectCode project code
* @param code the process definition code
* @param version the version user want to switch
* @return switch version result code
*/
@ApiOperation(value = "switchVersion", notes = "SWITCH_PROCESS_DEFINITION_VERSION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "1"),
@ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/{code}/versions/{version}")
@ResponseStatus(HttpStatus.OK)
@ApiException(SWITCH_PROCESS_DEFINITION_VERSION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result switchProcessDefinitionVersion(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code") long code,
@PathVariable(value = "version") int version) {
Map<String, Object> result = processDefinitionService.switchProcessDefinitionVersion(loginUser, projectCode, code, version);
return returnDataList(result);
}
/**
* delete the certain process definition version by version and process definition code
*
* @param loginUser login user info
* @param projectCode project code
* @param code the process definition code
* @param version the process definition version user want to delete |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | * @return delete version result code
*/
@ApiOperation(value = "deleteVersion", notes = "DELETE_PROCESS_DEFINITION_VERSION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "1"),
@ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Int", example = "100")
})
@DeleteMapping(value = "/{code}/versions/{version}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_PROCESS_DEFINITION_VERSION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteProcessDefinitionVersion(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code") long code,
@PathVariable(value = "version") int version) {
Map<String, Object> result = processDefinitionService.deleteProcessDefinitionVersion(loginUser, projectCode, code, version);
return returnDataList(result);
}
/**
* release process definition
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState release state
* @return release result code
*/
@ApiOperation(value = "release", notes = "RELEASE_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789"),
@ApiImplicitParam(name = "releaseState", value = "PROCESS_DEFINITION_RELEASE", required = true, dataType = "ReleaseState"),
})
@PostMapping(value = "/{code}/release")
@ResponseStatus(HttpStatus.OK)
@ApiException(RELEASE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result releaseProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code", required = true) long code,
@RequestParam(value = "releaseState", required = true) ReleaseState releaseState) {
Map<String, Object> result = processDefinitionService.releaseProcessDefinition(loginUser, projectCode, code, releaseState);
return returnDataList(result);
}
/**
* query detail of process definition by code
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return process definition detail
*/
@ApiOperation(value = "queryProcessDefinitionByCode", notes = "QUERY_PROCESS_DEFINITION_BY_CODE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789")
})
@GetMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DETAIL_OF_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | public Result queryProcessDefinitionByCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code", required = true) long code) {
Map<String, Object> result = processDefinitionService.queryProcessDefinitionByCode(loginUser, projectCode, code);
return returnDataList(result);
}
/**
* query detail of process definition by name
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @return process definition detail
*/
@ApiOperation(value = "queryProcessDefinitionByName", notes = "QUERY_PROCESS_DEFINITION_BY_NAME_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, dataType = "String")
})
@GetMapping(value = "/query-by-name")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DETAIL_OF_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result<ProcessDefinition> queryProcessDefinitionByName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("name") String name) {
Map<String, Object> result = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, name);
return returnDataList(result);
}
/**
* query Process definition list |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,668 | [Improvement] Workflow definition and workflow instance response description is unclear when deleting, details are in the log. | ### 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
The response description of the workflow definition and workflow instance is not clear when deleting, I see the specific reason for the pull response error in the log.
### Use case
Create multiple workflow definitions or workflow instances, and then perform batch delete operations.
### Related issues
_No response_
### 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/9668 | https://github.com/apache/dolphinscheduler/pull/9669 | b564e58cf365ef0d065d3527bad9f79a8e15c71c | 387ebe5bb06ff76a7a62bc901087c8d4ba2ee544 | 2022-04-22T09:19:46Z | java | 2022-04-22T10:17:22Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | *
* @param loginUser login user
* @param projectCode project code
* @return process definition list
*/
@ApiOperation(value = "queryList", notes = "QUERY_PROCESS_DEFINITION_LIST_NOTES")
@GetMapping(value = "/list")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_LIST)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProcessDefinitionList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode) {
Map<String, Object> result = processDefinitionService.queryProcessDefinitionList(loginUser, projectCode);
return returnDataList(result);
}
/**
* query Process definition simple list
*
* @param loginUser login user
* @param projectCode project code
* @return process definition list
*/
@ApiOperation(value = "querySimpleList", notes = "QUERY_PROCESS_DEFINITION_SIMPLE_LIST_NOTES")
@GetMapping(value = "/simple-list")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_LIST)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProcessDefinitionSimpleList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode) {
Map<String, Object> result = processDefinitionService.queryProcessDefinitionSimpleList(loginUser, projectCode); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.