forked from apache/inlong
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into INLONG-11400
- Loading branch information
Showing
18 changed files
with
2,115 additions
and
7 deletions.
There are no files selected for viewing
120 changes: 120 additions & 0 deletions
120
...c/main/java/org/apache/inlong/manager/pojo/schedule/dolphinschedule/DSTaskDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* | ||
* 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.inlong.manager.pojo.schedule.dolphinschedule; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class DSTaskDefinition { | ||
|
||
@ApiModelProperty("DolphinScheduler task definition code") | ||
@JsonProperty("code") | ||
private long code; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition code") | ||
@JsonProperty("delayTime") | ||
private String delayTime; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition description") | ||
@JsonProperty("description") | ||
private String description; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition environment code") | ||
@JsonProperty("environmentCode") | ||
private int environmentCode; | ||
|
||
@ApiModelProperty("DolphinScheduler task fail retry interval") | ||
@JsonProperty("failRetryInterval") | ||
private String failRetryInterval; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition fail retry times") | ||
@JsonProperty("failRetryTimes") | ||
private String failRetryTimes; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition flag") | ||
@JsonProperty("flag") | ||
private String flag; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition isCache") | ||
@JsonProperty("isCache") | ||
private String isCache; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition name") | ||
@JsonProperty("name") | ||
private String name; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition params") | ||
@JsonProperty("taskParams") | ||
private DSTaskParams taskParams; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition priority") | ||
@JsonProperty("taskPriority") | ||
private String taskPriority; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition type") | ||
@JsonProperty("taskType") | ||
private String taskType; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition timeout") | ||
@JsonProperty("timeout") | ||
private int timeout; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition timeout flag") | ||
@JsonProperty("timeoutFlag") | ||
private String timeoutFlag; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition timeout notify strategy") | ||
@JsonProperty("timeoutNotifyStrategy") | ||
private String timeoutNotifyStrategy; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition worker group") | ||
@JsonProperty("workerGroup") | ||
private String workerGroup; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition apu quota") | ||
@JsonProperty("cpuQuota") | ||
private int cpuQuota; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition memory max") | ||
@JsonProperty("memoryMax") | ||
private int memoryMax; | ||
|
||
@ApiModelProperty("DolphinScheduler task definition execute type") | ||
@JsonProperty("taskExecuteType") | ||
private String taskExecuteType; | ||
|
||
public DSTaskDefinition() { | ||
this.delayTime = "0"; | ||
this.description = ""; | ||
this.environmentCode = -1; | ||
this.failRetryInterval = "1"; | ||
this.failRetryTimes = "0"; | ||
this.flag = "YES"; | ||
this.isCache = "NO"; | ||
this.taskPriority = "MEDIUM"; | ||
this.taskType = "SHELL"; | ||
this.timeoutFlag = "CLOSE"; | ||
this.timeoutNotifyStrategy = ""; | ||
this.workerGroup = "default"; | ||
this.cpuQuota = -1; | ||
this.memoryMax = -1; | ||
this.taskExecuteType = "BATCH"; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...o/src/main/java/org/apache/inlong/manager/pojo/schedule/dolphinschedule/DSTaskParams.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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.inlong.manager.pojo.schedule.dolphinschedule; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
@Data | ||
public class DSTaskParams { | ||
|
||
@ApiModelProperty("DolphinScheduler task params local params") | ||
@JsonProperty("localParams") | ||
private List<Object> localParams; | ||
|
||
@ApiModelProperty("DolphinScheduler task params raw script") | ||
@JsonProperty("rawScript") | ||
private String rawScript; | ||
|
||
@ApiModelProperty("DolphinScheduler task params resource list") | ||
@JsonProperty("resourceList") | ||
private List<Object> resourceList; | ||
|
||
public DSTaskParams() { | ||
this.localParams = new ArrayList<>(); | ||
this.resourceList = new ArrayList<>(); | ||
this.rawScript = ""; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...src/main/java/org/apache/inlong/manager/pojo/schedule/dolphinschedule/DSTaskRelation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* 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.inlong.manager.pojo.schedule.dolphinschedule; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class DSTaskRelation { | ||
|
||
@ApiModelProperty("DolphinScheduler task relation name") | ||
@JsonProperty("name") | ||
private String name; | ||
|
||
@ApiModelProperty("DolphinScheduler task relation pre-task code") | ||
@JsonProperty("preTaskCode") | ||
private int preTaskCode; | ||
|
||
@ApiModelProperty("DolphinScheduler task relation pre-task version") | ||
@JsonProperty("preTaskVersion") | ||
private int preTaskVersion; | ||
|
||
@ApiModelProperty("DolphinScheduler task relation post-task code") | ||
@JsonProperty("postTaskCode") | ||
private long postTaskCode; | ||
|
||
@ApiModelProperty("DolphinScheduler task relation post-task version") | ||
@JsonProperty("postTaskVersion") | ||
private int postTaskVersion; | ||
|
||
@ApiModelProperty("DolphinScheduler task relation condition type") | ||
@JsonProperty("conditionType") | ||
private String conditionType; | ||
|
||
@ApiModelProperty("DolphinScheduler task relation condition params") | ||
@JsonProperty("conditionParams") | ||
private Object conditionParams; | ||
|
||
public DSTaskRelation() { | ||
this.name = ""; | ||
this.conditionType = "NONE"; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
.../src/main/java/org/apache/inlong/manager/pojo/schedule/dolphinschedule/DScheduleInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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.inlong.manager.pojo.schedule.dolphinschedule; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class DScheduleInfo { | ||
|
||
@ApiModelProperty("DolphinScheduler schedule start time") | ||
@JsonProperty("startTime") | ||
private String startTime; | ||
|
||
@ApiModelProperty("DolphinScheduler schedule end time") | ||
@JsonProperty("endTime") | ||
private String endTime; | ||
|
||
@ApiModelProperty("DolphinScheduler schedule crontab expression") | ||
@JsonProperty("crontab") | ||
private String crontab; | ||
|
||
@ApiModelProperty("DolphinScheduler schedule timezone id") | ||
@JsonProperty("timezoneId") | ||
private String timezoneId; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
.../main/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* 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.inlong.manager.schedule.dolphinscheduler; | ||
|
||
import org.apache.inlong.manager.pojo.schedule.ScheduleInfo; | ||
import org.apache.inlong.manager.schedule.ScheduleEngineClient; | ||
import org.apache.inlong.manager.schedule.ScheduleEngineType; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import javax.annotation.Resource; | ||
|
||
/** | ||
* Built-in implementation of third-party schedule engine client corresponding with {@link DolphinScheduleEngine}. | ||
* DolphinScheduleClient simply invokes the {@link DolphinScheduleEngine} to register/unregister/update | ||
* schedule info, all the logic for invoking the remote scheduling service is implemented in {@link DolphinScheduleEngine} | ||
*/ | ||
@Service | ||
public class DolphinScheduleClient implements ScheduleEngineClient { | ||
|
||
@Resource | ||
public DolphinScheduleEngine scheduleEngine; | ||
|
||
@Override | ||
public boolean accept(String engineType) { | ||
return ScheduleEngineType.DOLPHINSCHEDULER.getType().equalsIgnoreCase(engineType); | ||
} | ||
|
||
@Override | ||
public boolean register(ScheduleInfo scheduleInfo) { | ||
return scheduleEngine.handleRegister(scheduleInfo); | ||
} | ||
|
||
@Override | ||
public boolean unregister(String groupId) { | ||
return scheduleEngine.handleUnregister(groupId); | ||
} | ||
|
||
@Override | ||
public boolean update(ScheduleInfo scheduleInfo) { | ||
return scheduleEngine.handleUpdate(scheduleInfo); | ||
} | ||
} |
Oops, something went wrong.