mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-03 04:39:00 +08:00
[Improvement-5785][common] Fix code format (#6864)
* [DS-5785][style] Fix common module code format * [DS-5785][style] Fix common module code format
This commit is contained in:
parent
1c6ef50036
commit
1a88b1863b
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
@ -29,8 +30,7 @@ public enum AlertStatus {
|
||||
EXECUTION_SUCCESS(1, "execute successfully"),
|
||||
EXECUTION_FAILURE(2, "execute failed");
|
||||
|
||||
|
||||
AlertStatus(int code, String descp){
|
||||
AlertStatus(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
@ -28,8 +29,7 @@ public enum AlertType {
|
||||
EMAIL(0, "email"),
|
||||
SMS(1, "SMS");
|
||||
|
||||
|
||||
AlertType(int code, String descp){
|
||||
AlertType(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
@ -35,7 +36,7 @@ public enum AuthorizationType {
|
||||
DATASOURCE(3, "data source"),
|
||||
UDF(4, "udf function");
|
||||
|
||||
AuthorizationType(int code, String descp){
|
||||
AuthorizationType(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
|
@ -14,13 +14,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
|
||||
/**
|
||||
* command types
|
||||
*/
|
||||
@ -54,7 +55,7 @@ public enum CommandType {
|
||||
RECOVER_SERIAL_WAIT(11, "recover serial wait"),
|
||||
;
|
||||
|
||||
CommandType(int code, String descp){
|
||||
CommandType(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
@ -79,7 +80,6 @@ public enum CommandType {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static CommandType of(Integer status) {
|
||||
if (COMMAND_TYPE_MAP.containsKey(status)) {
|
||||
return COMMAND_TYPE_MAP.get(status);
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
@ -23,27 +24,27 @@ import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
*/
|
||||
public enum FailureStrategy {
|
||||
|
||||
/**
|
||||
* 0 ending process when some tasks failed.
|
||||
* 1 continue running when some tasks failed.
|
||||
**/
|
||||
END(0, "end"),
|
||||
CONTINUE(1, "continue");
|
||||
/**
|
||||
* 0 ending process when some tasks failed.
|
||||
* 1 continue running when some tasks failed.
|
||||
**/
|
||||
END(0, "end"),
|
||||
CONTINUE(1, "continue");
|
||||
|
||||
FailureStrategy(int code, String descp){
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
FailureStrategy(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
|
||||
@EnumValue
|
||||
private final int code;
|
||||
private final String descp;
|
||||
@EnumValue
|
||||
private final int code;
|
||||
private final String descp;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescp() {
|
||||
return descp;
|
||||
}
|
||||
public String getDescp() {
|
||||
return descp;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
|
@ -14,17 +14,18 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
/**
|
||||
* http check condition
|
||||
*/
|
||||
public enum HttpCheckCondition {
|
||||
/**
|
||||
* 0 status_code_default:200
|
||||
* 1 status_code_custom
|
||||
* 2 body_contains
|
||||
* 3 body_not_contains
|
||||
*/
|
||||
STATUS_CODE_DEFAULT,STATUS_CODE_CUSTOM, BODY_CONTAINS, BODY_NOT_CONTAINS
|
||||
/**
|
||||
* 0 status_code_default:200
|
||||
* 1 status_code_custom
|
||||
* 2 body_contains
|
||||
* 3 body_not_contains
|
||||
*/
|
||||
STATUS_CODE_DEFAULT,STATUS_CODE_CUSTOM, BODY_CONTAINS, BODY_NOT_CONTAINS
|
||||
}
|
@ -14,18 +14,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
/**
|
||||
* http method
|
||||
*/
|
||||
public enum HttpMethod {
|
||||
/**
|
||||
* 0 get
|
||||
* 1 post
|
||||
* 2 head
|
||||
* 3 put
|
||||
* 4 delete
|
||||
*/
|
||||
GET, POST, HEAD, PUT, DELETE
|
||||
/**
|
||||
* 0 get
|
||||
* 1 post
|
||||
* 2 head
|
||||
* 3 put
|
||||
* 4 delete
|
||||
*/
|
||||
GET, POST, HEAD, PUT, DELETE
|
||||
}
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
public enum NodeType {
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
|
@ -14,8 +14,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
/**
|
||||
* support program types
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
@ -30,7 +31,7 @@ public enum ReleaseState {
|
||||
OFFLINE(0, "offline"),
|
||||
ONLINE(1, "online");
|
||||
|
||||
ReleaseState(int code, String descp){
|
||||
ReleaseState(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
@ -39,9 +40,9 @@ public enum ReleaseState {
|
||||
private final int code;
|
||||
private final String descp;
|
||||
|
||||
public static ReleaseState getEnum(int value){
|
||||
public static ReleaseState getEnum(int value) {
|
||||
for (ReleaseState e:ReleaseState.values()) {
|
||||
if(e.ordinal() == value) {
|
||||
if (e.ordinal() == value) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
@ -29,7 +30,7 @@ public enum RunMode {
|
||||
RUN_MODE_SERIAL(0, "serial run"),
|
||||
RUN_MODE_PARALLEL(1, "parallel run");
|
||||
|
||||
RunMode(int code, String descp){
|
||||
RunMode(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
@ -27,7 +28,7 @@ public enum SparkVersion {
|
||||
SPARK1(0, "SPARK1"),
|
||||
SPARK2(1, "SPARK2");
|
||||
|
||||
SparkVersion(int code, String descp){
|
||||
SparkVersion(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
@ -22,7 +23,7 @@ public enum SqoopJobType {
|
||||
CUSTOM(0, "CUSTOM"),
|
||||
TEMPLATE(1, "TEMPLATE");
|
||||
|
||||
SqoopJobType(int code, String descp){
|
||||
SqoopJobType(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
@ -22,29 +23,29 @@ import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
* task node depend type
|
||||
*/
|
||||
public enum TaskDependType {
|
||||
/**
|
||||
* 0 run current tasks only
|
||||
* 1 run current tasks and previous tasks
|
||||
* 2 run current tasks and the other tasks that depend on current tasks;
|
||||
*/
|
||||
TASK_ONLY(0, "task only"),
|
||||
TASK_PRE(1, "task pre"),
|
||||
TASK_POST(2, "task post");
|
||||
/**
|
||||
* 0 run current tasks only
|
||||
* 1 run current tasks and previous tasks
|
||||
* 2 run current tasks and the other tasks that depend on current tasks;
|
||||
*/
|
||||
TASK_ONLY(0, "task only"),
|
||||
TASK_PRE(1, "task pre"),
|
||||
TASK_POST(2, "task post");
|
||||
|
||||
TaskDependType(int code, String descp){
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
TaskDependType(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
|
||||
@EnumValue
|
||||
private final int code;
|
||||
private final String descp;
|
||||
@EnumValue
|
||||
private final int code;
|
||||
private final String descp;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescp() {
|
||||
return descp;
|
||||
}
|
||||
public String getDescp() {
|
||||
return descp;
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
/**
|
||||
* task record status
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
@ -28,8 +29,7 @@ public enum UserType {
|
||||
ADMIN_USER(0, "admin user"),
|
||||
GENERAL_USER(1, "general user");
|
||||
|
||||
|
||||
UserType(int code, String descp){
|
||||
UserType(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
@ -22,32 +23,31 @@ import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
* types for whether to send warning when process ending;
|
||||
*/
|
||||
public enum WarningType {
|
||||
/**
|
||||
* 0 do not send warning;
|
||||
* 1 send if process success;
|
||||
* 2 send if process failed;
|
||||
* 3 send if process ending;
|
||||
*/
|
||||
NONE(0, "none"),
|
||||
SUCCESS(1, "success"),
|
||||
FAILURE(2, "failure"),
|
||||
ALL(3, "all");
|
||||
/**
|
||||
* 0 do not send warning;
|
||||
* 1 send if process success;
|
||||
* 2 send if process failed;
|
||||
* 3 send if process ending;
|
||||
*/
|
||||
NONE(0, "none"),
|
||||
SUCCESS(1, "success"),
|
||||
FAILURE(2, "failure"),
|
||||
ALL(3, "all");
|
||||
|
||||
WarningType(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
|
||||
WarningType(int code, String descp){
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
@EnumValue
|
||||
private final int code;
|
||||
private final String descp;
|
||||
|
||||
@EnumValue
|
||||
private final int code;
|
||||
private final String descp;
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescp() {
|
||||
return descp;
|
||||
}
|
||||
public String getDescp() {
|
||||
return descp;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.graph;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
@ -14,26 +14,26 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dolphinscheduler.common.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
package org.apache.dolphinscheduler.common.model;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* date interval class
|
||||
*/
|
||||
public class DateInterval {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date endTime;
|
||||
|
||||
public DateInterval(Date beginTime, Date endTime){
|
||||
public DateInterval(Date beginTime, Date endTime) {
|
||||
this.startTime = beginTime;
|
||||
this.endTime = endTime;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,8 +44,8 @@ public class DateInterval {
|
||||
return true;
|
||||
} else {
|
||||
DateInterval that = (DateInterval) obj;
|
||||
return startTime.equals(that.startTime) &&
|
||||
endTime.equals(that.endTime);
|
||||
return startTime.equals(that.startTime)
|
||||
&& endTime.equals(that.endTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.model;
|
||||
|
||||
import org.apache.dolphinscheduler.common.enums.DependentRelation;
|
||||
|
@ -14,13 +14,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* server
|
||||
*/
|
||||
@ -54,13 +54,13 @@ public class Server {
|
||||
/**
|
||||
* create time
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* laster heart beat time
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date lastHeartbeatTime;
|
||||
|
||||
public int getId() {
|
||||
|
@ -14,66 +14,66 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class TaskNodeRelation {
|
||||
|
||||
/**
|
||||
* task start node name
|
||||
*/
|
||||
private String startNode;
|
||||
/**
|
||||
* task start node name
|
||||
*/
|
||||
private String startNode;
|
||||
|
||||
/**
|
||||
* task end node name
|
||||
*/
|
||||
private String endNode;
|
||||
/**
|
||||
* task end node name
|
||||
*/
|
||||
private String endNode;
|
||||
|
||||
public TaskNodeRelation() {
|
||||
}
|
||||
|
||||
public TaskNodeRelation(String startNode, String endNode) {
|
||||
this.startNode = startNode;
|
||||
this.endNode = endNode;
|
||||
}
|
||||
|
||||
public String getStartNode() {
|
||||
return startNode;
|
||||
}
|
||||
|
||||
public void setStartNode(String startNode) {
|
||||
this.startNode = startNode;
|
||||
}
|
||||
|
||||
public String getEndNode() {
|
||||
return endNode;
|
||||
}
|
||||
|
||||
public void setEndNode(String endNode) {
|
||||
this.endNode = endNode;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o){
|
||||
if (!(o instanceof TaskNodeRelation)) {
|
||||
return false;
|
||||
public TaskNodeRelation() {
|
||||
}
|
||||
TaskNodeRelation relation = (TaskNodeRelation)o;
|
||||
return (relation.getStartNode().equals(this.startNode) && relation.getEndNode().equals(this.endNode));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskNodeRelation{" +
|
||||
"startNode='" + startNode + '\'' +
|
||||
", endNode='" + endNode + '\'' +
|
||||
'}';
|
||||
}
|
||||
public TaskNodeRelation(String startNode, String endNode) {
|
||||
this.startNode = startNode;
|
||||
this.endNode = endNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(startNode, endNode);
|
||||
}
|
||||
public String getStartNode() {
|
||||
return startNode;
|
||||
}
|
||||
|
||||
public void setStartNode(String startNode) {
|
||||
this.startNode = startNode;
|
||||
}
|
||||
|
||||
public String getEndNode() {
|
||||
return endNode;
|
||||
}
|
||||
|
||||
public void setEndNode(String endNode) {
|
||||
this.endNode = endNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof TaskNodeRelation)) {
|
||||
return false;
|
||||
}
|
||||
TaskNodeRelation relation = (TaskNodeRelation)o;
|
||||
return (relation.getStartNode().equals(this.startNode) && relation.getEndNode().equals(this.endNode));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskNodeRelation{"
|
||||
+ "startNode='" + startNode + '\''
|
||||
+ ", endNode='" + endNode + '\''
|
||||
+ '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(startNode, endNode);
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dolphinscheduler.common.model;
|
||||
|
||||
package org.apache.dolphinscheduler.common.model;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.process;
|
||||
|
||||
import org.apache.dolphinscheduler.common.enums.HttpParametersType;
|
||||
@ -21,105 +22,102 @@ import org.apache.dolphinscheduler.common.enums.HttpParametersType;
|
||||
import java.util.Objects;
|
||||
|
||||
public class HttpProperty {
|
||||
/**
|
||||
* key
|
||||
*/
|
||||
private String prop;
|
||||
/**
|
||||
* key
|
||||
*/
|
||||
private String prop;
|
||||
|
||||
/**
|
||||
* httpParametersType
|
||||
*/
|
||||
private HttpParametersType httpParametersType;
|
||||
/**
|
||||
* httpParametersType
|
||||
*/
|
||||
private HttpParametersType httpParametersType;
|
||||
|
||||
/**
|
||||
* value
|
||||
*/
|
||||
private String value;
|
||||
/**
|
||||
* value
|
||||
*/
|
||||
private String value;
|
||||
|
||||
public HttpProperty() {
|
||||
}
|
||||
|
||||
public HttpProperty(String prop, HttpParametersType httpParametersType, String value) {
|
||||
this.prop = prop;
|
||||
this.httpParametersType = httpParametersType;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method
|
||||
*
|
||||
* @return the prop
|
||||
* @see HttpProperty#prop
|
||||
*/
|
||||
public String getProp() {
|
||||
return prop;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter method
|
||||
*
|
||||
* @param prop the prop to set
|
||||
* @see HttpProperty#prop
|
||||
*/
|
||||
public void setProp(String prop) {
|
||||
this.prop = prop;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method
|
||||
*
|
||||
* @return the value
|
||||
* @see HttpProperty#value
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter method
|
||||
*
|
||||
* @param value the value to set
|
||||
* @see HttpProperty#value
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public HttpParametersType getHttpParametersType() {
|
||||
return httpParametersType;
|
||||
}
|
||||
|
||||
public void setHttpParametersType(HttpParametersType httpParametersType) {
|
||||
this.httpParametersType = httpParametersType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
public HttpProperty() {
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
|
||||
public HttpProperty(String prop, HttpParametersType httpParametersType, String value) {
|
||||
this.prop = prop;
|
||||
this.httpParametersType = httpParametersType;
|
||||
this.value = value;
|
||||
}
|
||||
HttpProperty property = (HttpProperty) o;
|
||||
return Objects.equals(prop, property.prop) &&
|
||||
Objects.equals(value, property.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method
|
||||
*
|
||||
* @return the prop
|
||||
* @see HttpProperty#prop
|
||||
*/
|
||||
public String getProp() {
|
||||
return prop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(prop, value);
|
||||
}
|
||||
/**
|
||||
* setter method
|
||||
*
|
||||
* @param prop the prop to set
|
||||
* @see HttpProperty#prop
|
||||
*/
|
||||
public void setProp(String prop) {
|
||||
this.prop = prop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HttpProperty{" +
|
||||
"prop='" + prop + '\'' +
|
||||
", httpParametersType=" + httpParametersType +
|
||||
", value='" + value + '\'' +
|
||||
'}';
|
||||
}
|
||||
/**
|
||||
* getter method
|
||||
*
|
||||
* @return the value
|
||||
* @see HttpProperty#value
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter method
|
||||
*
|
||||
* @param value the value to set
|
||||
* @see HttpProperty#value
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public HttpParametersType getHttpParametersType() {
|
||||
return httpParametersType;
|
||||
}
|
||||
|
||||
public void setHttpParametersType(HttpParametersType httpParametersType) {
|
||||
this.httpParametersType = httpParametersType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
HttpProperty property = (HttpProperty) o;
|
||||
return Objects.equals(prop, property.prop)
|
||||
&& Objects.equals(value, property.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(prop, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HttpProperty{"
|
||||
+ "prop='" + prop + '\''
|
||||
+ ", httpParametersType=" + httpParametersType
|
||||
+ ", value='" + value + '\''
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.process;
|
||||
|
||||
|
||||
|
||||
import org.apache.dolphinscheduler.common.model.TaskNode;
|
||||
import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
|
||||
|
||||
@ -25,61 +24,61 @@ import java.util.List;
|
||||
|
||||
public class ProcessDag {
|
||||
|
||||
/**
|
||||
* DAG edge list
|
||||
**/
|
||||
private List<TaskNodeRelation> edges;
|
||||
/**
|
||||
* DAG edge list
|
||||
**/
|
||||
private List<TaskNodeRelation> edges;
|
||||
|
||||
/**
|
||||
* DAG node list
|
||||
*/
|
||||
private List<TaskNode> nodes;
|
||||
/**
|
||||
* DAG node list
|
||||
*/
|
||||
private List<TaskNode> nodes;
|
||||
|
||||
/**
|
||||
* getter method
|
||||
*
|
||||
* @return the edges
|
||||
* @see ProcessDag#edges
|
||||
*/
|
||||
public List<TaskNodeRelation> getEdges() {
|
||||
return edges;
|
||||
}
|
||||
/**
|
||||
* getter method
|
||||
*
|
||||
* @return the edges
|
||||
* @see ProcessDag#edges
|
||||
*/
|
||||
public List<TaskNodeRelation> getEdges() {
|
||||
return edges;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter method
|
||||
*
|
||||
* @param edges the edges to set
|
||||
* @see ProcessDag#edges
|
||||
*/
|
||||
public void setEdges(List<TaskNodeRelation> edges) {
|
||||
this.edges = edges;
|
||||
}
|
||||
/**
|
||||
* setter method
|
||||
*
|
||||
* @param edges the edges to set
|
||||
* @see ProcessDag#edges
|
||||
*/
|
||||
public void setEdges(List<TaskNodeRelation> edges) {
|
||||
this.edges = edges;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method
|
||||
*
|
||||
* @return the nodes
|
||||
* @see ProcessDag#nodes
|
||||
*/
|
||||
public List<TaskNode> getNodes() {
|
||||
return nodes;
|
||||
}
|
||||
/**
|
||||
* getter method
|
||||
*
|
||||
* @return the nodes
|
||||
* @see ProcessDag#nodes
|
||||
*/
|
||||
public List<TaskNode> getNodes() {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter method
|
||||
*
|
||||
* @param nodes the nodes to set
|
||||
* @see ProcessDag#nodes
|
||||
*/
|
||||
public void setNodes(List<TaskNode> nodes) {
|
||||
this.nodes = nodes;
|
||||
}
|
||||
/**
|
||||
* setter method
|
||||
*
|
||||
* @param nodes the nodes to set
|
||||
* @see ProcessDag#nodes
|
||||
*/
|
||||
public void setNodes(List<TaskNode> nodes) {
|
||||
this.nodes = nodes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProcessDag{" +
|
||||
"edges=" + edges +
|
||||
", nodes=" + nodes +
|
||||
'}';
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProcessDag{"
|
||||
+ "edges=" + edges
|
||||
+ ", nodes=" + nodes
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dolphinscheduler.common.process;
|
||||
|
||||
package org.apache.dolphinscheduler.common.process;
|
||||
|
||||
import org.apache.dolphinscheduler.common.enums.DataType;
|
||||
import org.apache.dolphinscheduler.common.enums.Direct;
|
||||
@ -24,121 +24,117 @@ import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Property implements Serializable {
|
||||
/**
|
||||
* key
|
||||
*/
|
||||
private String prop;
|
||||
/**
|
||||
* key
|
||||
*/
|
||||
private String prop;
|
||||
|
||||
/**
|
||||
* input/output
|
||||
*/
|
||||
private Direct direct;
|
||||
/**
|
||||
* input/output
|
||||
*/
|
||||
private Direct direct;
|
||||
|
||||
/**
|
||||
* data type
|
||||
*/
|
||||
private DataType type;
|
||||
/**
|
||||
* data type
|
||||
*/
|
||||
private DataType type;
|
||||
|
||||
/**
|
||||
* value
|
||||
*/
|
||||
private String value;
|
||||
/**
|
||||
* value
|
||||
*/
|
||||
private String value;
|
||||
|
||||
public Property() {
|
||||
}
|
||||
|
||||
public Property(String prop,Direct direct,DataType type,String value) {
|
||||
this.prop = prop;
|
||||
this.direct = direct;
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method
|
||||
*
|
||||
* @return the prop
|
||||
* @see Property#prop
|
||||
*/
|
||||
public String getProp() {
|
||||
return prop;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter method
|
||||
*
|
||||
* @param prop the prop to set
|
||||
* @see Property#prop
|
||||
*/
|
||||
public void setProp(String prop) {
|
||||
this.prop = prop;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method
|
||||
*
|
||||
* @return the value
|
||||
* @see Property#value
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter method
|
||||
*
|
||||
* @param value the value to set
|
||||
* @see Property#value
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
public Direct getDirect() {
|
||||
return direct;
|
||||
}
|
||||
|
||||
public void setDirect(Direct direct) {
|
||||
this.direct = direct;
|
||||
}
|
||||
|
||||
public DataType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(DataType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
public Property() {
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
|
||||
public Property(String prop,Direct direct,DataType type,String value) {
|
||||
this.prop = prop;
|
||||
this.direct = direct;
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
}
|
||||
Property property = (Property) o;
|
||||
return Objects.equals(prop, property.prop) &&
|
||||
Objects.equals(value, property.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method
|
||||
*
|
||||
* @return the prop
|
||||
* @see Property#prop
|
||||
*/
|
||||
public String getProp() {
|
||||
return prop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(prop, value);
|
||||
}
|
||||
/**
|
||||
* setter method
|
||||
*
|
||||
* @param prop the prop to set
|
||||
* @see Property#prop
|
||||
*/
|
||||
public void setProp(String prop) {
|
||||
this.prop = prop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Property{" +
|
||||
"prop='" + prop + '\'' +
|
||||
", direct=" + direct +
|
||||
", type=" + type +
|
||||
", value='" + value + '\'' +
|
||||
'}';
|
||||
}
|
||||
/**
|
||||
* getter method
|
||||
*
|
||||
* @return the value
|
||||
* @see Property#value
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter method
|
||||
*
|
||||
* @param value the value to set
|
||||
* @see Property#value
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Direct getDirect() {
|
||||
return direct;
|
||||
}
|
||||
|
||||
public void setDirect(Direct direct) {
|
||||
this.direct = direct;
|
||||
}
|
||||
|
||||
public DataType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(DataType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Property property = (Property) o;
|
||||
return Objects.equals(prop, property.prop)
|
||||
&& Objects.equals(value, property.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(prop, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Property{"
|
||||
+ "prop='" + prop + '\''
|
||||
+ ", direct=" + direct
|
||||
+ ", type=" + type
|
||||
+ ", value='" + value + '\''
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.process;
|
||||
|
||||
/**
|
||||
|
@ -14,8 +14,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.shell;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -27,11 +31,7 @@ import java.util.TimerTask;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* A base class for running a Unix command.
|
||||
*
|
||||
* <code>AbstractShell</code> can be used to run unix commands like <code>du</code> or
|
||||
@ -40,318 +40,316 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
public abstract class AbstractShell {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbstractShell.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbstractShell.class);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Time after which the executing script would be timedout
|
||||
*/
|
||||
protected long timeOutInterval = 0L;
|
||||
/**
|
||||
* If or not script timed out
|
||||
*/
|
||||
private AtomicBoolean timedOut;
|
||||
/**
|
||||
* Time after which the executing script would be timedout
|
||||
*/
|
||||
protected long timeOutInterval = 0L;
|
||||
/**
|
||||
* If or not script timed out
|
||||
*/
|
||||
private AtomicBoolean timedOut;
|
||||
|
||||
/**
|
||||
* refresh interval in msec
|
||||
*/
|
||||
private long interval;
|
||||
/**
|
||||
* refresh interval in msec
|
||||
*/
|
||||
private long interval;
|
||||
|
||||
/**
|
||||
* last time the command was performed
|
||||
*/
|
||||
private long lastTime;
|
||||
/**
|
||||
* last time the command was performed
|
||||
*/
|
||||
private long lastTime;
|
||||
|
||||
/**
|
||||
* env for the command execution
|
||||
*/
|
||||
private Map<String, String> environment;
|
||||
private File dir;
|
||||
/**
|
||||
* env for the command execution
|
||||
*/
|
||||
private Map<String, String> environment;
|
||||
private File dir;
|
||||
|
||||
/**
|
||||
* sub process used to execute the command
|
||||
*/
|
||||
private Process process;
|
||||
private int exitCode;
|
||||
/**
|
||||
* sub process used to execute the command
|
||||
*/
|
||||
private Process process;
|
||||
private int exitCode;
|
||||
|
||||
/**
|
||||
* If or not script finished executing
|
||||
*/
|
||||
private AtomicBoolean completed;
|
||||
/**
|
||||
* If or not script finished executing
|
||||
*/
|
||||
private AtomicBoolean completed;
|
||||
|
||||
public AbstractShell() {
|
||||
this(0L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param interval the minimum duration to wait before re-executing the
|
||||
* command.
|
||||
*/
|
||||
public AbstractShell(long interval ) {
|
||||
this.interval = interval;
|
||||
this.lastTime = (interval<0) ? 0 : -interval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* set the environment for the command
|
||||
* @param env Mapping of environment variables
|
||||
*/
|
||||
protected void setEnvironment(Map<String, String> env) {
|
||||
this.environment = env;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the working directory
|
||||
* @param dir The directory where the command would be executed
|
||||
*/
|
||||
protected void setWorkingDirectory(File dir) {
|
||||
this.dir = dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* check to see if a command needs to be executed and execute if needed
|
||||
* @throws IOException errors
|
||||
*/
|
||||
protected void run() throws IOException {
|
||||
if (lastTime + interval > System.currentTimeMillis()) {
|
||||
return;
|
||||
public AbstractShell() {
|
||||
this(0L);
|
||||
}
|
||||
// reset for next run
|
||||
exitCode = 0;
|
||||
runCommand();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run a command actual work
|
||||
*/
|
||||
private void runCommand() throws IOException {
|
||||
ProcessBuilder builder = new ProcessBuilder(getExecString());
|
||||
Timer timeOutTimer = null;
|
||||
ShellTimeoutTimerTask timeoutTimerTask = null;
|
||||
timedOut = new AtomicBoolean(false);
|
||||
completed = new AtomicBoolean(false);
|
||||
|
||||
if (environment != null) {
|
||||
builder.environment().putAll(this.environment);
|
||||
/**
|
||||
* @param interval the minimum duration to wait before re-executing the
|
||||
* command.
|
||||
*/
|
||||
public AbstractShell(long interval) {
|
||||
this.interval = interval;
|
||||
this.lastTime = (interval < 0) ? 0 : -interval;
|
||||
}
|
||||
if (dir != null) {
|
||||
builder.directory(this.dir);
|
||||
}
|
||||
|
||||
process = builder.start();
|
||||
ProcessContainer.putProcess(process);
|
||||
|
||||
if (timeOutInterval > 0) {
|
||||
timeOutTimer = new Timer();
|
||||
timeoutTimerTask = new ShellTimeoutTimerTask(
|
||||
this);
|
||||
//One time scheduling.
|
||||
timeOutTimer.schedule(timeoutTimerTask, timeOutInterval);
|
||||
/**
|
||||
* set the environment for the command
|
||||
* @param env Mapping of environment variables
|
||||
*/
|
||||
protected void setEnvironment(Map<String, String> env) {
|
||||
this.environment = env;
|
||||
}
|
||||
final BufferedReader errReader =
|
||||
new BufferedReader(
|
||||
new InputStreamReader(process.getErrorStream()));
|
||||
BufferedReader inReader =
|
||||
new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()));
|
||||
final StringBuilder errMsg = new StringBuilder();
|
||||
|
||||
// read error and input streams as this would free up the buffers
|
||||
// free the error stream buffer
|
||||
Thread errThread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
/**
|
||||
* set the working directory
|
||||
* @param dir The directory where the command would be executed
|
||||
*/
|
||||
protected void setWorkingDirectory(File dir) {
|
||||
this.dir = dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* check to see if a command needs to be executed and execute if needed
|
||||
* @throws IOException errors
|
||||
*/
|
||||
protected void run() throws IOException {
|
||||
if (lastTime + interval > System.currentTimeMillis()) {
|
||||
return;
|
||||
}
|
||||
// reset for next run
|
||||
exitCode = 0;
|
||||
runCommand();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a command actual work
|
||||
*/
|
||||
private void runCommand() throws IOException {
|
||||
ProcessBuilder builder = new ProcessBuilder(getExecString());
|
||||
Timer timeOutTimer = null;
|
||||
ShellTimeoutTimerTask timeoutTimerTask = null;
|
||||
timedOut = new AtomicBoolean(false);
|
||||
completed = new AtomicBoolean(false);
|
||||
|
||||
if (environment != null) {
|
||||
builder.environment().putAll(this.environment);
|
||||
}
|
||||
if (dir != null) {
|
||||
builder.directory(this.dir);
|
||||
}
|
||||
|
||||
process = builder.start();
|
||||
ProcessContainer.putProcess(process);
|
||||
|
||||
if (timeOutInterval > 0) {
|
||||
timeOutTimer = new Timer();
|
||||
timeoutTimerTask = new ShellTimeoutTimerTask(this);
|
||||
//One time scheduling.
|
||||
timeOutTimer.schedule(timeoutTimerTask, timeOutInterval);
|
||||
}
|
||||
final BufferedReader errReader =
|
||||
new BufferedReader(
|
||||
new InputStreamReader(process.getErrorStream()));
|
||||
BufferedReader inReader =
|
||||
new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()));
|
||||
final StringBuilder errMsg = new StringBuilder();
|
||||
|
||||
// read error and input streams as this would free up the buffers
|
||||
// free the error stream buffer
|
||||
Thread errThread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String line = errReader.readLine();
|
||||
while ((line != null) && !isInterrupted()) {
|
||||
errMsg.append(line);
|
||||
errMsg.append(System.getProperty("line.separator"));
|
||||
line = errReader.readLine();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
logger.warn("Error reading the error stream", ioe);
|
||||
}
|
||||
}
|
||||
};
|
||||
Thread inThread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
parseExecResult(inReader);
|
||||
} catch (IOException ioe) {
|
||||
logger.warn("Error reading the in stream", ioe);
|
||||
}
|
||||
super.run();
|
||||
}
|
||||
};
|
||||
try {
|
||||
String line = errReader.readLine();
|
||||
while((line != null) && !isInterrupted()) {
|
||||
errMsg.append(line);
|
||||
errMsg.append(System.getProperty("line.separator"));
|
||||
line = errReader.readLine();
|
||||
}
|
||||
} catch(IOException ioe) {
|
||||
logger.warn("Error reading the error stream", ioe);
|
||||
errThread.start();
|
||||
inThread.start();
|
||||
} catch (IllegalStateException ise) {
|
||||
logger.warn("Illegal while starting the error and in thread", ise);
|
||||
}
|
||||
}
|
||||
};
|
||||
Thread inThread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
parseExecResult(inReader);
|
||||
} catch (IOException ioe) {
|
||||
logger.warn("Error reading the in stream", ioe);
|
||||
// parse the output
|
||||
exitCode = process.waitFor();
|
||||
try {
|
||||
// make sure that the error and in thread exits
|
||||
errThread.join();
|
||||
inThread.join();
|
||||
} catch (InterruptedException ie) {
|
||||
logger.warn("Interrupted while reading the error and in stream", ie);
|
||||
}
|
||||
completed.compareAndSet(false,true);
|
||||
//the timeout thread handling
|
||||
//taken care in finally block
|
||||
if (exitCode != 0 || errMsg.length() > 0) {
|
||||
throw new ExitCodeException(exitCode, errMsg.toString());
|
||||
}
|
||||
} catch (InterruptedException ie) {
|
||||
throw new IOException(ie.toString());
|
||||
} finally {
|
||||
if ((timeOutTimer != null) && !timedOut.get()) {
|
||||
timeOutTimer.cancel();
|
||||
}
|
||||
// close the input stream
|
||||
try {
|
||||
inReader.close();
|
||||
} catch (IOException ioe) {
|
||||
logger.warn("Error while closing the input stream", ioe);
|
||||
}
|
||||
if (!completed.get()) {
|
||||
errThread.interrupt();
|
||||
}
|
||||
try {
|
||||
errReader.close();
|
||||
} catch (IOException ioe) {
|
||||
logger.warn("Error while closing the error stream", ioe);
|
||||
}
|
||||
ProcessContainer.removeProcess(process);
|
||||
process.destroy();
|
||||
lastTime = System.currentTimeMillis();
|
||||
}
|
||||
super.run();
|
||||
}
|
||||
};
|
||||
try {
|
||||
errThread.start();
|
||||
inThread.start();
|
||||
} catch (IllegalStateException ise) { }
|
||||
try {
|
||||
// parse the output
|
||||
exitCode = process.waitFor();
|
||||
try {
|
||||
// make sure that the error and in thread exits
|
||||
errThread.join();
|
||||
inThread.join();
|
||||
} catch (InterruptedException ie) {
|
||||
logger.warn("Interrupted while reading the error and in stream", ie);
|
||||
}
|
||||
completed.compareAndSet(false,true);
|
||||
//the timeout thread handling
|
||||
//taken care in finally block
|
||||
if (exitCode != 0 || errMsg.length() > 0) {
|
||||
throw new ExitCodeException(exitCode, errMsg.toString());
|
||||
}
|
||||
} catch (InterruptedException ie) {
|
||||
throw new IOException(ie.toString());
|
||||
} finally {
|
||||
if ((timeOutTimer!=null) && !timedOut.get()) {
|
||||
timeOutTimer.cancel();
|
||||
}
|
||||
// close the input stream
|
||||
try {
|
||||
inReader.close();
|
||||
} catch (IOException ioe) {
|
||||
logger.warn("Error while closing the input stream", ioe);
|
||||
}
|
||||
if (!completed.get()) {
|
||||
errThread.interrupt();
|
||||
}
|
||||
try {
|
||||
errReader.close();
|
||||
} catch (IOException ioe) {
|
||||
logger.warn("Error while closing the error stream", ioe);
|
||||
}
|
||||
ProcessContainer.removeProcess(process);
|
||||
process.destroy();
|
||||
lastTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return an array containing the command name and its parameters
|
||||
*/
|
||||
protected abstract String[] getExecString();
|
||||
/**
|
||||
*
|
||||
* @return an array containing the command name and its parameters
|
||||
*/
|
||||
protected abstract String[] getExecString();
|
||||
|
||||
/**
|
||||
* Parse the execution result
|
||||
* @param lines lines
|
||||
* @throws IOException errors
|
||||
*/
|
||||
protected abstract void parseExecResult(BufferedReader lines)
|
||||
throws IOException;
|
||||
/**
|
||||
* Parse the execution result
|
||||
* @param lines lines
|
||||
* @throws IOException errors
|
||||
*/
|
||||
protected abstract void parseExecResult(BufferedReader lines) throws IOException;
|
||||
|
||||
/**
|
||||
* get the current sub-process executing the given command
|
||||
* @return process executing the command
|
||||
*/
|
||||
public Process getProcess() {
|
||||
return process;
|
||||
}
|
||||
|
||||
/** get the exit code
|
||||
* @return the exit code of the process
|
||||
*/
|
||||
public int getExitCode() {
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the command has timed out.
|
||||
*
|
||||
*/
|
||||
private void setTimedOut() {
|
||||
this.timedOut.set(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Timer which is used to timeout scripts spawned off by shell.
|
||||
*/
|
||||
private static class ShellTimeoutTimerTask extends TimerTask {
|
||||
|
||||
private AbstractShell shell;
|
||||
|
||||
public ShellTimeoutTimerTask(AbstractShell shell) {
|
||||
this.shell = shell;
|
||||
/**
|
||||
* get the current sub-process executing the given command
|
||||
* @return process executing the command
|
||||
*/
|
||||
public Process getProcess() {
|
||||
return process;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Process p = shell.getProcess();
|
||||
try {
|
||||
p.exitValue();
|
||||
} catch (Exception e) {
|
||||
//Process has not terminated.
|
||||
//So check if it has completed
|
||||
//if not just destroy it.
|
||||
if (p != null && !shell.completed.get()) {
|
||||
shell.setTimedOut();
|
||||
p.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an IOException with exit code added.
|
||||
*/
|
||||
public static class ExitCodeException extends IOException {
|
||||
int exitCode;
|
||||
|
||||
public ExitCodeException(int exitCode, String message) {
|
||||
super(message);
|
||||
this.exitCode = exitCode;
|
||||
}
|
||||
|
||||
/** get the exit code
|
||||
* @return the exit code of the process
|
||||
*/
|
||||
public int getExitCode() {
|
||||
return exitCode;
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the command has timed out.
|
||||
*
|
||||
*/
|
||||
private void setTimedOut() {
|
||||
this.timedOut.set(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Timer which is used to timeout scripts spawned off by shell.
|
||||
*/
|
||||
private static class ShellTimeoutTimerTask extends TimerTask {
|
||||
|
||||
private AbstractShell shell;
|
||||
|
||||
public ShellTimeoutTimerTask(AbstractShell shell) {
|
||||
this.shell = shell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Process p = shell.getProcess();
|
||||
try {
|
||||
p.exitValue();
|
||||
} catch (Exception e) {
|
||||
//Process has not terminated.
|
||||
//So check if it has completed
|
||||
//if not just destroy it.
|
||||
if (p != null && !shell.completed.get()) {
|
||||
shell.setTimedOut();
|
||||
p.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an IOException with exit code added.
|
||||
*/
|
||||
public static class ExitCodeException extends IOException {
|
||||
int exitCode;
|
||||
|
||||
public ExitCodeException(int exitCode, String message) {
|
||||
super(message);
|
||||
this.exitCode = exitCode;
|
||||
}
|
||||
|
||||
public int getExitCode() {
|
||||
return exitCode;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* process manage container
|
||||
*
|
||||
*/
|
||||
public static class ProcessContainer extends ConcurrentHashMap<Integer, Process> {
|
||||
private static final ProcessContainer container = new ProcessContainer();
|
||||
|
||||
private ProcessContainer() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static final ProcessContainer getInstance() {
|
||||
return container;
|
||||
}
|
||||
|
||||
public static void putProcess(Process process) {
|
||||
getInstance().put(process.hashCode(), process);
|
||||
}
|
||||
|
||||
public static int processSize() {
|
||||
return getInstance().size();
|
||||
}
|
||||
|
||||
public static void removeProcess(Process process) {
|
||||
getInstance().remove(process.hashCode());
|
||||
}
|
||||
|
||||
public static void destroyAllProcess() {
|
||||
Set<Entry<Integer, Process>> set = getInstance().entrySet();
|
||||
for (Entry<Integer, Process> entry : set) {
|
||||
try {
|
||||
entry.getValue().destroy();
|
||||
} catch (Exception e) {
|
||||
logger.error("Destroy All Processes error", e);
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("close " + set.size() + " executing process tasks");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* process manage container
|
||||
*
|
||||
*/
|
||||
public static class ProcessContainer extends ConcurrentHashMap<Integer, Process>{
|
||||
private static final ProcessContainer container = new ProcessContainer();
|
||||
private ProcessContainer(){
|
||||
super();
|
||||
}
|
||||
public static final ProcessContainer getInstance(){
|
||||
return container;
|
||||
}
|
||||
|
||||
public static void putProcess(Process process){
|
||||
getInstance().put(process.hashCode(), process);
|
||||
}
|
||||
public static int processSize(){
|
||||
return getInstance().size();
|
||||
}
|
||||
|
||||
public static void removeProcess(Process process){
|
||||
getInstance().remove(process.hashCode());
|
||||
}
|
||||
|
||||
public static void destroyAllProcess(){
|
||||
Set<Entry<Integer, Process>> set = getInstance().entrySet();
|
||||
for (Entry<Integer, Process> entry : set) {
|
||||
try{
|
||||
entry.getValue().destroy();
|
||||
} catch (Exception e) {
|
||||
logger.error("Destroy All Processes error", e);
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("close " + set.size() + " executing process tasks");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.shell;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@ -34,7 +35,6 @@ public class ShellExecutor extends AbstractShell {
|
||||
private String[] command;
|
||||
private StringBuffer output;
|
||||
|
||||
|
||||
public ShellExecutor(String... execString) {
|
||||
this(execString, null);
|
||||
}
|
||||
@ -45,7 +45,7 @@ public class ShellExecutor extends AbstractShell {
|
||||
|
||||
public ShellExecutor(String[] execString, File dir,
|
||||
Map<String, String> env) {
|
||||
this(execString, dir, env , 0L);
|
||||
this(execString, dir, env,0L);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,7 +74,6 @@ public class ShellExecutor extends AbstractShell {
|
||||
timeOutInterval = timeout;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Static method to execute a shell command.
|
||||
* Covers most of the simple cases without requiring the user to implement
|
||||
@ -114,7 +113,7 @@ public class ShellExecutor extends AbstractShell {
|
||||
* @return the output of the executed command.
|
||||
* @throws IOException errors
|
||||
*/
|
||||
public static String execCommand(Map<String,String> env, String ... cmd)
|
||||
public static String execCommand(Map<String,String> env, String... cmd)
|
||||
throws IOException {
|
||||
return execCommand(env, cmd, 0L);
|
||||
}
|
||||
@ -138,7 +137,7 @@ public class ShellExecutor extends AbstractShell {
|
||||
char[] buf = new char[1024];
|
||||
int nRead;
|
||||
String line = "";
|
||||
while ( (nRead = lines.read(buf, 0, buf.length)) > 0 ) {
|
||||
while ((nRead = lines.read(buf, 0, buf.length)) > 0) {
|
||||
line = new String(buf,0,nRead);
|
||||
output.append(line);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task;
|
||||
|
||||
import org.apache.dolphinscheduler.common.enums.Direct;
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task;
|
||||
|
||||
import org.apache.dolphinscheduler.common.process.ResourceInfo;
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task;
|
||||
|
||||
import org.apache.dolphinscheduler.common.enums.TaskTimeoutStrategy;
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task.dependent;
|
||||
|
||||
import org.apache.dolphinscheduler.common.enums.DependentRelation;
|
||||
@ -29,8 +30,6 @@ public class DependentParameters extends AbstractParameters {
|
||||
private List<DependentTaskModel> dependTaskList;
|
||||
private DependentRelation relation;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkParameters() {
|
||||
return true;
|
||||
|
@ -62,13 +62,13 @@ public class HttpParameters extends AbstractParameters {
|
||||
* Connect Timeout
|
||||
* Unit: ms
|
||||
*/
|
||||
private int connectTimeout ;
|
||||
private int connectTimeout;
|
||||
|
||||
/**
|
||||
* Socket Timeout
|
||||
* Unit: ms
|
||||
*/
|
||||
private int socketTimeout ;
|
||||
private int socketTimeout;
|
||||
|
||||
@Override
|
||||
public boolean checkParameters() {
|
||||
|
@ -70,7 +70,6 @@ public class MapReduceParameters extends AbstractParameters {
|
||||
*/
|
||||
private ProgramType programType;
|
||||
|
||||
|
||||
public String getMainClass() {
|
||||
return mainClass;
|
||||
}
|
||||
|
@ -14,8 +14,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dolphinscheduler.common.task.python;
|
||||
|
||||
package org.apache.dolphinscheduler.common.task.python;
|
||||
|
||||
import org.apache.dolphinscheduler.common.process.ResourceInfo;
|
||||
import org.apache.dolphinscheduler.common.task.AbstractParameters;
|
||||
@ -23,39 +23,39 @@ import org.apache.dolphinscheduler.common.task.AbstractParameters;
|
||||
import java.util.List;
|
||||
|
||||
public class PythonParameters extends AbstractParameters {
|
||||
/**
|
||||
* origin python script
|
||||
*/
|
||||
private String rawScript;
|
||||
/**
|
||||
* origin python script
|
||||
*/
|
||||
private String rawScript;
|
||||
|
||||
/**
|
||||
* resource list
|
||||
*/
|
||||
private List<ResourceInfo> resourceList;
|
||||
/**
|
||||
* resource list
|
||||
*/
|
||||
private List<ResourceInfo> resourceList;
|
||||
|
||||
public String getRawScript() {
|
||||
return rawScript;
|
||||
}
|
||||
public String getRawScript() {
|
||||
return rawScript;
|
||||
}
|
||||
|
||||
public void setRawScript(String rawScript) {
|
||||
this.rawScript = rawScript;
|
||||
}
|
||||
public void setRawScript(String rawScript) {
|
||||
this.rawScript = rawScript;
|
||||
}
|
||||
|
||||
public List<ResourceInfo> getResourceList() {
|
||||
return resourceList;
|
||||
}
|
||||
public List<ResourceInfo> getResourceList() {
|
||||
return resourceList;
|
||||
}
|
||||
|
||||
public void setResourceList(List<ResourceInfo> resourceList) {
|
||||
this.resourceList = resourceList;
|
||||
}
|
||||
public void setResourceList(List<ResourceInfo> resourceList) {
|
||||
this.resourceList = resourceList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkParameters() {
|
||||
return rawScript != null && !rawScript.isEmpty();
|
||||
}
|
||||
@Override
|
||||
public boolean checkParameters() {
|
||||
return rawScript != null && !rawScript.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResourceInfo> getResourceFilesList() {
|
||||
return this.resourceList;
|
||||
}
|
||||
@Override
|
||||
public List<ResourceInfo> getResourceFilesList() {
|
||||
return this.resourceList;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task.sql;
|
||||
|
||||
import org.apache.dolphinscheduler.common.process.Property;
|
||||
|
@ -14,8 +14,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dolphinscheduler.common.task.sql;
|
||||
|
||||
package org.apache.dolphinscheduler.common.task.sql;
|
||||
|
||||
public enum SqlType {
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task.sqoop;
|
||||
|
||||
import org.apache.dolphinscheduler.common.enums.SqoopJobType;
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task.sqoop.sources;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task.sqoop.sources;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task.sqoop.sources;
|
||||
|
||||
import org.apache.dolphinscheduler.common.process.Property;
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task.sqoop.targets;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task.sqoop.targets;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task.sqoop.targets;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.task.subprocess;
|
||||
|
||||
import org.apache.dolphinscheduler.common.process.ResourceInfo;
|
||||
@ -22,7 +23,6 @@ import org.apache.dolphinscheduler.common.task.AbstractParameters;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class SubProcessParameters extends AbstractParameters {
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.thread;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@ -23,17 +24,17 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
*/
|
||||
public class Stopper {
|
||||
|
||||
private static AtomicBoolean signal = new AtomicBoolean(false);
|
||||
|
||||
public static final boolean isStopped(){
|
||||
return signal.get();
|
||||
}
|
||||
|
||||
public static final boolean isRunning(){
|
||||
return !signal.get();
|
||||
}
|
||||
|
||||
public static final void stop(){
|
||||
signal.set(true);
|
||||
}
|
||||
private static AtomicBoolean signal = new AtomicBoolean(false);
|
||||
|
||||
public static final boolean isStopped() {
|
||||
return signal.get();
|
||||
}
|
||||
|
||||
public static final boolean isRunning() {
|
||||
return !signal.get();
|
||||
}
|
||||
|
||||
public static final void stop() {
|
||||
signal.set(true);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.thread;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@ -32,7 +33,7 @@ public class ThreadUtils {
|
||||
* @param threadsNum threadsNum
|
||||
* @return ExecutorService
|
||||
*/
|
||||
public static ExecutorService newDaemonFixedThreadExecutor(String threadName,int threadsNum){
|
||||
public static ExecutorService newDaemonFixedThreadExecutor(String threadName,int threadsNum) {
|
||||
ThreadFactory threadFactory = new ThreadFactoryBuilder()
|
||||
.setDaemon(true)
|
||||
.setNameFormat(threadName)
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.utils;
|
||||
|
||||
import org.apache.dolphinscheduler.common.enums.DependResult;
|
||||
@ -60,7 +61,6 @@ public class DependentUtils {
|
||||
return dependResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get date interval list by business date and date value.
|
||||
*
|
||||
|
@ -22,8 +22,8 @@ import static org.apache.dolphinscheduler.common.Constants.RESOURCE_UPLOAD_PATH;
|
||||
import org.apache.dolphinscheduler.common.Constants;
|
||||
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
|
||||
import org.apache.dolphinscheduler.common.enums.ResUploadType;
|
||||
import org.apache.dolphinscheduler.spi.enums.ResourceType;
|
||||
import org.apache.dolphinscheduler.common.exception.BaseException;
|
||||
import org.apache.dolphinscheduler.spi.enums.ResourceType;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
@ -35,7 +35,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.utils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -14,6 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.utils;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user