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 | 8,056 | [Bug] [Environment Edit Worker Group] Edit the bug of worker grouping in environment management. | ### 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
### There are problems in Dev and 202 and 203
- Create a new environment, configure workers, and select multiple groups

Edit this data and delete two groups.

Edit interface request succeeded.

The list interface returns no group.


### What you expected to happen
After editing the calling interface, the worker group retains a piece of data that should be returned in the list interface, but the data returned from the list interface is empty.
### How to reproduce
For the data of the new environment, the worker selects multiple data and edits the data just created. The worker keeps at least one data, and then the data returned from the list interface is empty
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8056 | https://github.com/apache/dolphinscheduler/pull/8072 | c0d69125eb1c8ddb2993697533e9b490f2611cc1 | 7391cc20f01bef62b9a30f7b6b7f54fb41bdab03 | 2022-01-15T02:19:47Z | java | 2022-01-17T02:30:40Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java | return result;
}
/**
* verify environment name
*
* @param environmentName environment name
* @return true if the environment name not exists, otherwise return false
*/
@Override
public Map<String, Object> verifyEnvironment(String environmentName) {
Map<String, Object> result = new HashMap<>();
if (StringUtils.isEmpty(environmentName)) {
putMsg(result, Status.ENVIRONMENT_NAME_IS_NULL);
return result;
}
Environment environment = environmentMapper.queryByEnvironmentName(environmentName);
if (environment != null) {
putMsg(result, Status.ENVIRONMENT_NAME_EXISTS, environmentName);
return result;
}
result.put(Constants.STATUS, Status.SUCCESS);
return result;
}
private Map<String, Object> checkUsedEnvironmentWorkerGroupRelation(Set<String> deleteKeySet,String environmentName, Long environmentCode) {
Map<String, Object> result = new HashMap<>();
for (String workerGroup : deleteKeySet) {
TaskDefinition taskDefinition = taskDefinitionMapper
.selectOne(new QueryWrapper<TaskDefinition>().lambda()
.eq(TaskDefinition::getEnvironmentCode,environmentCode)
.eq(TaskDefinition::getWorkerGroup,workerGroup)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,056 | [Bug] [Environment Edit Worker Group] Edit the bug of worker grouping in environment management. | ### 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
### There are problems in Dev and 202 and 203
- Create a new environment, configure workers, and select multiple groups

Edit this data and delete two groups.

Edit interface request succeeded.

The list interface returns no group.


### What you expected to happen
After editing the calling interface, the worker group retains a piece of data that should be returned in the list interface, but the data returned from the list interface is empty.
### How to reproduce
For the data of the new environment, the worker selects multiple data and edits the data just created. The worker keeps at least one data, and then the data returned from the list interface is empty
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8056 | https://github.com/apache/dolphinscheduler/pull/8072 | c0d69125eb1c8ddb2993697533e9b490f2611cc1 | 7391cc20f01bef62b9a30f7b6b7f54fb41bdab03 | 2022-01-15T02:19:47Z | java | 2022-01-17T02:30:40Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java | if (Objects.nonNull(taskDefinition)) {
putMsg(result, Status.UPDATE_ENVIRONMENT_WORKER_GROUP_RELATION_ERROR,workerGroup,environmentName,taskDefinition.getName());
return result;
}
}
result.put(Constants.STATUS, Status.SUCCESS);
return result;
}
public Map<String, Object> checkParams(String name, String config, String workerGroups) {
Map<String, Object> result = new HashMap<>();
if (StringUtils.isEmpty(name)) {
putMsg(result, Status.ENVIRONMENT_NAME_IS_NULL);
return result;
}
if (StringUtils.isEmpty(config)) {
putMsg(result, Status.ENVIRONMENT_CONFIG_IS_NULL);
return result;
}
if (!StringUtils.isEmpty(workerGroups)) {
List<String> workerGroupList = JSONUtils.parseObject(workerGroups, new TypeReference<List<String>>(){});
if (Objects.isNull(workerGroupList)) {
putMsg(result, Status.ENVIRONMENT_WORKER_GROUPS_IS_INVALID);
return result;
}
}
result.put(Constants.STATUS, Status.SUCCESS);
return result;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/AbstractCycle.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.service.quartz.cron;
import org.apache.dolphinscheduler.common.enums.CycleEnum;
import com.cronutils.model.Cron;
import com.cronutils.model.field.CronField; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/AbstractCycle.java | import com.cronutils.model.field.CronFieldName;
import com.cronutils.model.field.expression.Always;
import com.cronutils.model.field.expression.And;
import com.cronutils.model.field.expression.Between;
import com.cronutils.model.field.expression.Every;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.model.field.expression.On;
/**
* Cycle
*/
public abstract class AbstractCycle {
protected Cron cron;
protected CronField minField;
protected CronField hourField;
protected CronField dayOfMonthField;
protected CronField dayOfWeekField;
protected CronField monthField;
protected CronField yearField;
public CycleLinks addCycle(AbstractCycle cycle) {
return new CycleLinks(this.cron).addCycle(this).addCycle(cycle);
}
/**
* cycle constructor
*
* @param cron cron
*/
protected AbstractCycle(Cron cron) {
if (cron == null) {
throw new IllegalArgumentException("cron must not be null!");
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/AbstractCycle.java | this.cron = cron;
this.minField = cron.retrieve(CronFieldName.MINUTE);
this.hourField = cron.retrieve(CronFieldName.HOUR);
this.dayOfMonthField = cron.retrieve(CronFieldName.DAY_OF_MONTH);
this.dayOfWeekField = cron.retrieve(CronFieldName.DAY_OF_WEEK);
this.monthField = cron.retrieve(CronFieldName.MONTH);
this.yearField = cron.retrieve(CronFieldName.YEAR);
}
/**
* whether the minute field has a value
*
* @return if minute field has a value return true,else return false
*/
protected boolean minFiledIsSetAll() {
FieldExpression minFieldExpression = minField.getExpression();
return (minFieldExpression instanceof Every || minFieldExpression instanceof Always
|| minFieldExpression instanceof Between || minFieldExpression instanceof And
|| minFieldExpression instanceof On);
}
/**
* whether the minute field has a value of every or always
*
* @return if minute field has a value of every or always return true,else return false
*/
protected boolean minFiledIsEvery() {
FieldExpression minFieldExpression = minField.getExpression();
return (minFieldExpression instanceof Every || minFieldExpression instanceof Always);
}
/**
* whether the hour field has a value |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/AbstractCycle.java | *
* @return if hour field has a value return true,else return false
*/
protected boolean hourFiledIsSetAll() {
FieldExpression hourFieldExpression = hourField.getExpression();
return (hourFieldExpression instanceof Every || hourFieldExpression instanceof Always
|| hourFieldExpression instanceof Between || hourFieldExpression instanceof And
|| hourFieldExpression instanceof On);
}
/**
* whether the hour field has a value of every or always
*
* @return if hour field has a value of every or always return true,else return false
*/
protected boolean hourFiledIsEvery() {
FieldExpression hourFieldExpression = hourField.getExpression();
return (hourFieldExpression instanceof Every || hourFieldExpression instanceof Always);
}
/**
* whether the day Of month field has a value
*
* @return if day Of month field has a value return true,else return false
*/
protected boolean dayOfMonthFieldIsSetAll() {
return (dayOfMonthField.getExpression() instanceof Every || dayOfMonthField.getExpression() instanceof Always
|| dayOfMonthField.getExpression() instanceof Between || dayOfMonthField.getExpression() instanceof And
|| dayOfMonthField.getExpression() instanceof On);
}
/**
* whether the day Of Month field has a value of every or always |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/AbstractCycle.java | *
* @return if day Of Month field has a value of every or always return true,else return false
*/
protected boolean dayOfMonthFieldIsEvery() {
return (dayOfMonthField.getExpression() instanceof Every || dayOfMonthField.getExpression() instanceof Always);
}
/**
* whether month field has a value
*
* @return if month field has a value return true,else return false
*/
protected boolean monthFieldIsSetAll() {
FieldExpression monthFieldExpression = monthField.getExpression();
return (monthFieldExpression instanceof Every || monthFieldExpression instanceof Always
|| monthFieldExpression instanceof Between || monthFieldExpression instanceof And
|| monthFieldExpression instanceof On);
}
/**
* whether the month field has a value of every or always
*
* @return if month field has a value of every or always return true,else return false
*/
protected boolean monthFieldIsEvery() {
FieldExpression monthFieldExpression = monthField.getExpression();
return (monthFieldExpression instanceof Every || monthFieldExpression instanceof Always);
}
/**
* whether the day Of week field has a value
*
* @return if day Of week field has a value return true,else return false |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/AbstractCycle.java | */
protected boolean dayofWeekFieldIsSetAll() {
FieldExpression dayOfWeekFieldExpression = dayOfWeekField.getExpression();
return (dayOfWeekFieldExpression instanceof Every || dayOfWeekFieldExpression instanceof Always
|| dayOfWeekFieldExpression instanceof Between || dayOfWeekFieldExpression instanceof And
|| dayOfWeekFieldExpression instanceof On);
}
/**
* whether the day Of week field has a value of every or always
*
* @return if day Of week field has a value of every or always return true,else return false
*/
protected boolean dayofWeekFieldIsEvery() {
FieldExpression dayOfWeekFieldExpression = dayOfWeekField.getExpression();
return (dayOfWeekFieldExpression instanceof Every || dayOfWeekFieldExpression instanceof Always);
}
/**
* get cycle enum
*
* @return CycleEnum
*/
protected abstract CycleEnum getCycle();
/**
* get mini level cycle enum
*
* @return CycleEnum
*/
protected abstract CycleEnum getMiniCycle();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java | package org.apache.dolphinscheduler.service.quartz.cron;
import static org.apache.dolphinscheduler.service.quartz.cron.CycleFactory.day;
import static org.apache.dolphinscheduler.service.quartz.cron.CycleFactory.hour;
import static org.apache.dolphinscheduler.service.quartz.cron.CycleFactory.min;
import static org.apache.dolphinscheduler.service.quartz.cron.CycleFactory.month;
import static org.apache.dolphinscheduler.service.quartz.cron.CycleFactory.week;
import static com.cronutils.model.CronType.QUARTZ;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.CycleEnum;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.dao.entity.Schedule;
import org.apache.commons.collections.CollectionUtils;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import org.quartz.CronExpression;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cronutils.model.Cron;
import com.cronutils.model.definition.CronDefinitionBuilder;
import com.cronutils.parser.CronParser;
/**
* cron utils
*/
public class CronUtils { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java | private CronUtils() {
throw new IllegalStateException("CronUtils class");
}
private static final Logger logger = LoggerFactory.getLogger(CronUtils.class);
private static final CronParser QUARTZ_CRON_PARSER = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(QUARTZ));
/**
* parse to cron
*
* @param cronExpression cron expression, never null
* @return Cron instance, corresponding to cron expression received
*/
public static Cron parse2Cron(String cronExpression) {
return QUARTZ_CRON_PARSER.parse(cronExpression);
}
/**
* build a new CronExpression based on the string cronExpression
*
* @param cronExpression String representation of the cron expression the new object should represent
* @return CronExpression
* @throws ParseException if the string expression cannot be parsed into a valid
*/
public static CronExpression parse2CronExpression(String cronExpression) throws ParseException {
return new CronExpression(cronExpression);
}
/**
* get max cycle |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java | *
* @param cron cron
* @return CycleEnum
*/
public static CycleEnum getMaxCycle(Cron cron) {
return min(cron).addCycle(hour(cron)).addCycle(day(cron)).addCycle(week(cron)).addCycle(month(cron)).getCycle();
}
/**
* get min cycle
*
* @param cron cron
* @return CycleEnum
*/
public static CycleEnum getMiniCycle(Cron cron) {
return min(cron).addCycle(hour(cron)).addCycle(day(cron)).addCycle(week(cron)).addCycle(month(cron)).getMiniCycle();
}
/**
* get max cycle
*
* @param crontab crontab
* @return CycleEnum
*/
public static CycleEnum getMaxCycle(String crontab) {
return getMaxCycle(parse2Cron(crontab));
}
/**
* gets all scheduled times for a period of time based on not self dependency
*
* @param startTime startTime
* @param endTime endTime |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java | * @param cronExpression cronExpression
* @return date list
*/
public static List<Date> getFireDateList(Date startTime, Date endTime, CronExpression cronExpression) {
List<Date> dateList = new ArrayList<>();
while (Stopper.isRunning()) {
startTime = cronExpression.getNextValidTimeAfter(startTime);
if (startTime.after(endTime)) {
break;
}
dateList.add(startTime);
}
return dateList;
}
/**
* gets expect scheduled times for a period of time based on self dependency
*
* @param startTime startTime
* @param endTime endTime
* @param cronExpression cronExpression
* @param fireTimes fireTimes
* @return date list
*/
public static List<Date> getSelfFireDateList(Date startTime, Date endTime, CronExpression cronExpression, int fireTimes) {
List<Date> dateList = new ArrayList<>();
while (fireTimes > 0) {
startTime = cronExpression.getNextValidTimeAfter(startTime);
if (startTime.after(endTime) || startTime.equals(endTime)) {
break;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java | dateList.add(startTime);
fireTimes--;
}
return dateList;
}
/**
* gets all scheduled times for a period of time based on self dependency
*
* @param startTime startTime
* @param endTime endTime
* @param cronExpression cronExpression
* @return date list
*/
public static List<Date> getSelfFireDateList(Date startTime, Date endTime, CronExpression cronExpression) {
List<Date> dateList = new ArrayList<>();
while (Stopper.isRunning()) {
startTime = cronExpression.getNextValidTimeAfter(startTime);
if (startTime.after(endTime) || startTime.equals(endTime)) {
break;
}
dateList.add(startTime);
}
return dateList;
}
/**
* gets all scheduled times for a period of time based on self dependency
* if schedulers is empty then default scheduler = 1 day
*/
public static List<Date> getSelfFireDateList(final Date startTime, final Date endTime, final List<Schedule> schedules) {
List<Date> result = new ArrayList<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java | if(startTime.equals(endTime)){
result.add(startTime);
return result;
}
Date from = new Date(startTime.getTime() - Constants.SECOND_TIME_MILLIS);
Date to = new Date(endTime.getTime() + Constants.SECOND_TIME_MILLIS);
List<Schedule> listSchedule = new ArrayList<>();
listSchedule.addAll(schedules);
if (CollectionUtils.isEmpty(listSchedule)) {
Schedule schedule = new Schedule();
schedule.setCrontab(Constants.DEFAULT_CRON_STRING);
listSchedule.add(schedule);
}
for (Schedule schedule : listSchedule) {
result.addAll(CronUtils.getSelfFireDateList(from, to, schedule.getCrontab()));
}
return result;
}
/**
* gets all scheduled times for a period of time based on self dependency
*
* @param startTime startTime
* @param endTime endTime
* @param cron cron
* @return date list
*/
public static List<Date> getSelfFireDateList(Date startTime, Date endTime, String cron) {
CronExpression cronExpression = null;
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java | cronExpression = parse2CronExpression(cron);
} catch (ParseException e) {
logger.error(e.getMessage(), e);
return Collections.emptyList();
}
return getSelfFireDateList(startTime, endTime, cronExpression);
}
/**
* get expiration time
*
* @param startTime startTime
* @param cycleEnum cycleEnum
* @return date
*/
public static Date getExpirationTime(Date startTime, CycleEnum cycleEnum) {
Date maxExpirationTime = null;
Date startTimeMax = null;
try {
startTimeMax = getEndTime(startTime);
Calendar calendar = Calendar.getInstance();
calendar.setTime(startTime);
switch (cycleEnum) {
case HOUR:
calendar.add(Calendar.HOUR, 1);
break;
case DAY:
calendar.add(Calendar.DATE, 1);
break;
case WEEK:
calendar.add(Calendar.DATE, 1); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java | break;
case MONTH:
calendar.add(Calendar.DATE, 1);
break;
default:
logger.error("Dependent process definition's cycleEnum is {},not support!!", cycleEnum);
break;
}
maxExpirationTime = calendar.getTime();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return DateUtils.compare(startTimeMax, maxExpirationTime) ? maxExpirationTime : startTimeMax;
}
/**
* get the end time of the day by value of date
*
* @return date
*/
private static Date getEndTime(Date date) {
Calendar end = new GregorianCalendar();
end.setTime(date);
end.set(Calendar.HOUR_OF_DAY, 23);
end.set(Calendar.MINUTE, 59);
end.set(Calendar.SECOND, 59);
end.set(Calendar.MILLISECOND, 999);
return end.getTime();
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CycleFactory.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.service.quartz.cron;
import com.cronutils.model.Cron;
import com.cronutils.model.field.expression.Always;
import com.cronutils.model.field.expression.QuestionMark;
import org.apache.dolphinscheduler.common.enums.CycleEnum;
/**
* Crontab Cycle Tool Factory
*/
public class CycleFactory { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CycleFactory.java | private CycleFactory() {
throw new IllegalStateException("CycleFactory class");
}
/**
* min
* @param cron cron
* @return AbstractCycle
*/
public static AbstractCycle min(Cron cron) {
return new MinCycle(cron);
}
/**
* hour
* @param cron cron
* @return AbstractCycle
*/
public static AbstractCycle hour(Cron cron) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CycleFactory.java | return new HourCycle(cron);
}
/**
* day
* @param cron cron
* @return AbstractCycle
*/
public static AbstractCycle day(Cron cron) {
return new DayCycle(cron);
}
/**
* week
* @param cron cron
* @return AbstractCycle
*/
public static AbstractCycle week(Cron cron) {
return new WeekCycle(cron);
}
/**
* month
* @param cron cron
* @return AbstractCycle
*/
public static AbstractCycle month(Cron cron) {
return new MonthCycle(cron);
}
/**
* day cycle
*/
public static class DayCycle extends AbstractCycle { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CycleFactory.java | public DayCycle(Cron cron) {
super(cron);
}
/**
* get cycle
* @return CycleEnum
*/
@Override
protected CycleEnum getCycle() {
if (minFiledIsSetAll()
&& hourFiledIsSetAll()
&& dayOfMonthFieldIsEvery()
&& dayOfWeekField.getExpression() instanceof QuestionMark
&& monthField.getExpression() instanceof Always) {
return CycleEnum.DAY;
}
return null;
}
/**
* get min cycle
* @return CycleEnum
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CycleFactory.java | protected CycleEnum getMiniCycle() {
if (dayOfMonthFieldIsEvery()) {
return CycleEnum.DAY;
}
return null;
}
}
/**
* hour cycle
*/
public static class HourCycle extends AbstractCycle {
public HourCycle(Cron cron) {
super(cron);
}
/**
* get cycle
* @return CycleEnum
*/
@Override
protected CycleEnum getCycle() {
if (minFiledIsSetAll()
&& hourFiledIsEvery()
&& dayOfMonthField.getExpression() instanceof Always
&& dayOfWeekField.getExpression() instanceof QuestionMark
&& monthField.getExpression() instanceof Always) {
return CycleEnum.HOUR;
}
return null;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CycleFactory.java | * get mini cycle
* @return CycleEnum
*/
@Override
protected CycleEnum getMiniCycle() {
if(hourFiledIsEvery()){
return CycleEnum.HOUR;
}
return null;
}
}
/**
* minute cycle
*/
public static class MinCycle extends AbstractCycle {
public MinCycle(Cron cron) {
super(cron);
}
/**
* get cycle
* @return CycleEnum
*/
@Override
protected CycleEnum getCycle() {
if (minFiledIsEvery()
&& hourField.getExpression() instanceof Always
&& dayOfMonthField.getExpression() instanceof Always
&& monthField.getExpression() instanceof Always) {
return CycleEnum.MINUTE;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CycleFactory.java | return null;
}
/**
* get min cycle
* @return CycleEnum
*/
@Override
protected CycleEnum getMiniCycle() {
if(minFiledIsEvery()){
return CycleEnum.MINUTE;
}
return null;
}
}
/**
* month cycle
*/
public static class MonthCycle extends AbstractCycle {
public MonthCycle(Cron cron) {
super(cron);
}
/**
* get cycle
* @return CycleEnum
*/
@Override
protected CycleEnum getCycle() {
boolean flag = (minFiledIsSetAll()
&& hourFiledIsSetAll()
&& dayOfMonthFieldIsSetAll() |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CycleFactory.java | && dayOfWeekField.getExpression() instanceof QuestionMark
&& monthFieldIsEvery()) ||
(minFiledIsSetAll()
&& hourFiledIsSetAll()
&& dayOfMonthField.getExpression() instanceof QuestionMark
&& dayofWeekFieldIsSetAll()
&& monthFieldIsEvery());
if (flag) {
return CycleEnum.MONTH;
}
return null;
}
/**
* get mini cycle
* @return CycleEnum
*/
@Override
protected CycleEnum getMiniCycle() {
if (monthFieldIsEvery()) {
return CycleEnum.MONTH;
}
return null;
}
}
/**
* week cycle
*/
public static class WeekCycle extends AbstractCycle {
public WeekCycle(Cron cron) {
super(cron); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CycleFactory.java | }
/**
* get cycle
* @return CycleEnum
*/
@Override
protected CycleEnum getCycle() {
if (minFiledIsSetAll()
&& hourFiledIsSetAll()
&& dayOfMonthField.getExpression() instanceof QuestionMark
&& dayofWeekFieldIsEvery()
&& monthField.getExpression() instanceof Always) {
return CycleEnum.WEEK;
}
return null;
}
/**
* get mini cycle
* @return CycleEnum
*/
@Override
protected CycleEnum getMiniCycle() {
if (dayofWeekFieldIsEvery()) {
return CycleEnum.WEEK;
}
return null;
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtilsTest.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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtilsTest.java | *
* 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.service.quartz.cron;
import com.cronutils.builder.CronBuilder;
import com.cronutils.model.Cron;
import com.cronutils.model.CronType;
import com.cronutils.model.definition.CronDefinitionBuilder;
import com.cronutils.model.field.CronField;
import com.cronutils.model.field.CronFieldName;
import com.cronutils.model.field.expression.*;
import org.apache.dolphinscheduler.common.enums.CycleEnum;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.ParseException;
import java.util.Date;
import static com.cronutils.model.field.expression.FieldExpressionFactory.*;
/**
* CronUtilsTest
*/
public class CronUtilsTest { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtilsTest.java | private static final Logger logger = LoggerFactory.getLogger(CronUtilsTest.class);
/**
* cron as string test
*/
@Test
public void testCronAsString() {
Cron cron = CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ))
.withYear(always())
.withDoW(questionMark())
.withMonth(always())
.withDoM(always())
.withHour(always())
.withMinute(every(5))
.withSecond(on(0))
.instance();
String cronAsString = cron.asString();
Assert.assertEquals("0 */5 * * * ? *", cronAsString);
}
/**
* cron parse test
* @throws ParseException if error throws ParseException
*/
@Test
public void testCronParse() throws ParseException {
String strCrontab = "0 1 2 3 * ? *";
Cron depCron = CronUtils.parse2Cron(strCrontab);
Assert.assertEquals("0", depCron.retrieve(CronFieldName.SECOND).getExpression().asString()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtilsTest.java | Assert.assertEquals("1", depCron.retrieve(CronFieldName.MINUTE).getExpression().asString());
Assert.assertEquals("2", depCron.retrieve(CronFieldName.HOUR).getExpression().asString());
Assert.assertEquals("3", depCron.retrieve(CronFieldName.DAY_OF_MONTH).getExpression().asString());
Assert.assertEquals("*", depCron.retrieve(CronFieldName.MONTH).getExpression().asString());
Assert.assertEquals("*", depCron.retrieve(CronFieldName.YEAR).getExpression().asString());
}
/**
* schedule type test
* @throws ParseException if error throws ParseException
*/
@Test
public void testScheduleType() throws ParseException {
CycleEnum cycleEnum = CronUtils.getMaxCycle(CronUtils.parse2Cron("0 */1 * * * ? *"));
Assert.assertEquals("MINUTE", cycleEnum.name());
CycleEnum cycleEnum2 = CronUtils.getMaxCycle("0 * * * * ? *");
Assert.assertEquals("MINUTE", cycleEnum2.name());
CycleEnum cycleEnum3 = CronUtils.getMiniCycle(CronUtils.parse2Cron("0 * * * * ? *"));
Assert.assertEquals("MINUTE", cycleEnum3.name());
}
/**
* test
*/
@Test
public void test2(){
Cron cron1 = CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ))
.withYear(always())
.withDoW(questionMark())
.withMonth(always())
.withDoM(always())
.withHour(always()) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtilsTest.java | .withMinute(every(5))
.withSecond(on(0))
.instance();
String[] cronArayy = new String[]{"* * * * * ? *","* 0 * * * ? *",
"* 5 * * 3/5 ? *","0 0 * * * ? *"};
for(String minCrontab:cronArayy){
if (!org.quartz.CronExpression.isValidExpression(minCrontab)) {
throw new RuntimeException(minCrontab+" verify failure, cron expression not valid");
}
Cron cron = CronUtils.parse2Cron(minCrontab);
CronField minField = cron.retrieve(CronFieldName.MINUTE);
logger.info("minField instanceof Between:"+(minField.getExpression() instanceof Between));
logger.info("minField instanceof Every:"+(minField.getExpression() instanceof Every));
logger.info("minField instanceof Always:" + (minField.getExpression() instanceof Always));
logger.info("minField instanceof On:"+(minField.getExpression() instanceof On));
logger.info("minField instanceof And:"+(minField.getExpression() instanceof And));
CronField hourField = cron.retrieve(CronFieldName.HOUR);
logger.info("hourField instanceof Between:"+(hourField.getExpression() instanceof Between));
logger.info("hourField instanceof Always:"+(hourField.getExpression() instanceof Always));
logger.info("hourField instanceof Every:"+(hourField.getExpression() instanceof Every));
logger.info("hourField instanceof On:"+(hourField.getExpression() instanceof On));
logger.info("hourField instanceof And:"+(hourField.getExpression() instanceof And));
CronField dayOfMonthField = cron.retrieve(CronFieldName.DAY_OF_MONTH);
logger.info("dayOfMonthField instanceof Between:"+(dayOfMonthField.getExpression() instanceof Between));
logger.info("dayOfMonthField instanceof Always:"+(dayOfMonthField.getExpression() instanceof Always));
logger.info("dayOfMonthField instanceof Every:"+(dayOfMonthField.getExpression() instanceof Every));
logger.info("dayOfMonthField instanceof On:"+(dayOfMonthField.getExpression() instanceof On));
logger.info("dayOfMonthField instanceof And:"+(dayOfMonthField.getExpression() instanceof And));
logger.info("dayOfMonthField instanceof QuestionMark:"+(dayOfMonthField.getExpression() instanceof QuestionMark)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtilsTest.java | CronField monthField = cron.retrieve(CronFieldName.MONTH);
logger.info("monthField instanceof Between:"+(monthField.getExpression() instanceof Between));
logger.info("monthField instanceof Always:"+(monthField.getExpression() instanceof Always));
logger.info("monthField instanceof Every:"+(monthField.getExpression() instanceof Every));
logger.info("monthField instanceof On:"+(monthField.getExpression() instanceof On));
logger.info("monthField instanceof And:"+(monthField.getExpression() instanceof And));
logger.info("monthField instanceof QuestionMark:"+(monthField.getExpression() instanceof QuestionMark));
CronField dayOfWeekField = cron.retrieve(CronFieldName.DAY_OF_WEEK);
logger.info("dayOfWeekField instanceof Between:"+(dayOfWeekField.getExpression() instanceof Between));
logger.info("dayOfWeekField instanceof Always:"+(dayOfWeekField.getExpression() instanceof Always));
logger.info("dayOfWeekField instanceof Every:"+(dayOfWeekField.getExpression() instanceof Every));
logger.info("dayOfWeekField instanceof On:"+(dayOfWeekField.getExpression() instanceof On));
logger.info("dayOfWeekField instanceof And:"+(dayOfWeekField.getExpression() instanceof And));
logger.info("dayOfWeekField instanceof QuestionMark:"+(dayOfWeekField.getExpression() instanceof QuestionMark));
CycleEnum cycleEnum = CronUtils.getMaxCycle(minCrontab);
if(cycleEnum !=null){
logger.info(cycleEnum.name());
}else{
logger.info("can't get scheduleType");
}
}
Assert.assertTrue(true);
}
@Test
public void getSelfFireDateList() throws ParseException {
Date from = DateUtils.stringToDate("2020-01-01 00:00:00");
Date to = DateUtils.stringToDate("2020-01-31 00:00:00");
Assert.assertEquals(0, CronUtils.getSelfFireDateList(to, from, "0 0 0 * * ? ").size()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,053 | [Bug] [dolphinscheduler-service] CronUtils.getMaxCycle return null | ### 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
每年一月每天早上七点
I want to run the task every January at 7am
when I pass this cron , it should return YEAR , not null
CronUtils.getMaxCycle("0 0 7 * 1 ? *")
I want run this task ,every Jan
### What you expected to happen
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
YEAR
### How to reproduce
System.out.println(CronUtils.getMaxCycle("0 0 7 * 1 ? *"));
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] 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/8053 | https://github.com/apache/dolphinscheduler/pull/8086 | b705a08794f34acdd0be32e6e535a1e6973267ad | e0a99dd9093dacd161512535b0046699f3cf26af | 2022-01-14T13:21:02Z | java | 2022-01-18T02:44:30Z | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtilsTest.java | Assert.assertEquals(0, CronUtils.getSelfFireDateList(from, to, "0 0 0 * *").size());
Assert.assertEquals(29, CronUtils.getSelfFireDateList(from, to, "0 0 0 * * ? ").size());
Assert.assertEquals(30, CronUtils.getFireDateList(from, to, CronUtils.parse2CronExpression("0 0 0 * * ? ")).size());
Assert.assertEquals(5, CronUtils.getSelfFireDateList(from, to, CronUtils.parse2CronExpression("0 0 0 * * ? "), 5).size());
from = DateUtils.stringToDate("2020-01-01 00:02:00");
to = DateUtils.stringToDate("2020-01-01 00:02:00");
Assert.assertEquals(1, CronUtils.getFireDateList(new Date(from.getTime() - 1000), to, CronUtils.parse2CronExpression("0 * * * * ? ")).size());
from = DateUtils.stringToDate("2020-01-01 00:02:00");
to = DateUtils.stringToDate("2020-01-01 00:04:00");
Assert.assertEquals(2, CronUtils.getFireDateList(new Date(from.getTime() - 1000),
new Date(to.getTime() - 1000),
CronUtils.parse2CronExpression("0 * * * * ? ")).size());
}
@Test
public void getExpirationTime(){
Date startTime = DateUtils.stringToDate("2020-02-07 18:30:00");
Date expirationTime = CronUtils.getExpirationTime(startTime, CycleEnum.HOUR);
Assert.assertEquals("2020-02-07 19:30:00", DateUtils.dateToString(expirationTime));
expirationTime = CronUtils.getExpirationTime(startTime, CycleEnum.DAY);
Assert.assertEquals("2020-02-07 23:59:59", DateUtils.dateToString(expirationTime));
expirationTime = CronUtils.getExpirationTime(startTime, CycleEnum.WEEK);
Assert.assertEquals("2020-02-07 23:59:59", DateUtils.dateToString(expirationTime));
expirationTime = CronUtils.getExpirationTime(startTime, CycleEnum.MONTH);
Assert.assertEquals("2020-02-07 23:59:59", DateUtils.dateToString(expirationTime));
expirationTime = CronUtils.getExpirationTime(startTime, CycleEnum.YEAR);
Assert.assertEquals("2020-02-07 18:30:00", DateUtils.dateToString(expirationTime));
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,092 | [Bug] [task-datax] cannot use Parameter for clickhouse datax task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when I used Parameter for clickhouse datax task. it was always failed .
### What you expected to happen
[WARN] 2022-01-17 20:19:50.042 - [taskAppId=TASK-540354961620992_3-13328-48308]:[480] - database driver [CLICKHOUSE] is not support grammatical analysis sql
[INFO] 2022-01-17 20:19:50.042 - [taskAppId=TASK-540354961620992_3-13328-48308]:[457] - try to execute sql analysis query column name
.......
ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 41, host: 10.17.16.46, port: 8123; Code: 41, e.displayText() = DB::ParsingException: Cannot parse datetime: Cannot parse UInt32 from String: While processing (paymentType != 'yb') AND (datatime >= (toUnixTimestamp(concat('${dtdh}', ':00:00')) * 1000)) AND (datatime < (toUnixTimestamp(concat('2022-01-17 19', ':59:59')) * 1000)) (version 21.6.6.51 (official build))
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:58)
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:28)
at ru.yandex.clickhouse.ClickHouseStatementImpl.checkForErrorAndThrow(ClickHouseStatementImpl.java:815)
at ru.yandex.clickhouse.ClickHouseStatementImpl.getInputStream(ClickHouseStatementImpl.java:611)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:114)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:97)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:92)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:87)
at ru.yandex.clickhouse.ClickHousePreparedStatementImpl.executeQuery(ClickHousePreparedStatementImpl.java:128)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.tryExecuteSqlResolveColumnNames(DataxTask.java:552)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.parsingSqlColumnNames(DataxTask.java:458)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.buildDataxJobContentJson(DataxTask.java:279)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.buildDataxJsonFile(DataxTask.java:210)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.handle(DataxTask.java:161)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:226)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.Throwable: Code: 41, e.displayText() = DB::ParsingException: Cannot parse datetime: Cannot parse UInt32 from String: While processing (paymentType != 'yb') AND (datatime >= (toUnixTimestamp(concat('${dtdh}', ':00:00')) * 1000)) AND (datatime < (toUnixTimestamp(concat('2022-01-17 19', ':59:59')) * 1000)) (version 21.6.6.51 (official build))
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:53)
... 19 common frames omitted
### How to reproduce
create clickhouse datax task. AND use time Parameter In "WHERE " filter
### Anything else
I had fix this bug.
please edit DataxUtils.class and update getSqlStatementParser function.
>
public static SQLStatementParser getSqlStatementParser(DbType dbType, String sql) {
switch (dbType) {
case MYSQL:
return new MySqlStatementParser(sql);
case POSTGRESQL:
return new PGSQLStatementParser(sql);
case ORACLE:
return new OracleStatementParser(sql);
case SQLSERVER:
return new SQLServerStatementParser(sql);
case CLICKHOUSE:
return new ClickhouseStatementParser(sql);
default:
return null;
}
}
### Version
2.0.2
### 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/8092 | https://github.com/apache/dolphinscheduler/pull/8091 | e0a99dd9093dacd161512535b0046699f3cf26af | f1a02159783e2a01094a06eb7681d4532cdbbff4 | 2022-01-17T13:16:14Z | java | 2022-01-18T08:53:25Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.datax;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser;
import com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser;
import com.alibaba.druid.sql.dialect.sqlserver.parser.SQLServerStatementParser;
import com.alibaba.druid.sql.parser.SQLStatementParser;
public class DataxUtils { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,092 | [Bug] [task-datax] cannot use Parameter for clickhouse datax task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when I used Parameter for clickhouse datax task. it was always failed .
### What you expected to happen
[WARN] 2022-01-17 20:19:50.042 - [taskAppId=TASK-540354961620992_3-13328-48308]:[480] - database driver [CLICKHOUSE] is not support grammatical analysis sql
[INFO] 2022-01-17 20:19:50.042 - [taskAppId=TASK-540354961620992_3-13328-48308]:[457] - try to execute sql analysis query column name
.......
ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 41, host: 10.17.16.46, port: 8123; Code: 41, e.displayText() = DB::ParsingException: Cannot parse datetime: Cannot parse UInt32 from String: While processing (paymentType != 'yb') AND (datatime >= (toUnixTimestamp(concat('${dtdh}', ':00:00')) * 1000)) AND (datatime < (toUnixTimestamp(concat('2022-01-17 19', ':59:59')) * 1000)) (version 21.6.6.51 (official build))
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:58)
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:28)
at ru.yandex.clickhouse.ClickHouseStatementImpl.checkForErrorAndThrow(ClickHouseStatementImpl.java:815)
at ru.yandex.clickhouse.ClickHouseStatementImpl.getInputStream(ClickHouseStatementImpl.java:611)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:114)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:97)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:92)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:87)
at ru.yandex.clickhouse.ClickHousePreparedStatementImpl.executeQuery(ClickHousePreparedStatementImpl.java:128)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.tryExecuteSqlResolveColumnNames(DataxTask.java:552)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.parsingSqlColumnNames(DataxTask.java:458)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.buildDataxJobContentJson(DataxTask.java:279)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.buildDataxJsonFile(DataxTask.java:210)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.handle(DataxTask.java:161)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:226)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.Throwable: Code: 41, e.displayText() = DB::ParsingException: Cannot parse datetime: Cannot parse UInt32 from String: While processing (paymentType != 'yb') AND (datatime >= (toUnixTimestamp(concat('${dtdh}', ':00:00')) * 1000)) AND (datatime < (toUnixTimestamp(concat('2022-01-17 19', ':59:59')) * 1000)) (version 21.6.6.51 (official build))
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:53)
... 19 common frames omitted
### How to reproduce
create clickhouse datax task. AND use time Parameter In "WHERE " filter
### Anything else
I had fix this bug.
please edit DataxUtils.class and update getSqlStatementParser function.
>
public static SQLStatementParser getSqlStatementParser(DbType dbType, String sql) {
switch (dbType) {
case MYSQL:
return new MySqlStatementParser(sql);
case POSTGRESQL:
return new PGSQLStatementParser(sql);
case ORACLE:
return new OracleStatementParser(sql);
case SQLSERVER:
return new SQLServerStatementParser(sql);
case CLICKHOUSE:
return new ClickhouseStatementParser(sql);
default:
return null;
}
}
### Version
2.0.2
### 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/8092 | https://github.com/apache/dolphinscheduler/pull/8091 | e0a99dd9093dacd161512535b0046699f3cf26af | f1a02159783e2a01094a06eb7681d4532cdbbff4 | 2022-01-17T13:16:14Z | java | 2022-01-18T08:53:25Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java | public static final String DATAX_READER_PLUGIN_MYSQL = "mysqlreader";
public static final String DATAX_READER_PLUGIN_POSTGRESQL = "postgresqlreader";
public static final String DATAX_READER_PLUGIN_ORACLE = "oraclereader";
public static final String DATAX_READER_PLUGIN_SQLSERVER = "sqlserverreader";
public static final String DATAX_READER_PLUGIN_CLICKHOUSE = "clickhousereader";
public static final String DATAX_WRITER_PLUGIN_MYSQL = "mysqlwriter";
public static final String DATAX_WRITER_PLUGIN_POSTGRESQL = "postgresqlwriter";
public static final String DATAX_WRITER_PLUGIN_ORACLE = "oraclewriter";
public static final String DATAX_WRITER_PLUGIN_SQLSERVER = "sqlserverwriter";
public static final String DATAX_WRITER_PLUGIN_CLICKHOUSE = "clickhousewriter";
public static String getReaderPluginName(DbType dbType) {
switch (dbType) {
case MYSQL:
return DATAX_READER_PLUGIN_MYSQL;
case POSTGRESQL:
return DATAX_READER_PLUGIN_POSTGRESQL;
case ORACLE:
return DATAX_READER_PLUGIN_ORACLE;
case SQLSERVER:
return DATAX_READER_PLUGIN_SQLSERVER;
case CLICKHOUSE:
return DATAX_READER_PLUGIN_CLICKHOUSE;
default:
return null;
}
}
public static String getWriterPluginName(DbType dbType) {
switch (dbType) {
case MYSQL: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,092 | [Bug] [task-datax] cannot use Parameter for clickhouse datax task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when I used Parameter for clickhouse datax task. it was always failed .
### What you expected to happen
[WARN] 2022-01-17 20:19:50.042 - [taskAppId=TASK-540354961620992_3-13328-48308]:[480] - database driver [CLICKHOUSE] is not support grammatical analysis sql
[INFO] 2022-01-17 20:19:50.042 - [taskAppId=TASK-540354961620992_3-13328-48308]:[457] - try to execute sql analysis query column name
.......
ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 41, host: 10.17.16.46, port: 8123; Code: 41, e.displayText() = DB::ParsingException: Cannot parse datetime: Cannot parse UInt32 from String: While processing (paymentType != 'yb') AND (datatime >= (toUnixTimestamp(concat('${dtdh}', ':00:00')) * 1000)) AND (datatime < (toUnixTimestamp(concat('2022-01-17 19', ':59:59')) * 1000)) (version 21.6.6.51 (official build))
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:58)
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:28)
at ru.yandex.clickhouse.ClickHouseStatementImpl.checkForErrorAndThrow(ClickHouseStatementImpl.java:815)
at ru.yandex.clickhouse.ClickHouseStatementImpl.getInputStream(ClickHouseStatementImpl.java:611)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:114)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:97)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:92)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:87)
at ru.yandex.clickhouse.ClickHousePreparedStatementImpl.executeQuery(ClickHousePreparedStatementImpl.java:128)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.tryExecuteSqlResolveColumnNames(DataxTask.java:552)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.parsingSqlColumnNames(DataxTask.java:458)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.buildDataxJobContentJson(DataxTask.java:279)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.buildDataxJsonFile(DataxTask.java:210)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.handle(DataxTask.java:161)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:226)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.Throwable: Code: 41, e.displayText() = DB::ParsingException: Cannot parse datetime: Cannot parse UInt32 from String: While processing (paymentType != 'yb') AND (datatime >= (toUnixTimestamp(concat('${dtdh}', ':00:00')) * 1000)) AND (datatime < (toUnixTimestamp(concat('2022-01-17 19', ':59:59')) * 1000)) (version 21.6.6.51 (official build))
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:53)
... 19 common frames omitted
### How to reproduce
create clickhouse datax task. AND use time Parameter In "WHERE " filter
### Anything else
I had fix this bug.
please edit DataxUtils.class and update getSqlStatementParser function.
>
public static SQLStatementParser getSqlStatementParser(DbType dbType, String sql) {
switch (dbType) {
case MYSQL:
return new MySqlStatementParser(sql);
case POSTGRESQL:
return new PGSQLStatementParser(sql);
case ORACLE:
return new OracleStatementParser(sql);
case SQLSERVER:
return new SQLServerStatementParser(sql);
case CLICKHOUSE:
return new ClickhouseStatementParser(sql);
default:
return null;
}
}
### Version
2.0.2
### 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/8092 | https://github.com/apache/dolphinscheduler/pull/8091 | e0a99dd9093dacd161512535b0046699f3cf26af | f1a02159783e2a01094a06eb7681d4532cdbbff4 | 2022-01-17T13:16:14Z | java | 2022-01-18T08:53:25Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java | return DATAX_WRITER_PLUGIN_MYSQL;
case POSTGRESQL:
return DATAX_WRITER_PLUGIN_POSTGRESQL;
case ORACLE:
return DATAX_WRITER_PLUGIN_ORACLE;
case SQLSERVER:
return DATAX_WRITER_PLUGIN_SQLSERVER;
case CLICKHOUSE:
return DATAX_WRITER_PLUGIN_CLICKHOUSE;
default:
return null;
}
}
public static SQLStatementParser getSqlStatementParser(DbType dbType, String sql) {
switch (dbType) {
case MYSQL:
return new MySqlStatementParser(sql);
case POSTGRESQL:
return new PGSQLStatementParser(sql);
case ORACLE:
return new OracleStatementParser(sql);
case SQLSERVER:
return new SQLServerStatementParser(sql);
default:
return null;
}
}
public static String[] convertKeywordsColumns(DbType dbType, String[] columns) {
if (columns == null) {
return null; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,092 | [Bug] [task-datax] cannot use Parameter for clickhouse datax task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when I used Parameter for clickhouse datax task. it was always failed .
### What you expected to happen
[WARN] 2022-01-17 20:19:50.042 - [taskAppId=TASK-540354961620992_3-13328-48308]:[480] - database driver [CLICKHOUSE] is not support grammatical analysis sql
[INFO] 2022-01-17 20:19:50.042 - [taskAppId=TASK-540354961620992_3-13328-48308]:[457] - try to execute sql analysis query column name
.......
ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 41, host: 10.17.16.46, port: 8123; Code: 41, e.displayText() = DB::ParsingException: Cannot parse datetime: Cannot parse UInt32 from String: While processing (paymentType != 'yb') AND (datatime >= (toUnixTimestamp(concat('${dtdh}', ':00:00')) * 1000)) AND (datatime < (toUnixTimestamp(concat('2022-01-17 19', ':59:59')) * 1000)) (version 21.6.6.51 (official build))
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:58)
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:28)
at ru.yandex.clickhouse.ClickHouseStatementImpl.checkForErrorAndThrow(ClickHouseStatementImpl.java:815)
at ru.yandex.clickhouse.ClickHouseStatementImpl.getInputStream(ClickHouseStatementImpl.java:611)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:114)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:97)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:92)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:87)
at ru.yandex.clickhouse.ClickHousePreparedStatementImpl.executeQuery(ClickHousePreparedStatementImpl.java:128)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.tryExecuteSqlResolveColumnNames(DataxTask.java:552)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.parsingSqlColumnNames(DataxTask.java:458)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.buildDataxJobContentJson(DataxTask.java:279)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.buildDataxJsonFile(DataxTask.java:210)
at org.apache.dolphinscheduler.plugin.task.datax.DataxTask.handle(DataxTask.java:161)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:226)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.Throwable: Code: 41, e.displayText() = DB::ParsingException: Cannot parse datetime: Cannot parse UInt32 from String: While processing (paymentType != 'yb') AND (datatime >= (toUnixTimestamp(concat('${dtdh}', ':00:00')) * 1000)) AND (datatime < (toUnixTimestamp(concat('2022-01-17 19', ':59:59')) * 1000)) (version 21.6.6.51 (official build))
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:53)
... 19 common frames omitted
### How to reproduce
create clickhouse datax task. AND use time Parameter In "WHERE " filter
### Anything else
I had fix this bug.
please edit DataxUtils.class and update getSqlStatementParser function.
>
public static SQLStatementParser getSqlStatementParser(DbType dbType, String sql) {
switch (dbType) {
case MYSQL:
return new MySqlStatementParser(sql);
case POSTGRESQL:
return new PGSQLStatementParser(sql);
case ORACLE:
return new OracleStatementParser(sql);
case SQLSERVER:
return new SQLServerStatementParser(sql);
case CLICKHOUSE:
return new ClickhouseStatementParser(sql);
default:
return null;
}
}
### Version
2.0.2
### 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/8092 | https://github.com/apache/dolphinscheduler/pull/8091 | e0a99dd9093dacd161512535b0046699f3cf26af | f1a02159783e2a01094a06eb7681d4532cdbbff4 | 2022-01-17T13:16:14Z | java | 2022-01-18T08:53:25Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java | }
String[] toColumns = new String[columns.length];
for (int i = 0; i < columns.length; i++) {
toColumns[i] = doConvertKeywordsColumn(dbType, columns[i]);
}
return toColumns;
}
public static String doConvertKeywordsColumn(DbType dbType, String column) {
if (column == null) {
return column;
}
column = column.trim();
column = column.replace("`", "");
column = column.replace("\"", "");
column = column.replace("'", "");
switch (dbType) {
case MYSQL:
return String.format("`%s`", column);
case POSTGRESQL:
return String.format("\"%s\"", column);
case ORACLE:
return String.format("\"%s\"", column);
case SQLSERVER:
return String.format("`%s`", column);
default:
return column;
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.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;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;
/**
* process definition service
*/
public interface ProcessDefinitionService { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | /**
* create process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams global params
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return create result code
*/
Map<String, Object> createProcessDefinition(User loginUser,
long projectCode,
String name,
String description,
String globalParams,
String locations,
int timeout, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | String tenantCode,
String taskRelationJson,
String taskDefinitionJson,
ProcessExecutionTypeEnum executionType);
/**
* query process definition list
*
* @param loginUser login user
* @param projectCode project code
* @return definition list
*/
Map<String, Object> queryProcessDefinitionList(User loginUser,
long projectCode);
/**
* query process definition simple list
*
* @param loginUser login user
* @param projectCode project code
* @return definition simple list
*/
Map<String, Object> queryProcessDefinitionSimpleList(User loginUser,
long projectCode);
/**
* query process definition list paging
*
* @param loginUser login user
* @param projectCode project code
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | * @param userId user id
* @return process definition page
*/
Result queryProcessDefinitionListPaging(User loginUser,
long projectCode,
String searchVal,
Integer userId,
Integer pageNo,
Integer pageSize);
/**
* query detail of process definition
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return process definition detail
*/
Map<String, Object> queryProcessDefinitionByCode(User loginUser,
long projectCode,
long code);
/**
* query detail of process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @return process definition detail
*/
Map<String, Object> queryProcessDefinitionByName(User loginUser,
long projectCode, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | String name);
/**
* batch copy process definition
*
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
Map<String, Object> batchCopyProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode);
/**
* batch move process definition
*
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
Map<String, Object> batchMoveProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode);
/**
* update process definition
*
* @param loginUser login user
* @param projectCode project code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | * @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams global params
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return update result code
*/
Map<String, Object> updateProcessDefinition(User loginUser,
long projectCode,
String name,
long code,
String description,
String globalParams,
String locations,
int timeout,
String tenantCode,
String taskRelationJson,
String taskDefinitionJson,
ProcessExecutionTypeEnum executionType);
/**
* 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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | */
Map<String, Object> verifyProcessDefinitionName(User loginUser,
long projectCode,
String name);
/**
* delete process definition by code
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return delete result code
*/
Map<String, Object> deleteProcessDefinitionByCode(User loginUser,
long projectCode,
long code);
/**
* release process definition: online / offline
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState release state
* @return release result code
*/
Map<String, Object> releaseProcessDefinition(User loginUser,
long projectCode,
long code,
ReleaseState releaseState);
/**
* batch export process definition by codes |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | *
* @param loginUser login user
* @param projectCode project code
* @param codes process definition codes
* @param response http servlet response
*/
void batchExportProcessDefinitionByCodes(User loginUser,
long projectCode,
String codes,
HttpServletResponse response);
/**
* import process definition
*
* @param loginUser login user
* @param projectCode project code
* @param file process metadata json file
* @return import process
*/
Map<String, Object> importProcessDefinition(User loginUser,
long projectCode,
MultipartFile file);
/**
* import sql process definition
*
* @param loginUser login user
* @param projectCode project code
* @param file sql file, zip
* @return import process
*/
Map<String, Object> importSqlProcessDefinition(User loginUser, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | long projectCode,
MultipartFile file);
/**
* check the process task relation json
*
* @param processTaskRelationJson process task relation json
* @return check result code
*/
Map<String, Object> checkProcessNodeList(String processTaskRelationJson);
/**
* get task node details based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param code processDefinition code
* @return task node list
*/
Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser,
long projectCode,
long code);
/**
* get task node details map based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param codes define code list
* @return task node list
*/
Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser,
long projectCode, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | String codes);
/**
* query process definition all by project code
*
* @param projectCode project code
* @return process definitions in the project
*/
Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode);
/**
* Encapsulates the TreeView structure
*
* @param projectCode project code
* @param code process definition code
* @param limit limit
* @return tree view json data
*/
Map<String, Object> viewTree(long projectCode, long code, Integer limit);
/**
* switch the defined process definition version
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param version the version user want to switch
* @return switch process definition version result code
*/
Map<String, Object> switchProcessDefinitionVersion(User loginUser,
long projectCode,
long code,
int version); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | /**
* query the pagination versions info by one certain process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param pageNo page number
* @param pageSize page size
* @param code process definition code
* @return the pagination process definition versions info of the certain process definition
*/
Result queryProcessDefinitionVersions(User loginUser,
long projectCode,
int pageNo,
int pageSize,
long code);
/**
* delete one certain process definition by version number and process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param code process definition code
* @param version version number
* @return delele result code
*/
Map<String, Object> deleteProcessDefinitionVersion(User loginUser,
long projectCode,
long code,
int version);
/**
* create empty process definition |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | *
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @return process definition code
*/
Map<String, Object> createEmptyProcessDefinition(User loginUser,
long projectCode,
String name,
String description,
String globalParams,
int timeout,
String tenantCode,
String scheduleJson,
ProcessExecutionTypeEnum executionType);
/**
* update process definition basic info
*
* @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 timeout timeout |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | * @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @param executionType executionType
* @return update result code
*/
Map<String, Object> updateProcessDefinitionBasicInfo(User loginUser,
long projectCode,
String name,
long code,
String description,
String globalParams,
int timeout,
String tenantCode,
String scheduleJson,
ProcessExecutionTypeEnum executionType);
/**
* release process definition and schedule
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState releaseState
* @return update result code
*/
Map<String, Object> releaseWorkflowAndSchedule(User loginUser,
long projectCode,
long code,
ReleaseState releaseState);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.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 static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE;
import static org.apache.dolphinscheduler.common.Constants.DEFAULT_WORKER_GROUP;
import org.apache.dolphinscheduler.api.dto.DagDataSchedule;
import org.apache.dolphinscheduler.api.dto.ScheduleParam;
import org.apache.dolphinscheduler.api.dto.treeview.Instance;
import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import org.apache.dolphinscheduler.api.service.ProcessInstanceService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.SchedulerService;
import org.apache.dolphinscheduler.api.utils.CheckUtils;
import org.apache.dolphinscheduler.api.utils.FileUtils;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ConditionType;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.common.enums.TaskType;
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
import org.apache.dolphinscheduler.common.task.sql.SqlParameters;
import org.apache.dolphinscheduler.common.task.sql.SqlType;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.DagData; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import org.apache.dolphinscheduler.dao.entity.DataSource;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.Schedule;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.BufferedOutputStream;
import java.io.BufferedReader; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.JsonNode; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.Lists;
/**
* process definition service impl
*/
@Service
public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements ProcessDefinitionService {
private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class);
private static final String RELEASESTATE = "releaseState";
@Autowired
private ProjectMapper projectMapper;
@Autowired
private ProjectService projectService;
@Autowired
private UserMapper userMapper;
@Autowired
private ProcessDefinitionLogMapper processDefinitionLogMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired
private ProcessInstanceService processInstanceService;
@Autowired
private TaskInstanceMapper taskInstanceMapper;
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private ProcessService processService;
@Autowired
private ProcessTaskRelationMapper processTaskRelationMapper; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | @Autowired
private ProcessTaskRelationLogMapper processTaskRelationLogMapper;
@Autowired
TaskDefinitionLogMapper taskDefinitionLogMapper;
@Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private SchedulerService schedulerService;
@Autowired
private TenantMapper tenantMapper;
@Autowired
private DataSourceMapper dataSourceMapper;
/**
* create process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams global params
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return create result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> createProcessDefinition(User loginUser, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | long projectCode,
String name,
String description,
String globalParams,
String locations,
int timeout,
String tenantCode,
String taskRelationJson,
String taskDefinitionJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson);
if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) {
return checkTaskDefinitions;
}
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs);
if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return checkRelationJson;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
long processDefinitionCode;
try {
processDefinitionCode = CodeGenerateUtils.getInstance().genCode();
} catch (CodeGenerateException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
return result;
}
ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description,
globalParams, locations, timeout, loginUser.getId(), tenantId);
processDefinition.setExecutionType(executionType);
return createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs);
}
private Map<String, Object> createDagDefine(User loginUser,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
List<TaskDefinitionLog> taskDefinitionLogs) {
Map<String, Object> result = new HashMap<>();
int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs, Boolean.TRUE);
if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | logger.info("The task has not changed, so skip");
}
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
if (insertVersion == 0) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR);
}
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(),
insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.CREATE_PROCESS_TASK_RELATION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_TASK_RELATION_ERROR);
}
return result;
}
private Map<String, Object> checkTaskDefinitionList(List<TaskDefinitionLog> taskDefinitionLogs, String taskDefinitionJson) {
Map<String, Object> result = new HashMap<>();
try {
if (taskDefinitionLogs.isEmpty()) {
logger.error("taskDefinitionJson invalid: {}", taskDefinitionJson);
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (!CheckUtils.checkTaskDefinitionParameters(taskDefinitionLog)) {
logger.error("task definition {} parameter invalid", taskDefinitionLog.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName());
return result;
}
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
result.put(Constants.MSG, e.getMessage());
}
return result;
}
private Map<String, Object> checkTaskRelationList(List<ProcessTaskRelationLog> taskRelationList, String taskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs) {
Map<String, Object> result = new HashMap<>();
try {
if (taskRelationList == null || taskRelationList.isEmpty()) {
logger.error("task relation list is null");
putMsg(result, Status.DATA_IS_NOT_VALID, taskRelationJson);
return result;
}
List<ProcessTaskRelation> processTaskRelations = taskRelationList.stream()
.map(processTaskRelationLog -> JSONUtils.parseObject(JSONUtils.toJsonString(processTaskRelationLog), ProcessTaskRelation.class))
.collect(Collectors.toList());
List<TaskNode> taskNodeList = processService.transformTask(processTaskRelations, taskDefinitionLogs);
if (taskNodeList.size() != taskRelationList.size()) {
Set<Long> postTaskCodes = taskRelationList.stream().map(ProcessTaskRelationLog::getPostTaskCode).collect(Collectors.toSet());
Set<Long> taskNodeCodes = taskNodeList.stream().map(TaskNode::getCode).collect(Collectors.toSet());
Collection<Long> codes = CollectionUtils.subtract(postTaskCodes, taskNodeCodes); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (CollectionUtils.isNotEmpty(codes)) {
logger.error("the task code is not exist");
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, org.apache.commons.lang.StringUtils.join(codes, Constants.COMMA));
return result;
}
}
if (graphHasCycle(taskNodeList)) {
logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
if (processTaskRelationLog.getPostTaskCode() == 0) {
logger.error("the post_task_code or post_task_version can't be zero");
putMsg(result, Status.CHECK_PROCESS_TASK_RELATION_ERROR);
return result;
}
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
result.put(Constants.MSG, e.getMessage());
}
return result;
}
/**
* query process definition list
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param projectCode project code
* @return definition list
*/
@Override
public Map<String, Object> queryProcessDefinitionList(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessDefinition> resourceList = processDefinitionMapper.queryAllDefinitionList(projectCode);
List<DagData> dagDataList = resourceList.stream().map(processService::genDagData).collect(Collectors.toList());
result.put(Constants.DATA_LIST, dagDataList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition simple list
*
* @param loginUser login user
* @param projectCode project code
* @return definition simple list
*/
@Override
public Map<String, Object> queryProcessDefinitionSimpleList(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode);
ArrayNode arrayNode = JSONUtils.createArrayNode();
for (ProcessDefinition processDefinition : processDefinitions) {
ObjectNode processDefinitionNode = JSONUtils.createObjectNode();
processDefinitionNode.put("id", processDefinition.getId());
processDefinitionNode.put("code", processDefinition.getCode());
processDefinitionNode.put("name", processDefinition.getName());
processDefinitionNode.put("projectCode", processDefinition.getProjectCode());
arrayNode.add(processDefinitionNode);
}
result.put(Constants.DATA_LIST, arrayNode);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition list paging
*
* @param loginUser login user
* @param projectCode project code
* @param searchVal search value
* @param userId user id
* @param pageNo page number
* @param pageSize page size
* @return process definition page
*/
@Override
public Result queryProcessDefinitionListPaging(User loginUser, long projectCode, String searchVal, Integer userId, Integer pageNo, Integer pageSize) {
Result result = new Result(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
putMsg(result, resultStatus);
return result;
}
Page<ProcessDefinition> page = new Page<>(pageNo, pageSize);
IPage<ProcessDefinition> processDefinitionIPage = processDefinitionMapper.queryDefineListPaging(
page, searchVal, userId, project.getCode(), isAdmin(loginUser));
List<ProcessDefinition> records = processDefinitionIPage.getRecords();
for (ProcessDefinition pd : records) {
ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(pd.getCode(), pd.getVersion());
User user = userMapper.selectById(processDefinitionLog.getOperator());
pd.setModifyBy(user.getUserName());
}
processDefinitionIPage.setRecords(records);
PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) processDefinitionIPage.getTotal());
pageInfo.setTotalList(processDefinitionIPage.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query detail of process definition
*
* @param loginUser login user
* @param projectCode project code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param code process definition code
* @return process definition detail
*/
@Override
public Map<String, Object> queryProcessDefinitionByCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
} else {
Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId());
if (tenant != null) {
processDefinition.setTenantCode(tenant.getTenantCode());
}
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData);
putMsg(result, Status.SUCCESS);
}
return result;
}
@Override
public Map<String, Object> queryProcessDefinitionByName(User loginUser, long projectCode, String name) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, name);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, name);
} else {
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData);
putMsg(result, Status.SUCCESS);
}
return 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 global params
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return update result code
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | @Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> updateProcessDefinition(User loginUser,
long projectCode,
String name,
long code,
String description,
String globalParams,
String locations,
int timeout,
String tenantCode,
String taskRelationJson,
String taskDefinitionJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson);
if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) {
return checkTaskDefinitions;
}
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs);
if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) {
return checkRelationJson;
}
int tenantId = -1; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName());
return result;
}
if (!name.equals(processDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
}
ProcessDefinition processDefinitionDeepCopy = JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class);
processDefinition.set(projectCode, name, description, globalParams, locations, timeout, tenantId);
processDefinition.setExecutionType(executionType); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy, taskDefinitionLogs);
}
private Map<String, Object> updateDagDefine(User loginUser,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
ProcessDefinition processDefinitionDeepCopy,
List<TaskDefinitionLog> taskDefinitionLogs) {
Map<String, Object> result = new HashMap<>();
int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs, Boolean.TRUE);
if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) {
logger.info("The task has not changed, so skip");
}
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
}
int insertVersion;
if (processDefinition.equals(processDefinitionDeepCopy)) {
insertVersion = processDefinitionDeepCopy.getVersion();
ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(processDefinition.getCode(), insertVersion);
processDefinitionLog.setOperator(loginUser.getId());
processDefinitionLog.setOperateTime(new Date());
int update = processDefinitionLogMapper.updateById(processDefinitionLog);
} else {
processDefinition.setUpdateTime(new Date());
insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
}
if (insertVersion == 0) {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(),
processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
return result;
}
/**
* 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
*/
@Override
public Map<String, Object> verifyProcessDefinitionName(User loginUser, long projectCode, String name) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.verifyByDefineName(project.getCode(), name.trim());
if (processDefinition == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name.trim());
}
return result;
}
/**
* delete process definition by code
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return delete result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> deleteProcessDefinitionByCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, code);
return result;
}
List<ProcessInstance> processInstances = processInstanceService.queryByProcessDefineCodeAndStatus(processDefinition.getCode(), Constants.NOT_TERMINATED_STATES);
if (CollectionUtils.isNotEmpty(processInstances)) {
putMsg(result, Status.DELETE_PROCESS_DEFINITION_BY_CODE_FAIL, processInstances.size());
return result;
}
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code);
if (scheduleObj != null) {
if (scheduleObj.getReleaseState() == ReleaseState.OFFLINE) {
int delete = scheduleMapper.deleteById(scheduleObj.getId());
if (delete == 0) {
putMsg(result, Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR);
throw new ServiceException(Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR);
}
}
if (scheduleObj.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, scheduleObj.getId());
return result;
}
}
int delete = processDefinitionMapper.deleteById(processDefinition.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (delete == 0) {
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
}
int deleteRelation = processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode());
if (deleteRelation == 0) {
logger.warn("The process definition has not relation, it will be delete successfully");
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* release process definition: online / offline
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState release state
* @return release result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> releaseProcessDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (null == releaseState) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
switch (releaseState) {
case ONLINE:
List<ProcessTaskRelation> relationList = processService.findRelationByCode(code, processDefinition.getVersion());
if (CollectionUtils.isEmpty(relationList)) {
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
processDefinition.setReleaseState(releaseState);
processDefinitionMapper.updateById(processDefinition);
break;
case OFFLINE:
processDefinition.setReleaseState(releaseState);
int updateProcess = processDefinitionMapper.updateById(processDefinition);
Schedule schedule = scheduleMapper.queryByProcessDefinitionCode(code);
if (updateProcess > 0 && schedule != null) {
logger.info("set schedule offline, project code: {}, schedule id: {}, process definition code: {}", projectCode, schedule.getId(), code);
schedule.setReleaseState(releaseState);
int updateSchedule = scheduleMapper.updateById(schedule);
if (updateSchedule == 0) {
putMsg(result, Status.OFFLINE_SCHEDULE_ERROR); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR);
}
schedulerService.deleteSchedule(project.getId(), schedule.getId());
}
break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* batch export process definition by codes
*/
@Override
public void batchExportProcessDefinitionByCodes(User loginUser, long projectCode, String codes, HttpServletResponse response) {
if (org.apache.commons.lang.StringUtils.isEmpty(codes)) {
return;
}
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return;
}
Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet);
if (CollectionUtils.isEmpty(processDefinitionList)) {
return; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream().filter(o -> projectCode == o.getProjectCode()).collect(Collectors.toList());
List<DagDataSchedule> dagDataSchedules = processDefinitionListInProject.stream().map(this::exportProcessDagData).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(dagDataSchedules)) {
downloadProcessDefinitionFile(response, dagDataSchedules);
}
}
/**
* download the process definition file
*/
private void downloadProcessDefinitionFile(HttpServletResponse response, List<DagDataSchedule> dagDataSchedules) {
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
BufferedOutputStream buff = null;
ServletOutputStream out = null;
try {
out = response.getOutputStream();
buff = new BufferedOutputStream(out);
buff.write(JSONUtils.toJsonString(dagDataSchedules).getBytes(StandardCharsets.UTF_8));
buff.flush();
buff.close();
} catch (IOException e) {
logger.warn("export process fail", e);
} finally {
if (null != buff) {
try {
buff.close();
} catch (Exception e) {
logger.warn("export process buffer not close", e);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
if (null != out) {
try {
out.close();
} catch (Exception e) {
logger.warn("export process output stream not close", e);
}
}
}
}
/**
* get export process dag data
*
* @param processDefinition process definition
* @return DagDataSchedule
*/
public DagDataSchedule exportProcessDagData(ProcessDefinition processDefinition) {
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(processDefinition.getCode());
DagDataSchedule dagDataSchedule = new DagDataSchedule(processService.genDagData(processDefinition));
if (scheduleObj != null) {
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
dagDataSchedule.setSchedule(scheduleObj);
}
return dagDataSchedule;
}
/**
* import process definition
*
* @param loginUser login user
* @param projectCode project code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param file process metadata json file
* @return import process
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> importProcessDefinition(User loginUser, long projectCode, MultipartFile file) {
Map<String, Object> result = new HashMap<>();
String dagDataScheduleJson = FileUtils.file2String(file);
List<DagDataSchedule> dagDataScheduleList = JSONUtils.toList(dagDataScheduleJson, DagDataSchedule.class);
if (CollectionUtils.isEmpty(dagDataScheduleList)) {
putMsg(result, Status.DATA_IS_NULL, "fileContent");
return result;
}
for (DagDataSchedule dagDataSchedule : dagDataScheduleList) {
if (!checkAndImport(loginUser, projectCode, result, dagDataSchedule)) {
return result;
}
}
return result;
}
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> importSqlProcessDefinition(User loginUser, long projectCode, MultipartFile file) {
Map<String, Object> result = new HashMap<>();
String processDefinitionName = file.getOriginalFilename() == null ? file.getName() : file.getOriginalFilename();
int index = processDefinitionName.lastIndexOf(".");
if (index > 0) {
processDefinitionName = processDefinitionName.substring(0, index);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | processDefinitionName = processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp();
ProcessDefinition processDefinition;
List<TaskDefinitionLog> taskDefinitionList = new ArrayList<>();
List<ProcessTaskRelationLog> processTaskRelationList = new ArrayList<>();
final int THRESHOLD_ENTRIES = 10000;
final int THRESHOLD_SIZE = 1000000000;
final double THRESHOLD_RATIO = 10;
int totalEntryArchive = 0;
int totalSizeEntry = 0;
Map<String, DataSource> dataSourceCache = new HashMap<>(1);
Map<String, Long> taskNameToCode = new HashMap<>(16);
Map<String, List<String>> taskNameToUpstream = new HashMap<>(16);
try (ZipInputStream zIn = new ZipInputStream(file.getInputStream());
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(zIn))) {
processDefinition = new ProcessDefinition(projectCode,
processDefinitionName,
CodeGenerateUtils.getInstance().genCode(),
"",
"[]", null,
0, loginUser.getId(), loginUser.getTenantId());
ZipEntry entry;
while ((entry = zIn.getNextEntry()) != null) {
totalEntryArchive++;
int totalSizeArchive = 0;
if (!entry.isDirectory()) {
StringBuilder sql = new StringBuilder();
String taskName = null; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | String datasourceName = null;
List<String> upstreams = Collections.emptyList();
String line;
while ((line = bufferedReader.readLine()) != null) {
int nBytes = line.getBytes(StandardCharsets.UTF_8).length;
totalSizeEntry += nBytes;
totalSizeArchive += nBytes;
long compressionRatio = totalSizeEntry / entry.getCompressedSize();
if (compressionRatio > THRESHOLD_RATIO) {
throw new IllegalStateException("ratio between compressed and uncompressed data is highly suspicious, looks like a Zip Bomb Attack");
}
int commentIndex = line.indexOf("-- ");
if (commentIndex >= 0) {
int colonIndex = line.indexOf(":", commentIndex);
if (colonIndex > 0) {
String key = line.substring(commentIndex + 3, colonIndex).trim().toLowerCase();
String value = line.substring(colonIndex + 1).trim();
switch (key) {
case "name":
taskName = value;
line = line.substring(0, commentIndex);
break;
case "upstream":
upstreams = Arrays.stream(value.split(",")).map(String::trim)
.filter(s -> !"".equals(s)).collect(Collectors.toList());
line = line.substring(0, commentIndex);
break;
case "datasource":
datasourceName = value;
line = line.substring(0, commentIndex); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | break;
default:
break;
}
}
}
if (!"".equals(line)) {
sql.append(line).append("\n");
}
}
if (taskName == null) {
taskName = entry.getName();
index = taskName.indexOf("/");
if (index > 0) {
taskName = taskName.substring(index + 1);
}
index = taskName.lastIndexOf(".");
if (index > 0) {
taskName = taskName.substring(0, index);
}
}
DataSource dataSource = dataSourceCache.get(datasourceName);
if (dataSource == null) {
dataSource = queryDatasourceByNameAndUser(datasourceName, loginUser);
}
if (dataSource == null) {
putMsg(result, Status.DATASOURCE_NAME_ILLEGAL);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | dataSourceCache.put(datasourceName, dataSource);
TaskDefinitionLog taskDefinition = buildNormalSqlTaskDefinition(taskName, dataSource, sql.substring(0, sql.length() - 1));
taskDefinitionList.add(taskDefinition);
taskNameToCode.put(taskDefinition.getName(), taskDefinition.getCode());
taskNameToUpstream.put(taskDefinition.getName(), upstreams);
}
if (totalSizeArchive > THRESHOLD_SIZE) {
throw new IllegalStateException("the uncompressed data size is too much for the application resource capacity");
}
if (totalEntryArchive > THRESHOLD_ENTRIES) {
throw new IllegalStateException("too much entries in this archive, can lead to inodes exhaustion of the system");
}
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
return result;
}
for (Map.Entry<String, Long> entry : taskNameToCode.entrySet()) {
List<String> upstreams = taskNameToUpstream.get(entry.getKey());
if (CollectionUtils.isEmpty(upstreams)
|| (upstreams.size() == 1 && upstreams.contains("root") && !taskNameToCode.containsKey("root"))) {
ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(0, entry.getValue());
processTaskRelationList.add(processTaskRelation);
continue;
}
for (String upstream : upstreams) {
ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(taskNameToCode.get(upstream), entry.getValue());
processTaskRelationList.add(processTaskRelation); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
}
return createDagDefine(loginUser, processTaskRelationList, processDefinition, taskDefinitionList);
}
private ProcessTaskRelationLog buildNormalTaskRelation(long preTaskCode, long postTaskCode) {
ProcessTaskRelationLog processTaskRelation = new ProcessTaskRelationLog();
processTaskRelation.setPreTaskCode(preTaskCode);
processTaskRelation.setPreTaskVersion(0);
processTaskRelation.setPostTaskCode(postTaskCode);
processTaskRelation.setPostTaskVersion(0);
processTaskRelation.setConditionType(ConditionType.NONE);
processTaskRelation.setName("");
return processTaskRelation;
}
private DataSource queryDatasourceByNameAndUser(String datasourceName, User loginUser) {
if (isAdmin(loginUser)) {
List<DataSource> dataSources = dataSourceMapper.queryDataSourceByName(datasourceName);
if (CollectionUtils.isNotEmpty(dataSources)) {
return dataSources.get(0);
}
} else {
return dataSourceMapper.queryDataSourceByNameAndUserId(loginUser.getId(), datasourceName);
}
return null;
}
private TaskDefinitionLog buildNormalSqlTaskDefinition(String taskName, DataSource dataSource, String sql) throws CodeGenerateException {
TaskDefinitionLog taskDefinition = new TaskDefinitionLog();
taskDefinition.setName(taskName);
taskDefinition.setFlag(Flag.YES);
SqlParameters sqlParameters = new SqlParameters(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | sqlParameters.setType(dataSource.getType().name());
sqlParameters.setDatasource(dataSource.getId());
sqlParameters.setSql(sql.substring(0, sql.length() - 1));
sqlParameters.setSqlType(SqlType.NON_QUERY.ordinal());
sqlParameters.setLocalParams(Collections.emptyList());
taskDefinition.setTaskParams(JSONUtils.toJsonString(sqlParameters));
taskDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
taskDefinition.setTaskType(TaskType.SQL.getDesc());
taskDefinition.setFailRetryTimes(0);
taskDefinition.setFailRetryInterval(0);
taskDefinition.setTimeoutFlag(TimeoutFlag.CLOSE);
taskDefinition.setWorkerGroup(DEFAULT_WORKER_GROUP);
taskDefinition.setTaskPriority(Priority.MEDIUM);
taskDefinition.setEnvironmentCode(-1);
taskDefinition.setTimeout(0);
taskDefinition.setDelayTime(0);
taskDefinition.setTimeoutNotifyStrategy(TaskTimeoutStrategy.WARN);
taskDefinition.setVersion(0);
taskDefinition.setResourceIds("");
return taskDefinition;
}
/**
* check and import
*/
private boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result, DagDataSchedule dagDataSchedule) {
if (!checkImportanceParams(dagDataSchedule, result)) {
return false;
}
ProcessDefinition processDefinition = dagDataSchedule.getProcessDefinition(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, projectCode, processDefinition.getName());
if (Status.SUCCESS.equals(checkResult.get(Constants.STATUS))) {
putMsg(result, Status.SUCCESS);
} else {
result.putAll(checkResult);
return false;
}
String processDefinitionName = recursionProcessDefinitionName(projectCode, processDefinition.getName(), 1);
processDefinition.setName(processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp());
processDefinition.setId(0);
processDefinition.setProjectCode(projectCode);
processDefinition.setUserId(loginUser.getId());
try {
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
return false;
}
List<TaskDefinition> taskDefinitionList = dagDataSchedule.getTaskDefinitionList();
Map<Long, Long> taskCodeMap = new HashMap<>();
Date now = new Date();
List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>();
for (TaskDefinition taskDefinition : taskDefinitionList) {
TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(taskDefinition);
taskDefinitionLog.setName(taskDefinitionLog.getName() + "_import_" + DateUtils.getCurrentTimeStamp());
taskDefinitionLog.setProjectCode(projectCode);
taskDefinitionLog.setUserId(loginUser.getId());
taskDefinitionLog.setVersion(Constants.VERSION_FIRST);
taskDefinitionLog.setCreateTime(now); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | taskDefinitionLog.setUpdateTime(now);
taskDefinitionLog.setOperator(loginUser.getId());
taskDefinitionLog.setOperateTime(now);
try {
long code = CodeGenerateUtils.getInstance().genCode();
taskCodeMap.put(taskDefinitionLog.getCode(), code);
taskDefinitionLog.setCode(code);
} catch (CodeGenerateException e) {
logger.error("Task code get error, ", e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code");
return false;
}
taskDefinitionLogList.add(taskDefinitionLog);
}
int insert = taskDefinitionMapper.batchInsert(taskDefinitionLogList);
int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionLogList);
if ((logInsert & insert) == 0) {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
List<ProcessTaskRelation> taskRelationList = dagDataSchedule.getProcessTaskRelationList();
List<ProcessTaskRelationLog> taskRelationLogList = new ArrayList<>();
for (ProcessTaskRelation processTaskRelation : taskRelationList) {
ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog(processTaskRelation);
if (taskCodeMap.containsKey(processTaskRelationLog.getPreTaskCode())) {
processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode()));
}
if (taskCodeMap.containsKey(processTaskRelationLog.getPostTaskCode())) {
processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode()));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | processTaskRelationLog.setPreTaskVersion(Constants.VERSION_FIRST);
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST);
taskRelationLogList.add(processTaskRelationLog);
}
if (StringUtils.isNotEmpty(processDefinition.getLocations()) && JSONUtils.checkJsonValid(processDefinition.getLocations())) {
ArrayNode arrayNode = JSONUtils.parseArray(processDefinition.getLocations());
ArrayNode newArrayNode = JSONUtils.createArrayNode();
for (int i = 0; i < arrayNode.size(); i++) {
ObjectNode newObjectNode = newArrayNode.addObject();
JsonNode jsonNode = arrayNode.get(i);
Long taskCode = taskCodeMap.get(jsonNode.get("taskCode").asLong());
if (Objects.nonNull(taskCode)) {
newObjectNode.put("taskCode", taskCode);
newObjectNode.set("x", jsonNode.get("x"));
newObjectNode.set("y", jsonNode.get("y"));
}
}
processDefinition.setLocations(newArrayNode.toString());
}
processDefinition.setCreateTime(new Date());
processDefinition.setUpdateTime(new Date());
Map<String, Object> createDagResult = createDagDefine(loginUser, taskRelationLogList, processDefinition, Lists.newArrayList());
if (Status.SUCCESS.equals(createDagResult.get(Constants.STATUS))) {
putMsg(createDagResult, Status.SUCCESS);
} else {
result.putAll(createDagResult);
throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR);
}
Schedule schedule = dagDataSchedule.getSchedule();
if (null != schedule) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | ProcessDefinition newProcessDefinition = processDefinitionMapper.queryByCode(processDefinition.getCode());
schedule.setProcessDefinitionCode(newProcessDefinition.getCode());
schedule.setUserId(loginUser.getId());
schedule.setCreateTime(now);
schedule.setUpdateTime(now);
int scheduleInsert = scheduleMapper.insert(schedule);
if (0 == scheduleInsert) {
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR);
}
}
return true;
}
/**
* check importance params
*/
private boolean checkImportanceParams(DagDataSchedule dagDataSchedule, Map<String, Object> result) {
if (dagDataSchedule.getProcessDefinition() == null) {
putMsg(result, Status.DATA_IS_NULL, "ProcessDefinition");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getTaskDefinitionList())) {
putMsg(result, Status.DATA_IS_NULL, "TaskDefinitionList");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getProcessTaskRelationList())) {
putMsg(result, Status.DATA_IS_NULL, "ProcessTaskRelationList");
return false;
}
return true; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
private String recursionProcessDefinitionName(long projectCode, String processDefinitionName, int num) {
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName);
if (processDefinition != null) {
if (num > 1) {
String str = processDefinitionName.substring(0, processDefinitionName.length() - 3);
processDefinitionName = str + "(" + num + ")";
} else {
processDefinitionName = processDefinition.getName() + "(" + num + ")";
}
} else {
return processDefinitionName;
}
return recursionProcessDefinitionName(projectCode, processDefinitionName, num + 1);
}
/**
* check the process task relation json
*
* @param processTaskRelationJson process task relation json
* @return check result code
*/
@Override
public Map<String, Object> checkProcessNodeList(String processTaskRelationJson) {
Map<String, Object> result = new HashMap<>();
try {
if (processTaskRelationJson == null) {
logger.error("process data is null");
putMsg(result, Status.DATA_IS_NOT_VALID, processTaskRelationJson);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<ProcessTaskRelation> taskRelationList = JSONUtils.toList(processTaskRelationJson, ProcessTaskRelation.class);
List<TaskNode> taskNodes = processService.transformTask(taskRelationList, Lists.newArrayList());
if (CollectionUtils.isEmpty(taskNodes)) {
logger.error("process node info is empty");
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
if (graphHasCycle(taskNodes)) {
logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (TaskNode taskNode : taskNodes) {
if (!CheckUtils.checkTaskNodeParameters(taskNode)) {
logger.error("task node {} parameter invalid", taskNode.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName());
return result;
}
CheckUtils.checkOtherParams(taskNode.getExtras());
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
result.put(Constants.MSG, e.getMessage());
}
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
/**
* get task node details based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param code process definition code
* @return task node list
*/
@Override
public Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData.getTaskDefinitionList());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get task node details map based on process definition |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | *
* @param loginUser loginUser
* @param projectCode project code
* @param codes define codes
* @return task node list
*/
@Override
public Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser, long projectCode, String codes) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet);
if (CollectionUtils.isEmpty(processDefinitionList)) {
logger.info("process definition not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result;
}
HashMap<Long, Project> userProjects = new HashMap<>(Constants.DEFAULT_HASH_MAP_SIZE);
projectMapper.queryProjectCreatedAndAuthorizedByUserId(loginUser.getId())
.forEach(userProject -> userProjects.put(userProject.getCode(), userProject));
List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream()
.filter(o -> userProjects.containsKey(o.getProjectCode())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(processDefinitionListInProject)) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
Map<Long, List<TaskDefinition>> taskNodeMap = new HashMap<>();
for (ProcessDefinition processDefinition : processDefinitionListInProject) {
DagData dagData = processService.genDagData(processDefinition);
taskNodeMap.put(processDefinition.getCode(), dagData.getTaskDefinitionList());
}
result.put(Constants.DATA_LIST, taskNodeMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition all by project code
*
* @param loginUser loginUser
* @param projectCode project code
* @return process definitions in the project
*/
@Override
public Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode);
List<DagData> dagDataList = processDefinitions.stream().map(processService::genDagData).collect(Collectors.toList());
result.put(Constants.DATA_LIST, dagDataList);
putMsg(result, Status.SUCCESS);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
/**
* Encapsulates the TreeView structure
*
* @param projectCode project code
* @param code process definition code
* @param limit limit
* @return tree view json data
*/
@Override
public Map<String, Object> viewTree(long projectCode, long code, Integer limit) {
Map<String, Object> result = new HashMap<>();
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (null == processDefinition || projectCode != processDefinition.getProjectCode()) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition);
Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>();
Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>();
List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineCode(code, limit);
processInstanceList.forEach(processInstance -> processInstance.setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())));
List<TaskDefinitionLog> taskDefinitionList = processService.genTaskDefineList(processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode()));
Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog));
if (limit > processInstanceList.size()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | limit = processInstanceList.size();
}
TreeViewDto parentTreeViewDto = new TreeViewDto();
parentTreeViewDto.setName("DAG");
parentTreeViewDto.setType("");
parentTreeViewDto.setCode(0L);
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime();
parentTreeViewDto.getInstances().add(new Instance(processInstance.getId(), processInstance.getName(), processInstance.getProcessDefinitionCode(),
"", processInstance.getState().toString(), processInstance.getStartTime(), endTime, processInstance.getHost(),
DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime())));
}
List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>();
parentTreeViewDtoList.add(parentTreeViewDto);
for (String startNode : dag.getBeginNode()) {
runningNodeMap.put(startNode, parentTreeViewDtoList);
}
while (Stopper.isRunning()) {
Set<String> postNodeList;
Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, List<TreeViewDto>> en = iter.next();
String nodeCode = en.getKey();
parentTreeViewDtoList = en.getValue();
TreeViewDto treeViewDto = new TreeViewDto();
TaskNode taskNode = dag.getNode(nodeCode);
treeViewDto.setType(taskNode.getType()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | treeViewDto.setCode(taskNode.getCode());
treeViewDto.setName(taskNode.getName());
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndCode(processInstance.getId(), Long.parseLong(nodeCode));
if (taskInstance == null) {
treeViewDto.getInstances().add(new Instance(-1, "not running", 0, "null"));
} else {
Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime();
Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime();
long subProcessCode = 0L;
if (taskInstance.isSubProcess()) {
TaskDefinition taskDefinition = taskDefinitionMap.get(taskInstance.getTaskCode());
subProcessCode = Integer.parseInt(JSONUtils.parseObject(
taskDefinition.getTaskParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_CODE).asText());
}
treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskCode(),
taskInstance.getTaskType(), taskInstance.getState().toString(), taskInstance.getStartTime(), taskInstance.getEndTime(),
taskInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessCode));
}
}
for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) {
pTreeViewDto.getChildren().add(treeViewDto);
}
postNodeList = dag.getSubsequentNodes(nodeCode);
if (CollectionUtils.isNotEmpty(postNodeList)) {
for (String nextNodeCode : postNodeList) {
List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (CollectionUtils.isEmpty(treeViewDtoList)) {
treeViewDtoList = new ArrayList<>();
}
treeViewDtoList.add(treeViewDto);
waitingRunningNodeMap.put(nextNodeCode, treeViewDtoList);
}
}
runningNodeMap.remove(nodeCode);
}
if (waitingRunningNodeMap.size() == 0) {
break;
} else {
runningNodeMap.putAll(waitingRunningNodeMap);
waitingRunningNodeMap.clear();
}
}
result.put(Constants.DATA_LIST, parentTreeViewDto);
result.put(Constants.STATUS, Status.SUCCESS);
result.put(Constants.MSG, Status.SUCCESS.getMsg());
return result;
}
/**
* whether the graph has a ring
*
* @param taskNodeResponseList task node response list
* @return if graph has cycle flag
*/
private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) {
DAG<String, TaskNode, String> graph = new DAG<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | for (TaskNode taskNodeResponse : taskNodeResponseList) {
graph.addNode(Long.toString(taskNodeResponse.getCode()), taskNodeResponse);
}
for (TaskNode taskNodeResponse : taskNodeResponseList) {
List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class);
if (CollectionUtils.isNotEmpty(preTasks)) {
for (String preTask : preTasks) {
if (!graph.addEdge(preTask, Long.toString(taskNodeResponse.getCode()))) {
return true;
}
}
}
}
return graph.hasCycle();
}
/**
* batch copy process definition
*
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
@Override
public Map<String, Object> batchCopyProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) {
Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, true);
if (result.get(Constants.STATUS) == Status.NOT_SUPPORT_COPY_TASK_TYPE) {
return result;
}
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, true);
return result;
}
/**
* batch move process definition
* Will be deleted
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> batchMoveProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) {
Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (projectCode == targetProjectCode) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,119 | [Bug] [API] Update ProcessInstance error and without reason output | ### 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

Update ProcessInstance error.And there is no cause for error.
### What you expected to happen
Update ProcessInstance error
### How to reproduce
create a new task in process instance edit page and link to another task.
### Version
2.0.2
### 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/8119 | https://github.com/apache/dolphinscheduler/pull/8122 | 38b40e7ac49390164207104a4a788639b12696c4 | b5631d5281e84b72afa44a3d37631ffdbfd178ca | 2022-01-19T07:32:41Z | java | 2022-01-21T01:32:38Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, false);
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, false);
return result;
}
private Map<String, Object> checkParams(User loginUser,
long projectCode,
String processDefinitionCodes,
long targetProjectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (org.apache.commons.lang.StringUtils.isEmpty(processDefinitionCodes)) {
putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY, processDefinitionCodes);
return result;
}
if (projectCode != targetProjectCode) {
Project targetProject = projectMapper.queryByCode(targetProjectCode);
Map<String, Object> targetResult = projectService.checkProjectAndAuth(loginUser, targetProject, targetProjectCode);
if (targetResult.get(Constants.STATUS) != Status.SUCCESS) {
return targetResult;
}
}
return result; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.