Wenjun Ruan
6 days ago
committed by
GitHub
293 changed files with 6140 additions and 7804 deletions
@ -0,0 +1,45 @@ |
|||||||
|
/* |
||||||
|
* 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.extract.master; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.extract.base.RpcMethod; |
||||||
|
import org.apache.dolphinscheduler.extract.base.RpcService; |
||||||
|
import org.apache.dolphinscheduler.task.executor.eventbus.ITaskExecutorLifecycleEventReporter; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorDispatchRequest; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorDispatchResponse; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorKillRequest; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorKillResponse; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorPauseRequest; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorPauseResponse; |
||||||
|
|
||||||
|
@RpcService |
||||||
|
public interface ILogicTaskExecutorOperator { |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
TaskExecutorDispatchResponse dispatchTask(final TaskExecutorDispatchRequest taskExecutorDispatchRequest); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
TaskExecutorKillResponse killTask(final TaskExecutorKillRequest taskExecutorKillRequest); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
TaskExecutorPauseResponse pauseTask(final TaskExecutorPauseRequest taskExecutorPauseRequest); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
void ackTaskExecutorLifecycleEvent(final ITaskExecutorLifecycleEventReporter.TaskExecutorLifecycleEventAck taskExecutorLifecycleEventAck); |
||||||
|
|
||||||
|
} |
@ -1,41 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.master; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.extract.base.RpcMethod; |
|
||||||
import org.apache.dolphinscheduler.extract.base.RpcService; |
|
||||||
import org.apache.dolphinscheduler.extract.master.transportor.LogicTaskDispatchRequest; |
|
||||||
import org.apache.dolphinscheduler.extract.master.transportor.LogicTaskDispatchResponse; |
|
||||||
import org.apache.dolphinscheduler.extract.master.transportor.LogicTaskKillRequest; |
|
||||||
import org.apache.dolphinscheduler.extract.master.transportor.LogicTaskKillResponse; |
|
||||||
import org.apache.dolphinscheduler.extract.master.transportor.LogicTaskPauseRequest; |
|
||||||
import org.apache.dolphinscheduler.extract.master.transportor.LogicTaskPauseResponse; |
|
||||||
|
|
||||||
@RpcService |
|
||||||
public interface ILogicTaskInstanceOperator { |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
LogicTaskDispatchResponse dispatchLogicTask(LogicTaskDispatchRequest taskDispatchRequest); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
LogicTaskKillResponse killLogicTask(LogicTaskKillRequest taskKillRequest); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
LogicTaskPauseResponse pauseLogicTask(LogicTaskPauseRequest taskPauseRequest); |
|
||||||
|
|
||||||
} |
|
@ -1,50 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.master; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.extract.base.RpcMethod; |
|
||||||
import org.apache.dolphinscheduler.extract.base.RpcService; |
|
||||||
import org.apache.dolphinscheduler.extract.master.transportor.TaskExecutionDispatchEvent; |
|
||||||
import org.apache.dolphinscheduler.extract.master.transportor.TaskExecutionFailedEvent; |
|
||||||
import org.apache.dolphinscheduler.extract.master.transportor.TaskExecutionKilledEvent; |
|
||||||
import org.apache.dolphinscheduler.extract.master.transportor.TaskExecutionPausedEvent; |
|
||||||
import org.apache.dolphinscheduler.extract.master.transportor.TaskExecutionRunningEvent; |
|
||||||
import org.apache.dolphinscheduler.extract.master.transportor.TaskExecutionSuccessEvent; |
|
||||||
|
|
||||||
@RpcService |
|
||||||
public interface ITaskExecutionEventListener { |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
void onTaskInstanceDispatched(final TaskExecutionDispatchEvent taskExecutionDispatchEvent); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
void onTaskInstanceExecutionRunning(final TaskExecutionRunningEvent taskInstanceExecutionRunningEvent); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
void onTaskInstanceExecutionSuccess(final TaskExecutionSuccessEvent taskInstanceExecutionSuccessEvent); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
void onTaskInstanceExecutionFailed(final TaskExecutionFailedEvent taskInstanceExecutionFailedEvent); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
void onTaskInstanceExecutionKilled(final TaskExecutionKilledEvent taskInstanceExecutionKilledEvent); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
void onTaskInstanceExecutionPaused(final TaskExecutionPausedEvent taskInstanceExecutionPausedEvent); |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,54 @@ |
|||||||
|
/* |
||||||
|
* 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.extract.master; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.extract.base.RpcMethod; |
||||||
|
import org.apache.dolphinscheduler.extract.base.RpcService; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorDispatchedLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorFailedLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorKilledLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorPausedLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorRuntimeContextChangedLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorStartedLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorSuccessLifecycleEvent; |
||||||
|
|
||||||
|
@RpcService |
||||||
|
public interface ITaskExecutorEventListener { |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
void onTaskExecutorDispatched(final TaskExecutorDispatchedLifecycleEvent taskExecutorDispatchedLifecycleEvent); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
void onTaskExecutorRunning(final TaskExecutorStartedLifecycleEvent taskExecutorStartedLifecycleEvent); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
void onTaskExecutorRuntimeContextChanged(final TaskExecutorRuntimeContextChangedLifecycleEvent taskExecutorRuntimeContextChangedLifecycleEventr); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
void onTaskExecutorSuccess(final TaskExecutorSuccessLifecycleEvent taskExecutorSuccessLifecycleEvent); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
void onTaskExecutorFailed(final TaskExecutorFailedLifecycleEvent taskExecutorFailedLifecycleEvent); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
void onTaskExecutorKilled(final TaskExecutorKilledLifecycleEvent taskExecutorKilledLifecycleEvent); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
void onTaskExecutorPaused(final TaskExecutorPausedLifecycleEvent taskExecutorPausedLifecycleEvent); |
||||||
|
|
||||||
|
} |
@ -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.dolphinscheduler.extract.master; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.extract.base.client.Clients; |
||||||
|
import org.apache.dolphinscheduler.task.executor.eventbus.ITaskExecutorEventRemoteReporterClient; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.IReportableTaskExecutorLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorDispatchedLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorFailedLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorKilledLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorPausedLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorRuntimeContextChangedLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorStartedLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.task.executor.events.TaskExecutorSuccessLifecycleEvent; |
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
public class TaskExecutorEventRemoteReporterClient implements ITaskExecutorEventRemoteReporterClient { |
||||||
|
|
||||||
|
public void reportTaskExecutionEventToMaster(final IReportableTaskExecutorLifecycleEvent taskExecutorLifecycleEvent) { |
||||||
|
try { |
||||||
|
taskExecutorLifecycleEvent.setLatestReportTime(System.currentTimeMillis()); |
||||||
|
switch (taskExecutorLifecycleEvent.getType()) { |
||||||
|
case DISPATCHED: |
||||||
|
reportTaskDispatchedEventToMaster( |
||||||
|
(TaskExecutorDispatchedLifecycleEvent) taskExecutorLifecycleEvent); |
||||||
|
break; |
||||||
|
case RUNNING: |
||||||
|
reportTaskRunningEventToMaster((TaskExecutorStartedLifecycleEvent) taskExecutorLifecycleEvent); |
||||||
|
break; |
||||||
|
case RUNTIME_CONTEXT_CHANGE: |
||||||
|
reportTaskRuntimeContextChangeEventToMaster( |
||||||
|
(TaskExecutorRuntimeContextChangedLifecycleEvent) taskExecutorLifecycleEvent); |
||||||
|
break; |
||||||
|
case PAUSED: |
||||||
|
reportTaskPausedEventToMaster((TaskExecutorPausedLifecycleEvent) taskExecutorLifecycleEvent); |
||||||
|
break; |
||||||
|
case KILLED: |
||||||
|
reportTaskKilledEventToMaster((TaskExecutorKilledLifecycleEvent) taskExecutorLifecycleEvent); |
||||||
|
break; |
||||||
|
case FAILED: |
||||||
|
reportTaskFailedEventToMaster((TaskExecutorFailedLifecycleEvent) taskExecutorLifecycleEvent); |
||||||
|
break; |
||||||
|
case SUCCESS: |
||||||
|
reportTaskSuccessEventToMaster((TaskExecutorSuccessLifecycleEvent) taskExecutorLifecycleEvent); |
||||||
|
break; |
||||||
|
default: |
||||||
|
log.warn("Unsupported TaskExecutionEvent: {}", taskExecutorLifecycleEvent); |
||||||
|
} |
||||||
|
log.info("Report: {} to master success", taskExecutorLifecycleEvent); |
||||||
|
} catch (Throwable throwable) { |
||||||
|
log.error("Report ITaskExecutorLifecycleEvent: {} to master failed", taskExecutorLifecycleEvent, throwable); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static void reportTaskDispatchedEventToMaster(final TaskExecutorDispatchedLifecycleEvent taskExecutionDispatchedEvent) { |
||||||
|
Clients |
||||||
|
.withService(ITaskExecutorEventListener.class) |
||||||
|
.withHost(taskExecutionDispatchedEvent.getWorkflowInstanceHost()) |
||||||
|
.onTaskExecutorDispatched(taskExecutionDispatchedEvent); |
||||||
|
} |
||||||
|
|
||||||
|
private static void reportTaskRunningEventToMaster(final TaskExecutorStartedLifecycleEvent taskExecutionRunningEvent) { |
||||||
|
Clients |
||||||
|
.withService(ITaskExecutorEventListener.class) |
||||||
|
.withHost(taskExecutionRunningEvent.getWorkflowInstanceHost()) |
||||||
|
.onTaskExecutorRunning(taskExecutionRunningEvent); |
||||||
|
} |
||||||
|
|
||||||
|
private static void reportTaskRuntimeContextChangeEventToMaster(final TaskExecutorRuntimeContextChangedLifecycleEvent taskExecutorLifecycleEvent) { |
||||||
|
Clients |
||||||
|
.withService(ITaskExecutorEventListener.class) |
||||||
|
.withHost(taskExecutorLifecycleEvent.getWorkflowInstanceHost()) |
||||||
|
.onTaskExecutorRuntimeContextChanged(taskExecutorLifecycleEvent); |
||||||
|
} |
||||||
|
|
||||||
|
private static void reportTaskPausedEventToMaster(final TaskExecutorPausedLifecycleEvent taskExecutionPausedEvent) { |
||||||
|
Clients |
||||||
|
.withService(ITaskExecutorEventListener.class) |
||||||
|
.withHost(taskExecutionPausedEvent.getWorkflowInstanceHost()) |
||||||
|
.onTaskExecutorPaused(taskExecutionPausedEvent); |
||||||
|
} |
||||||
|
|
||||||
|
private static void reportTaskKilledEventToMaster(final TaskExecutorKilledLifecycleEvent taskExecutionKilledEvent) { |
||||||
|
Clients |
||||||
|
.withService(ITaskExecutorEventListener.class) |
||||||
|
.withHost(taskExecutionKilledEvent.getWorkflowInstanceHost()) |
||||||
|
.onTaskExecutorKilled(taskExecutionKilledEvent); |
||||||
|
} |
||||||
|
|
||||||
|
private static void reportTaskFailedEventToMaster(final TaskExecutorFailedLifecycleEvent taskExecutionFailedEvent) { |
||||||
|
Clients |
||||||
|
.withService(ITaskExecutorEventListener.class) |
||||||
|
.withHost(taskExecutionFailedEvent.getWorkflowInstanceHost()) |
||||||
|
.onTaskExecutorFailed(taskExecutionFailedEvent); |
||||||
|
} |
||||||
|
|
||||||
|
private static void reportTaskSuccessEventToMaster(final TaskExecutorSuccessLifecycleEvent taskExecutionSuccessEvent) { |
||||||
|
Clients |
||||||
|
.withService(ITaskExecutorEventListener.class) |
||||||
|
.withHost(taskExecutionSuccessEvent.getWorkflowInstanceHost()) |
||||||
|
.onTaskExecutorSuccess(taskExecutionSuccessEvent); |
||||||
|
} |
||||||
|
} |
@ -1,51 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.master.transportor; |
|
||||||
|
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
import lombok.Data; |
|
||||||
import lombok.NoArgsConstructor; |
|
||||||
|
|
||||||
@Data |
|
||||||
@NoArgsConstructor |
|
||||||
public class StreamingTaskTriggerRequest { |
|
||||||
|
|
||||||
private int executorId; |
|
||||||
|
|
||||||
private String executorName; |
|
||||||
|
|
||||||
private long projectCode; |
|
||||||
|
|
||||||
private long taskDefinitionCode; |
|
||||||
|
|
||||||
private int taskDefinitionVersion; |
|
||||||
|
|
||||||
private int warningGroupId; |
|
||||||
|
|
||||||
private String workerGroup; |
|
||||||
|
|
||||||
private Long environmentCode; |
|
||||||
|
|
||||||
private Map<String, String> startParams; |
|
||||||
|
|
||||||
private String tenantCode; |
|
||||||
|
|
||||||
private int dryRun; |
|
||||||
|
|
||||||
} |
|
@ -1,55 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.master.transportor; |
|
||||||
|
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import lombok.Builder; |
|
||||||
import lombok.Data; |
|
||||||
import lombok.NoArgsConstructor; |
|
||||||
|
|
||||||
@Data |
|
||||||
@Builder |
|
||||||
@NoArgsConstructor |
|
||||||
@AllArgsConstructor |
|
||||||
public class TaskExecutionSuccessEvent implements ITaskExecutionEvent { |
|
||||||
|
|
||||||
private int taskInstanceId; |
|
||||||
|
|
||||||
private int workflowInstanceId; |
|
||||||
|
|
||||||
private String taskInstanceHost; |
|
||||||
|
|
||||||
private String workflowInstanceHost; |
|
||||||
|
|
||||||
private long endTime; |
|
||||||
|
|
||||||
private int processId; |
|
||||||
|
|
||||||
private String appIds; |
|
||||||
|
|
||||||
private String varPool; |
|
||||||
|
|
||||||
private long eventCreateTime; |
|
||||||
|
|
||||||
private long eventSendTime; |
|
||||||
|
|
||||||
@Override |
|
||||||
public TaskInstanceExecutionEventType getEventType() { |
|
||||||
return TaskInstanceExecutionEventType.SUCCESS; |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,50 @@ |
|||||||
|
/* |
||||||
|
* 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.extract.worker; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.extract.base.RpcMethod; |
||||||
|
import org.apache.dolphinscheduler.extract.base.RpcService; |
||||||
|
import org.apache.dolphinscheduler.task.executor.eventbus.ITaskExecutorLifecycleEventReporter; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorDispatchRequest; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorDispatchResponse; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorKillRequest; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorKillResponse; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorPauseRequest; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorPauseResponse; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorReassignMasterRequest; |
||||||
|
import org.apache.dolphinscheduler.task.executor.operations.TaskExecutorReassignMasterResponse; |
||||||
|
|
||||||
|
@RpcService |
||||||
|
public interface IPhysicalTaskExecutorOperator { |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
TaskExecutorDispatchResponse dispatchTask(final TaskExecutorDispatchRequest taskExecutorDispatchRequest); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
TaskExecutorKillResponse killTask(final TaskExecutorKillRequest taskExecutorKillRequest); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
TaskExecutorPauseResponse pauseTask(final TaskExecutorPauseRequest taskExecutorPauseRequest); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
TaskExecutorReassignMasterResponse reassignWorkflowInstanceHost(final TaskExecutorReassignMasterRequest taskExecutorReassignMasterRequest); |
||||||
|
|
||||||
|
@RpcMethod |
||||||
|
void ackPhysicalTaskExecutorLifecycleEvent(final ITaskExecutorLifecycleEventReporter.TaskExecutorLifecycleEventAck taskExecutorLifecycleEventAck); |
||||||
|
|
||||||
|
} |
@ -1,51 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.worker; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.extract.base.RpcMethod; |
|
||||||
import org.apache.dolphinscheduler.extract.base.RpcService; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TaskExecutionFailedEventAck; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TaskExecutionKilledEventAck; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TaskExecutionPausedEventAck; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TaskExecutionSuccessEventAck; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TaskInstanceExecutionDispatchedEventAck; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TaskInstanceExecutionRunningEventAck; |
|
||||||
|
|
||||||
@RpcService |
|
||||||
public interface ITaskInstanceExecutionEventAckListener { |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
void handleTaskInstanceDispatchedEventAck(final TaskInstanceExecutionDispatchedEventAck taskInstanceExecutionDispatchedEventAck); |
|
||||||
|
|
||||||
// todo: If we use sync, then we don't need ack here
|
|
||||||
@RpcMethod |
|
||||||
void handleTaskInstanceExecutionRunningEventAck(TaskInstanceExecutionRunningEventAck taskInstanceExecutionRunningEventAck); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
void handleTaskExecutionSuccessEventAck(TaskExecutionSuccessEventAck taskExecutionSuccessEventAck); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
void handleTaskExecutionPausedEventAck(TaskExecutionPausedEventAck taskExecutionPausedEventAck); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
void handleTaskExecutionFailedEventAck(TaskExecutionFailedEventAck taskExecutionFailedEventAck); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
void handleTaskExecutionKilledEventAck(TaskExecutionKilledEventAck taskExecutionKilledEventAck); |
|
||||||
|
|
||||||
} |
|
@ -1,46 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.worker; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.extract.base.RpcMethod; |
|
||||||
import org.apache.dolphinscheduler.extract.base.RpcService; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TakeOverTaskRequest; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TakeOverTaskResponse; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TaskInstanceDispatchRequest; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TaskInstanceDispatchResponse; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TaskInstanceKillRequest; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TaskInstanceKillResponse; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TaskInstancePauseRequest; |
|
||||||
import org.apache.dolphinscheduler.extract.worker.transportor.TaskInstancePauseResponse; |
|
||||||
|
|
||||||
@RpcService |
|
||||||
public interface ITaskInstanceOperator { |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
TaskInstanceDispatchResponse dispatchTask(final TaskInstanceDispatchRequest taskInstanceDispatchRequest); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
TaskInstanceKillResponse killTask(final TaskInstanceKillRequest taskInstanceKillRequest); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
TaskInstancePauseResponse pauseTask(final TaskInstancePauseRequest taskPauseRequest); |
|
||||||
|
|
||||||
@RpcMethod |
|
||||||
TakeOverTaskResponse takeOverTask(final TakeOverTaskRequest takeOverTaskRequest); |
|
||||||
|
|
||||||
} |
|
@ -1,40 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.worker.transportor; |
|
||||||
|
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import lombok.Data; |
|
||||||
import lombok.NoArgsConstructor; |
|
||||||
|
|
||||||
@Data |
|
||||||
@NoArgsConstructor |
|
||||||
@AllArgsConstructor |
|
||||||
public class TaskExecutionFailedEventAck { |
|
||||||
|
|
||||||
private int taskInstanceId; |
|
||||||
private boolean success; |
|
||||||
|
|
||||||
public static TaskExecutionFailedEventAck success(int taskInstanceId) { |
|
||||||
return new TaskExecutionFailedEventAck(taskInstanceId, true); |
|
||||||
} |
|
||||||
|
|
||||||
public static TaskExecutionFailedEventAck failed(int taskInstanceId) { |
|
||||||
return new TaskExecutionFailedEventAck(taskInstanceId, false); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,40 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.worker.transportor; |
|
||||||
|
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import lombok.Data; |
|
||||||
import lombok.NoArgsConstructor; |
|
||||||
|
|
||||||
@Data |
|
||||||
@NoArgsConstructor |
|
||||||
@AllArgsConstructor |
|
||||||
public class TaskExecutionKilledEventAck { |
|
||||||
|
|
||||||
private int taskInstanceId; |
|
||||||
private boolean success; |
|
||||||
|
|
||||||
public static TaskExecutionKilledEventAck success(int taskInstanceId) { |
|
||||||
return new TaskExecutionKilledEventAck(taskInstanceId, true); |
|
||||||
} |
|
||||||
|
|
||||||
public static TaskExecutionKilledEventAck failed(int taskInstanceId) { |
|
||||||
return new TaskExecutionKilledEventAck(taskInstanceId, false); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,40 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.worker.transportor; |
|
||||||
|
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import lombok.Data; |
|
||||||
import lombok.NoArgsConstructor; |
|
||||||
|
|
||||||
@Data |
|
||||||
@NoArgsConstructor |
|
||||||
@AllArgsConstructor |
|
||||||
public class TaskExecutionPausedEventAck { |
|
||||||
|
|
||||||
private int taskInstanceId; |
|
||||||
private boolean success; |
|
||||||
|
|
||||||
public static TaskExecutionPausedEventAck success(int taskInstanceId) { |
|
||||||
return new TaskExecutionPausedEventAck(taskInstanceId, true); |
|
||||||
} |
|
||||||
|
|
||||||
public static TaskExecutionPausedEventAck failed(int taskInstanceId) { |
|
||||||
return new TaskExecutionPausedEventAck(taskInstanceId, false); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,40 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.worker.transportor; |
|
||||||
|
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import lombok.Data; |
|
||||||
import lombok.NoArgsConstructor; |
|
||||||
|
|
||||||
@Data |
|
||||||
@NoArgsConstructor |
|
||||||
@AllArgsConstructor |
|
||||||
public class TaskExecutionSuccessEventAck { |
|
||||||
|
|
||||||
private int taskInstanceId; |
|
||||||
private boolean success; |
|
||||||
|
|
||||||
public static TaskExecutionSuccessEventAck success(int taskInstanceId) { |
|
||||||
return new TaskExecutionSuccessEventAck(taskInstanceId, true); |
|
||||||
} |
|
||||||
|
|
||||||
public static TaskExecutionSuccessEventAck failed(int taskInstanceId) { |
|
||||||
return new TaskExecutionSuccessEventAck(taskInstanceId, false); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,42 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.worker.transportor; |
|
||||||
|
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import lombok.Data; |
|
||||||
import lombok.NoArgsConstructor; |
|
||||||
|
|
||||||
@Data |
|
||||||
@NoArgsConstructor |
|
||||||
@AllArgsConstructor |
|
||||||
public class TaskInstanceDispatchResponse { |
|
||||||
|
|
||||||
private Integer taskInstanceId; |
|
||||||
|
|
||||||
private boolean dispatchSuccess; |
|
||||||
|
|
||||||
private String message; |
|
||||||
|
|
||||||
public static TaskInstanceDispatchResponse success(Integer taskInstanceId) { |
|
||||||
return new TaskInstanceDispatchResponse(taskInstanceId, true, "dispatch success"); |
|
||||||
} |
|
||||||
|
|
||||||
public static TaskInstanceDispatchResponse failed(Integer taskInstanceId, String message) { |
|
||||||
return new TaskInstanceDispatchResponse(taskInstanceId, false, message); |
|
||||||
} |
|
||||||
} |
|
@ -1,39 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.worker.transportor; |
|
||||||
|
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import lombok.Data; |
|
||||||
import lombok.NoArgsConstructor; |
|
||||||
|
|
||||||
@Data |
|
||||||
@NoArgsConstructor |
|
||||||
@AllArgsConstructor |
|
||||||
public class TaskInstanceExecutionDispatchedEventAck { |
|
||||||
|
|
||||||
private int taskInstanceId; |
|
||||||
private boolean success; |
|
||||||
|
|
||||||
public static TaskInstanceExecutionDispatchedEventAck success(int taskInstanceId) { |
|
||||||
return new TaskInstanceExecutionDispatchedEventAck(taskInstanceId, true); |
|
||||||
} |
|
||||||
|
|
||||||
public static TaskInstanceExecutionDispatchedEventAck failed(int taskInstanceId) { |
|
||||||
return new TaskInstanceExecutionDispatchedEventAck(taskInstanceId, false); |
|
||||||
} |
|
||||||
} |
|
@ -1,40 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.worker.transportor; |
|
||||||
|
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import lombok.Data; |
|
||||||
import lombok.NoArgsConstructor; |
|
||||||
|
|
||||||
@Data |
|
||||||
@NoArgsConstructor |
|
||||||
@AllArgsConstructor |
|
||||||
public class TaskInstanceExecutionFinishEventAck { |
|
||||||
|
|
||||||
private int taskInstanceId; |
|
||||||
private boolean success; |
|
||||||
|
|
||||||
public static TaskInstanceExecutionFinishEventAck success(int taskInstanceId) { |
|
||||||
return new TaskInstanceExecutionFinishEventAck(taskInstanceId, true); |
|
||||||
} |
|
||||||
|
|
||||||
public static TaskInstanceExecutionFinishEventAck failed(int taskInstanceId) { |
|
||||||
return new TaskInstanceExecutionFinishEventAck(taskInstanceId, false); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,40 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.worker.transportor; |
|
||||||
|
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import lombok.Data; |
|
||||||
import lombok.NoArgsConstructor; |
|
||||||
|
|
||||||
@Data |
|
||||||
@NoArgsConstructor |
|
||||||
@AllArgsConstructor |
|
||||||
public class TaskInstanceExecutionRunningEventAck { |
|
||||||
|
|
||||||
private int taskInstanceId; |
|
||||||
private boolean success; |
|
||||||
|
|
||||||
public static TaskInstanceExecutionRunningEventAck success(int taskInstanceId) { |
|
||||||
return new TaskInstanceExecutionRunningEventAck(taskInstanceId, true); |
|
||||||
} |
|
||||||
|
|
||||||
public static TaskInstanceExecutionRunningEventAck failed(int taskInstanceId) { |
|
||||||
return new TaskInstanceExecutionRunningEventAck(taskInstanceId, false); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,74 +0,0 @@ |
|||||||
/* |
|
||||||
* 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.extract.worker.transportor; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants; |
|
||||||
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; |
|
||||||
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus; |
|
||||||
|
|
||||||
import java.util.Arrays; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import lombok.Data; |
|
||||||
import lombok.NoArgsConstructor; |
|
||||||
|
|
||||||
@Data |
|
||||||
@NoArgsConstructor |
|
||||||
@AllArgsConstructor |
|
||||||
public class TaskInstanceKillResponse { |
|
||||||
|
|
||||||
private int taskInstanceId; |
|
||||||
|
|
||||||
private String host; |
|
||||||
|
|
||||||
private TaskExecutionStatus status; |
|
||||||
|
|
||||||
private int processId; |
|
||||||
|
|
||||||
/** |
|
||||||
* other resource manager appId , for example : YARN etc |
|
||||||
*/ |
|
||||||
private List<String> appIds; |
|
||||||
|
|
||||||
private boolean success; |
|
||||||
|
|
||||||
private String message; |
|
||||||
|
|
||||||
public static TaskInstanceKillResponse success(TaskExecutionContext taskExecutionContext) { |
|
||||||
TaskInstanceKillResponse taskInstanceKillResponse = new TaskInstanceKillResponse(); |
|
||||||
taskInstanceKillResponse.setSuccess(true); |
|
||||||
taskInstanceKillResponse.setStatus(taskExecutionContext.getCurrentExecutionStatus()); |
|
||||||
if (taskExecutionContext.getAppIds() != null) { |
|
||||||
taskInstanceKillResponse |
|
||||||
.setAppIds(Arrays.asList(taskExecutionContext.getAppIds().split(TaskConstants.COMMA))); |
|
||||||
} |
|
||||||
taskInstanceKillResponse.setTaskInstanceId(taskExecutionContext.getTaskInstanceId()); |
|
||||||
taskInstanceKillResponse.setHost(taskExecutionContext.getHost()); |
|
||||||
taskInstanceKillResponse.setProcessId(taskExecutionContext.getProcessId()); |
|
||||||
return taskInstanceKillResponse; |
|
||||||
} |
|
||||||
|
|
||||||
public static TaskInstanceKillResponse fail(String message) { |
|
||||||
TaskInstanceKillResponse taskInstanceKillResponse = new TaskInstanceKillResponse(); |
|
||||||
taskInstanceKillResponse.setSuccess(false); |
|
||||||
taskInstanceKillResponse.setMessage(message); |
|
||||||
return taskInstanceKillResponse; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,30 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.master.engine.exceptions; |
||||||
|
|
||||||
|
public class TaskReassignMasterHostException extends RuntimeException { |
||||||
|
|
||||||
|
public TaskReassignMasterHostException(String message) { |
||||||
|
super(message); |
||||||
|
} |
||||||
|
|
||||||
|
public TaskReassignMasterHostException(String message, Throwable cause) { |
||||||
|
super(message, cause); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,78 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.master.engine.executor; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; |
||||||
|
import org.apache.dolphinscheduler.task.executor.ITaskExecutor; |
||||||
|
import org.apache.dolphinscheduler.task.executor.TaskEngine; |
||||||
|
import org.apache.dolphinscheduler.task.executor.eventbus.ITaskExecutorLifecycleEventReporter; |
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
|
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@Component |
||||||
|
public class LogicTaskEngineDelegator implements AutoCloseable { |
||||||
|
|
||||||
|
private final TaskEngine taskEngine; |
||||||
|
|
||||||
|
private final LogicTaskExecutorFactory logicTaskExecutorFactory; |
||||||
|
|
||||||
|
private final LogicTaskExecutorLifecycleEventReporter logicTaskExecutorEventReporter; |
||||||
|
|
||||||
|
public LogicTaskEngineDelegator(final LogicTaskEngineFactory logicTaskEngineFactory, |
||||||
|
final LogicTaskExecutorFactory logicTaskExecutorFactory, |
||||||
|
final LogicTaskExecutorLifecycleEventReporter logicTaskExecutorEventReporter) { |
||||||
|
this.logicTaskExecutorFactory = logicTaskExecutorFactory; |
||||||
|
this.taskEngine = logicTaskEngineFactory.createTaskEngine(); |
||||||
|
this.logicTaskExecutorEventReporter = logicTaskExecutorEventReporter; |
||||||
|
} |
||||||
|
|
||||||
|
public void start() { |
||||||
|
taskEngine.start(); |
||||||
|
logicTaskExecutorEventReporter.start(); |
||||||
|
log.info("LogicTaskEngineDelegator started"); |
||||||
|
} |
||||||
|
|
||||||
|
public void dispatchLogicTask(final TaskExecutionContext taskExecutionContext) { |
||||||
|
final ITaskExecutor taskExecutor = logicTaskExecutorFactory.createTaskExecutor(taskExecutionContext); |
||||||
|
taskEngine.submitTask(taskExecutor); |
||||||
|
} |
||||||
|
|
||||||
|
public void killLogicTask(final int taskInstanceId) { |
||||||
|
taskEngine.killTask(taskInstanceId); |
||||||
|
} |
||||||
|
|
||||||
|
public void pauseLogicTask(final int taskInstanceId) { |
||||||
|
taskEngine.pauseTask(taskInstanceId); |
||||||
|
} |
||||||
|
|
||||||
|
public void ackLogicTaskExecutionEvent(final ITaskExecutorLifecycleEventReporter.TaskExecutorLifecycleEventAck taskExecutorLifecycleEventAck) { |
||||||
|
logicTaskExecutorEventReporter.receiveTaskExecutorLifecycleEventACK(taskExecutorLifecycleEventAck); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void close() { |
||||||
|
try ( |
||||||
|
final TaskEngine ignore1 = taskEngine; |
||||||
|
final LogicTaskExecutorLifecycleEventReporter ignore2 = logicTaskExecutorEventReporter) { |
||||||
|
log.info("LogicTaskEngineDelegator closed"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,52 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.master.engine.executor; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.task.executor.TaskEngine; |
||||||
|
import org.apache.dolphinscheduler.task.executor.TaskEngineBuilder; |
||||||
|
|
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
@Component |
||||||
|
public class LogicTaskEngineFactory { |
||||||
|
|
||||||
|
private final LogicTaskExecutorRepository logicTaskExecutorRepository; |
||||||
|
|
||||||
|
private final LogicTaskExecutorContainerProvider logicTaskExecutorContainerDelegator; |
||||||
|
|
||||||
|
private final LogicTaskExecutorEventBusCoordinator logicTaskExecutorEventBusCoordinator; |
||||||
|
|
||||||
|
public LogicTaskEngineFactory(final LogicTaskExecutorRepository logicTaskExecutorRepository, |
||||||
|
final LogicTaskExecutorContainerProvider logicTaskExecutorContainerDelegator, |
||||||
|
final LogicTaskExecutorEventBusCoordinator logicTaskExecutorEventBusCoordinator) { |
||||||
|
this.logicTaskExecutorRepository = logicTaskExecutorRepository; |
||||||
|
this.logicTaskExecutorContainerDelegator = logicTaskExecutorContainerDelegator; |
||||||
|
this.logicTaskExecutorEventBusCoordinator = logicTaskExecutorEventBusCoordinator; |
||||||
|
} |
||||||
|
|
||||||
|
public TaskEngine createTaskEngine() { |
||||||
|
final TaskEngineBuilder taskEngineBuilder = TaskEngineBuilder.builder() |
||||||
|
.engineName("LogicTaskEngine") |
||||||
|
.taskExecutorRepository(logicTaskExecutorRepository) |
||||||
|
.taskExecutorContainerDelegator(logicTaskExecutorContainerDelegator) |
||||||
|
.taskExecutorEventBusCoordinator(logicTaskExecutorEventBusCoordinator) |
||||||
|
.build(); |
||||||
|
return new TaskEngine(taskEngineBuilder); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,88 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.master.engine.executor; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; |
||||||
|
import org.apache.dolphinscheduler.server.master.engine.executor.plugin.ILogicTask; |
||||||
|
import org.apache.dolphinscheduler.server.master.engine.executor.plugin.LogicTaskPluginFactoryBuilder; |
||||||
|
import org.apache.dolphinscheduler.task.executor.AbstractTaskExecutor; |
||||||
|
import org.apache.dolphinscheduler.task.executor.TaskExecutorState; |
||||||
|
import org.apache.dolphinscheduler.task.executor.TaskExecutorStateMappings; |
||||||
|
|
||||||
|
import lombok.SneakyThrows; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
public class LogicTaskExecutor extends AbstractTaskExecutor { |
||||||
|
|
||||||
|
private ILogicTask<? extends AbstractParameters> logicTask; |
||||||
|
|
||||||
|
private final LogicTaskPluginFactoryBuilder logicTaskPluginFactoryBuilder; |
||||||
|
|
||||||
|
public LogicTaskExecutor(final LogicTaskExecutorBuilder logicTaskExecutorBuilder) { |
||||||
|
super(logicTaskExecutorBuilder.getTaskExecutionContext(), logicTaskExecutorBuilder.getTaskExecutorEventBus()); |
||||||
|
this.logicTaskPluginFactoryBuilder = logicTaskExecutorBuilder.getLogicTaskPluginFactoryBuilder(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected TaskExecutorState doTrackTaskPluginStatus() { |
||||||
|
return TaskExecutorStateMappings.mapState(logicTask.getTaskExecutionState()); |
||||||
|
} |
||||||
|
|
||||||
|
@SneakyThrows |
||||||
|
@Override |
||||||
|
protected void initializeTaskPlugin() { |
||||||
|
logicTask = logicTaskPluginFactoryBuilder |
||||||
|
.createILogicTaskPluginFactory(taskExecutionContext.getTaskType()) |
||||||
|
.createLogicTask(this); |
||||||
|
log.info("Initialized task plugin instance: {} successfully", taskExecutionContext.getTaskType()); |
||||||
|
} |
||||||
|
|
||||||
|
@SneakyThrows |
||||||
|
@Override |
||||||
|
protected void doTriggerTaskPlugin() { |
||||||
|
logicTask.start(); |
||||||
|
} |
||||||
|
|
||||||
|
@SneakyThrows |
||||||
|
@Override |
||||||
|
public void pause() { |
||||||
|
// todo: judge the status, whether the task is running, we should support to pause the task which is not running
|
||||||
|
// if the status is initialized, then we can directly change to paused
|
||||||
|
if (logicTask != null) { |
||||||
|
logicTask.pause(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@SneakyThrows |
||||||
|
@Override |
||||||
|
public void kill() { |
||||||
|
if (logicTask != null) { |
||||||
|
logicTask.kill(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
return "LogicTaskExecutor{" + |
||||||
|
"id=" + taskExecutionContext.getTaskInstanceId() + |
||||||
|
", name=" + taskExecutionContext.getTaskName() + |
||||||
|
", stat=" + taskExecutorState.get() + |
||||||
|
'}'; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,45 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.master.engine.executor; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.server.master.config.MasterConfig; |
||||||
|
import org.apache.dolphinscheduler.task.executor.container.ITaskExecutorContainer; |
||||||
|
import org.apache.dolphinscheduler.task.executor.container.ITaskExecutorContainerProvider; |
||||||
|
import org.apache.dolphinscheduler.task.executor.container.SharedThreadTaskExecutorContainer; |
||||||
|
import org.apache.dolphinscheduler.task.executor.container.TaskExecutorContainerConfig; |
||||||
|
|
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
@Component |
||||||
|
public class LogicTaskExecutorContainerProvider implements ITaskExecutorContainerProvider { |
||||||
|
|
||||||
|
private final ITaskExecutorContainer taskExecutorContainer; |
||||||
|
|
||||||
|
public LogicTaskExecutorContainerProvider(final MasterConfig masterConfig) { |
||||||
|
final TaskExecutorContainerConfig containerConfig = TaskExecutorContainerConfig.builder() |
||||||
|
.taskExecutorThreadPoolSize(masterConfig.getLogicTaskConfig().getTaskExecutorThreadCount()) |
||||||
|
.containerName("shared-task-executor-container") |
||||||
|
.build(); |
||||||
|
this.taskExecutorContainer = new SharedThreadTaskExecutorContainer(containerConfig); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public ITaskExecutorContainer getExecutorContainer() { |
||||||
|
return taskExecutorContainer; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.master.engine.executor; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.extract.master.TaskExecutorEventRemoteReporterClient; |
||||||
|
|
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
@Component |
||||||
|
public class LogicTaskExecutorEventRemoteReporterClient extends TaskExecutorEventRemoteReporterClient { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,55 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.master.engine.executor; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; |
||||||
|
import org.apache.dolphinscheduler.plugin.task.api.utils.LogUtils; |
||||||
|
import org.apache.dolphinscheduler.server.master.engine.executor.plugin.LogicTaskPluginFactoryBuilder; |
||||||
|
import org.apache.dolphinscheduler.task.executor.ITaskExecutor; |
||||||
|
import org.apache.dolphinscheduler.task.executor.ITaskExecutorFactory; |
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
|
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@Component |
||||||
|
public class LogicTaskExecutorFactory implements ITaskExecutorFactory { |
||||||
|
|
||||||
|
private final LogicTaskPluginFactoryBuilder logicTaskPluginFactoryBuilder; |
||||||
|
|
||||||
|
public LogicTaskExecutorFactory(final LogicTaskPluginFactoryBuilder logicTaskPluginFactoryBuilder) { |
||||||
|
this.logicTaskPluginFactoryBuilder = logicTaskPluginFactoryBuilder; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public ITaskExecutor createTaskExecutor(final TaskExecutionContext taskExecutionContext) { |
||||||
|
assemblyTaskLogPath(taskExecutionContext); |
||||||
|
|
||||||
|
final LogicTaskExecutorBuilder logicTaskExecutorBuilder = LogicTaskExecutorBuilder.builder() |
||||||
|
.taskExecutionContext(taskExecutionContext) |
||||||
|
.logicTaskPluginFactoryBuilder(logicTaskPluginFactoryBuilder) |
||||||
|
.build(); |
||||||
|
return new LogicTaskExecutor(logicTaskExecutorBuilder); |
||||||
|
} |
||||||
|
|
||||||
|
private void assemblyTaskLogPath(final TaskExecutionContext taskExecutionContext) { |
||||||
|
taskExecutionContext.setLogPath(LogUtils.getTaskInstanceLogFullPath(taskExecutionContext)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.master.engine.executor; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.task.executor.listener.TaskExecutorLifecycleEventListener; |
||||||
|
|
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
@Component |
||||||
|
public class LogicTaskExecutorLifecycleEventListener extends TaskExecutorLifecycleEventListener { |
||||||
|
|
||||||
|
public LogicTaskExecutorLifecycleEventListener( |
||||||
|
final LogicTaskExecutorContainerProvider logicTaskExecutorContainerDelegator, |
||||||
|
final LogicTaskExecutorRepository logicTaskExecutorRepository, |
||||||
|
final LogicTaskExecutorLifecycleEventReporter logicTaskExecutorEventReporter) { |
||||||
|
super( |
||||||
|
logicTaskExecutorContainerDelegator, |
||||||
|
logicTaskExecutorRepository, |
||||||
|
logicTaskExecutorEventReporter); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.master.engine.executor; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.task.executor.eventbus.TaskExecutorLifecycleEventRemoteReporter; |
||||||
|
|
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
@Component |
||||||
|
public class LogicTaskExecutorLifecycleEventReporter extends TaskExecutorLifecycleEventRemoteReporter { |
||||||
|
|
||||||
|
public LogicTaskExecutorLifecycleEventReporter( |
||||||
|
final LogicTaskExecutorEventRemoteReporterClient logicTaskExecutorEventRemoteReporterClient) { |
||||||
|
super("LogicTaskExecutorLifecycleEventReporter", logicTaskExecutorEventRemoteReporterClient); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.master.engine.executor; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.task.executor.TaskExecutorRepository; |
||||||
|
|
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
@Component |
||||||
|
public class LogicTaskExecutorRepository extends TaskExecutorRepository { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,74 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.master.engine.executor.plugin; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.common.utils.JSONUtils; |
||||||
|
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; |
||||||
|
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus; |
||||||
|
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; |
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
|
||||||
|
import com.google.common.base.Preconditions; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
public abstract class AbstractLogicTask<T extends AbstractParameters> implements ILogicTask<T> { |
||||||
|
|
||||||
|
protected final TaskExecutionContext taskExecutionContext; |
||||||
|
|
||||||
|
protected final T taskParameters; |
||||||
|
|
||||||
|
protected TaskExecutionStatus taskExecutionStatus; |
||||||
|
|
||||||
|
public AbstractLogicTask(final TaskExecutionContext taskExecutionContext) { |
||||||
|
this.taskExecutionContext = taskExecutionContext; |
||||||
|
this.taskParameters = getTaskParameterDeserializer().deserialize(taskExecutionContext.getTaskParams()); |
||||||
|
Preconditions.checkNotNull(taskParameters, |
||||||
|
"Deserialize task parameters: " + taskExecutionContext.getTaskParams()); |
||||||
|
log.info("Success initialize parameters: \n{}", JSONUtils.toPrettyJsonString(taskParameters)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public TaskExecutionStatus getTaskExecutionState() { |
||||||
|
return taskExecutionStatus; |
||||||
|
} |
||||||
|
|
||||||
|
protected boolean isRunning() { |
||||||
|
return taskExecutionStatus == TaskExecutionStatus.RUNNING_EXECUTION; |
||||||
|
} |
||||||
|
|
||||||
|
protected void onTaskRunning() { |
||||||
|
taskExecutionStatus = TaskExecutionStatus.RUNNING_EXECUTION; |
||||||
|
} |
||||||
|
|
||||||
|
protected void onTaskSuccess() { |
||||||
|
taskExecutionStatus = TaskExecutionStatus.SUCCESS; |
||||||
|
} |
||||||
|
|
||||||
|
protected void onTaskFailed() { |
||||||
|
taskExecutionStatus = TaskExecutionStatus.FAILURE; |
||||||
|
} |
||||||
|
|
||||||
|
protected void onTaskKilled() { |
||||||
|
taskExecutionStatus = TaskExecutionStatus.KILL; |
||||||
|
} |
||||||
|
|
||||||
|
protected void onTaskPaused() { |
||||||
|
taskExecutionStatus = TaskExecutionStatus.PAUSE; |
||||||
|
} |
||||||
|
} |
34
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/subworkflow/SubWorkflowLogicTaskPluginFactory.java → dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/executor/plugin/subworkflow/SubWorkflowLogicTaskPluginFactory.java
34
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/subworkflow/SubWorkflowLogicTaskPluginFactory.java → dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/executor/plugin/subworkflow/SubWorkflowLogicTaskPluginFactory.java
2
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/subworkflow/SubWorkflowLogicTaskRuntimeContext.java → dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/executor/plugin/subworkflow/SubWorkflowLogicTaskRuntimeContext.java
2
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/subworkflow/SubWorkflowLogicTaskRuntimeContext.java → dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/executor/plugin/subworkflow/SubWorkflowLogicTaskRuntimeContext.java
@ -1,31 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
package org.apache.dolphinscheduler.server.master.engine.task.client; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.server.master.engine.exceptions.TaskKillException; |
|
||||||
import org.apache.dolphinscheduler.server.master.engine.task.runnable.ITaskExecutionRunnable; |
|
||||||
|
|
||||||
public interface ITaskOperator { |
|
||||||
|
|
||||||
void dispatch(ITaskExecutionRunnable taskExecutionRunnable); |
|
||||||
|
|
||||||
void pause(ITaskExecutionRunnable taskExecutionRunnable); |
|
||||||
|
|
||||||
void kill(ITaskExecutionRunnable taskExecutionRunnable) throws TaskKillException; |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,50 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.master.engine.task.lifecycle.event; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.server.master.engine.ILifecycleEventType; |
||||||
|
import org.apache.dolphinscheduler.server.master.engine.task.lifecycle.AbstractTaskLifecycleEvent; |
||||||
|
import org.apache.dolphinscheduler.server.master.engine.task.lifecycle.TaskLifecycleEventType; |
||||||
|
import org.apache.dolphinscheduler.server.master.engine.task.runnable.ITaskExecutionRunnable; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Builder; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@Getter |
||||||
|
@Builder |
||||||
|
@AllArgsConstructor |
||||||
|
public class TaskRuntimeContextChangedEvent extends AbstractTaskLifecycleEvent { |
||||||
|
|
||||||
|
private final ITaskExecutionRunnable taskExecutionRunnable; |
||||||
|
|
||||||
|
private final String runtimeContext; |
||||||
|
|
||||||
|
@Override |
||||||
|
public ILifecycleEventType getEventType() { |
||||||
|
return TaskLifecycleEventType.RUNTIME_CONTEXT_CHANGED; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
return "TaskRunningLifecycleEvent{" + |
||||||
|
"task=" + taskExecutionRunnable.getName() + |
||||||
|
", runtimeContext=" + runtimeContext + |
||||||
|
'}'; |
||||||
|
} |
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue