boying52 opened a new issue #2352: [QUESTION] about concurrency processinstance 
URL: https://github.com/apache/incubator-dolphinscheduler/issues/2352
 
 
   i want to adjust program code for concurrence is disable, adjust follow 
place:
   1、org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.java
     add:
       Long queryByProcessDefineNameRunningCnts(@Param("processDefinitionId") 
int processDefinitionId,@Param("states") int[] statusArray);
   2、org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml
     add:
       <select id="queryByProcessDefineNameRunningCnts" 
resultType="java.lang.Long">
           SELECT count(*)
           FROM t_ds_process_instance instance
           WHERE instance.process_definition_id=#{processDefinitionId}
             and instance.state in
           <foreach collection="states" index="index" item="i" open="(" 
separator="," close=")">
               #{i}
           </foreach>
       </select>
   3、org/apache/dolphinscheduler/dao/ProcessDao.java
   in  private ProcessInstance constructProcessInstance(...) Add:
   /*
               *
               * TODO:bobin 2020-03-30 增加串行
               *
               */
               if (command!=null) {
                   logger.debug(String.format("command type is 
%s",StringUtils.isNoneBlank(commandType.getDescp())));
               }
   
               if (commandType==CommandType.SCHEDULER) {
   
                   //logger.info(String.format("process instance 
%s",processDefinition.toString()));
   
                   if (processDefinition.getGlobalParamMap()!=null && 
processDefinition.getGlobalParamMap().containsKey("boying-seq"))
                   {
                       long cnt = 
processInstanceMapper.queryByProcessDefineNameRunningCnts(command.getProcessDefinitionId(),
                               new 
int[]{ExecutionStatus.RUNNING_EXEUTION.getCode(), 
ExecutionStatus.WAITTING_THREAD.getCode(), 
ExecutionStatus.WAITTING_DEPEND.getCode()}
                       ).longValue();
                       logger.debug(String.format("process defineid:%d & 
running instance count %d",command.getProcessDefinitionId(),cnt));
                       if (cnt > 0)
                           return null;
                   }
   
               }
   
   
           }
   
   
![image](https://user-images.githubusercontent.com/12903783/78107991-10a5bd80-7429-11ea-9ca7-1387622f86d6.png)
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to