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/06/09 03:55:31 UTC

[GitHub] [dolphinscheduler] caishunfeng commented on a diff in pull request #10376: [Improvement] [Api & Master] Complement function transformation

caishunfeng commented on code in PR #10376:
URL: https://github.com/apache/dolphinscheduler/pull/10376#discussion_r893043579


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java:
##########
@@ -740,45 +729,24 @@ protected int createComplementCommandList(Date start, Date end, RunMode runMode,
                         }
                     }
                     logger.info("In parallel mode, current expectedParallelismNumber:{}", createCount);
-
                     // Distribute the number of tasks equally to each command.
                     // The last command with insufficient quantity will be assigned to the remaining tasks.
-                    int itemsPerCommand = (listDateSize / createCount);
-                    int remainingItems = (listDateSize % createCount);
-                    int startDateIndex = 0;
-                    int endDateIndex = 0;
-
-                    for (int i = 1; i <= createCount; i++) {
-                        int extra = (i <= remainingItems) ? 1 : 0;
-                        int singleCommandItems = (itemsPerCommand + extra);
-
-                        if (i == 1) {
-                            endDateIndex += singleCommandItems - 1;
-                        } else {
-                            startDateIndex = endDateIndex + 1;
-                            endDateIndex += singleCommandItems;
+                    for(List<String> stringDate : Lists.partition(listDate,createCount)){
+                        String tempDate = "";
+                        for(String date : stringDate){
+                            tempDate  += date +",";
                         }
-
-                        cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(listDate.get(startDateIndex)));
-                        cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(listDate.get(endDateIndex)));
+                        cmdParam.put(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE, tempDate.substring(0,tempDate.length() - 1));
                         command.setCommandParam(JSONUtils.toJsonString(cmdParam));
                         processService.createCommand(command);
-
-                        if (schedules.isEmpty() || complementDependentMode == ComplementDependentMode.OFF_MODE) {
-                            logger.info("process code: {} complement dependent in off mode or schedule's size is 0, skip "
-                                    + "dependent complement data", command.getProcessDefinitionCode());
-                        } else {
-                            dependentProcessDefinitionCreateCount += createComplementDependentCommand(schedules, command);
-                        }

Review Comment:
   +1, I had the same question here.



-- 
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