You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/07/22 02:46:37 UTC

[GitHub] [dolphinscheduler] ruanwenjun opened a new issue, #11103: [Feature][Task] Add a new abstractTask-AbstractLoopStateTask

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: commits-unsubscribe@dolphinscheduler.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] github-actions[bot] commented on issue #11103: [Feature][Task] Add a new abstractTask-AbstractLoopStateTask

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #11103:
URL: https://github.com/apache/dolphinscheduler/issues/11103#issuecomment-1192125530

   Thank you for your feedback, we have received your issue, Please wait patiently for a reply.
   * In order for us to understand your request as soon as possible, please provide detailed information、version or pictures.
   * If you haven't received a reply for a long time, you can [join our slack](https://s.apache.org/dolphinscheduler-slack) and send your question to channel `#troubleshooting`


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] ruanwenjun closed issue #11103: [Feature][Task] Add a new abstract task-AbstractLoopStateTask

Posted by GitBox <gi...@apache.org>.
ruanwenjun closed issue #11103: [Feature][Task] Add a new abstract task-AbstractLoopStateTask
URL: https://github.com/apache/dolphinscheduler/issues/11103


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org