forked from apache/dolphinscheduler
-
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.
[Improvement] Move delay calculation to Master (apache#15278)
- Loading branch information
1 parent
43f5f24
commit 2119e41
Showing
65 changed files
with
403 additions
and
579 deletions.
There are no files selected for viewing
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
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
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
55 changes: 55 additions & 0 deletions
55
...c/main/java/org/apache/dolphinscheduler/server/master/runner/BaseTaskExecuteRunnable.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,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.runner; | ||
|
||
import static com.google.common.base.Preconditions.checkNotNull; | ||
|
||
import org.apache.dolphinscheduler.dao.entity.ProcessInstance; | ||
import org.apache.dolphinscheduler.dao.entity.TaskInstance; | ||
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; | ||
|
||
public abstract class BaseTaskExecuteRunnable implements TaskExecuteRunnable { | ||
|
||
protected final ProcessInstance workflowInstance; | ||
protected final TaskInstance taskInstance; | ||
protected final TaskExecutionContext taskExecutionContext; | ||
|
||
public BaseTaskExecuteRunnable(ProcessInstance workflowInstance, | ||
TaskInstance taskInstance, | ||
TaskExecutionContext taskExecutionContext) { | ||
this.taskInstance = checkNotNull(taskInstance); | ||
this.workflowInstance = checkNotNull(workflowInstance); | ||
this.taskExecutionContext = checkNotNull(taskExecutionContext); | ||
} | ||
|
||
@Override | ||
public ProcessInstance getWorkflowInstance() { | ||
return workflowInstance; | ||
} | ||
|
||
@Override | ||
public TaskInstance getTaskInstance() { | ||
return taskInstance; | ||
} | ||
|
||
@Override | ||
public TaskExecutionContext getTaskExecutionContext() { | ||
return taskExecutionContext; | ||
} | ||
|
||
} |
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
52 changes: 52 additions & 0 deletions
52
...rg/apache/dolphinscheduler/server/master/runner/GlobalMasterTaskExecuteRunnableQueue.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,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.runner; | ||
|
||
import org.apache.dolphinscheduler.server.master.runner.execute.MasterTaskExecutor; | ||
|
||
import java.util.concurrent.BlockingQueue; | ||
import java.util.concurrent.LinkedBlockingQueue; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* | ||
*/ | ||
@Component | ||
public class GlobalMasterTaskExecuteRunnableQueue { | ||
|
||
private final BlockingQueue<MasterTaskExecutor> masterTaskExecutorBlockingQueue = | ||
new LinkedBlockingQueue<>(); | ||
|
||
public boolean submitMasterTaskExecuteRunnable(MasterTaskExecutor masterTaskExecutor) { | ||
return masterTaskExecutorBlockingQueue.offer(masterTaskExecutor); | ||
} | ||
|
||
public MasterTaskExecutor takeMasterTaskExecuteRunnable() throws InterruptedException { | ||
return masterTaskExecutorBlockingQueue.take(); | ||
} | ||
|
||
public boolean removeMasterTaskExecuteRunnable(MasterTaskExecutor masterTaskExecutor) { | ||
return masterTaskExecutorBlockingQueue.remove(masterTaskExecutor); | ||
} | ||
|
||
public int size() { | ||
return masterTaskExecutorBlockingQueue.size(); | ||
} | ||
|
||
} |
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
Oops, something went wrong.