ruanwenjun opened a new issue, #11103: URL: https://github.com/apache/dolphinscheduler/issues/11103
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Right now, there exist some tasks, that need to call a third-party platform, and query the task instance status from the third-party platform until the task instance is finished(success/failed). We can extract this logic and put it into an abstract class, the new task can easy to implement this class. <img width="770" alt="image" src="https://user-images.githubusercontent.com/22415594/180351427-34e48d98-a019-4e79-b2d0-57395b35d0d4.png"> The class defined like below: ```java public abstract class AbstractLoopTask extends AbstractTask { @Override public void handle() throws Exception { public void handle() throws Exception { LoopTaskInstanceInfo loopTaskInstanceInfo = submitTask(); sendAppIdToMaster(loopTaskInstanceInfo); LoopTaskIntstanceStatus loopTaskIntstanceStatus = LoopTaskIntstanceStatus.RUNNING; while (LoopTaskIntstanceStatus.RUNNING.equals(loopTaskIntstanceStatus)) { loopTaskIntstanceStatus = queryTaskInstanceStatus(); Thread.sleep(1000L); } } } public abstract LoopTaskInstanceInfo submitTask(); public abstract LoopTaskIntstanceStatus queryTaskInstanceStatus(); } public interface LoopTaskInstanceInfo { String getAppId(); } public enum LoopTaskIntstanceStatus { RUNNING, SUCCESS, FAILED, ; } ``` The new task only needs to override how to submit the task, and how to queryTaskInstanceStatus. Indeed, we can provide a template for the task needs to send HTTP request to submit/query. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
