{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-doris/pulls/comments/233722846","pull_request_review_id":175203522,"id":233722846,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzcyMjg0Ng==","diff_hunk":"@@ -0,0 +1,79 @@\n+// Licensed to the Apache Software Foundation (ASF) under one\n+// or more contributor license agreements.  See the NOTICE file\n+// distributed with this work for additional information\n+// regarding copyright ownership.  The ASF licenses this file\n+// to you under the Apache License, Version 2.0 (the\n+// \"License\"); you may not use this file except in compliance\n+// with the License.  You may obtain a copy of the License at\n+//\n+//   http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing,\n+// software distributed under the License is distributed on an\n+// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+// KIND, either express or implied.  See the License for the\n+// specific language governing permissions and limitations\n+// under the License.\n+\n+package org.apache.doris.load.routineload;\n+\n+import org.apache.doris.catalog.Catalog;\n+import org.apache.doris.common.LoadException;\n+import org.apache.doris.common.util.Daemon;\n+import org.apache.logging.log4j.LogManager;\n+import org.apache.logging.log4j.Logger;\n+\n+import java.util.List;\n+\n+public class RoutineLoadScheduler extends Daemon {\n+\n+    private static final Logger LOG = LogManager.getLogger(RoutineLoadScheduler.class);\n+\n+    private RoutineLoad routineLoad = Catalog.getInstance().getRoutineLoadInstance();\n+\n+    @Override\n+    protected void runOneCycle() {\n+        // get need scheduler routine jobs\n+        List<RoutineLoadJob> routineLoadJobList = null;\n+        try {\n+            routineLoadJobList = getNeedSchedulerRoutineJobs();\n+        } catch (LoadException e) {\n+            LOG.error(\"failed to get need scheduler routine jobs\");\n+        }\n+\n+        if (routineLoadJobList != null) {\n+            for (RoutineLoadJob routineLoadJob : routineLoadJobList) {\n+                // judge nums of tasks more then max concurrent tasks of cluster\n+                int currentConcurrentTaskNum = routineLoadJob.calculateCurrentConcurrentTaskNum();\n+                int totalTaskNum = currentConcurrentTaskNum + routineLoad.getIdToRoutineLoadTask().size();\n+                if (totalTaskNum > routineLoad.getTotalMaxConcurrentTaskNum()) {\n+                    LOG.info(\"desried total task num = job {} concurrent task num {} + current total task num {}\",\n+                            routineLoadJob.getId(), currentConcurrentTaskNum,\n+                            routineLoad.getIdToRoutineLoadTask().size());\n+                    LOG.info(\"desired total task num {} more then total max task num {}, \"\n+                                    + \"skip this turn of scheduler\",\n+                            totalTaskNum, routineLoad.getTotalMaxConcurrentTaskNum());\n+                    break;\n+                }\n+                // divide job into tasks\n+                List<RoutineLoadTask> routineLoadTaskList =\n+                        routineLoadJob.divideRoutineLoadJob(currentConcurrentTaskNum);\n+\n+                // update tasks meta\n+                routineLoad.addRoutineLoadTasks(routineLoadTaskList);\n+                routineLoad.addNeedSchedulerRoutineLoadTasks(routineLoadTaskList);\n+\n+                // change job state to running\n+                routineLoad.updateRoutineLoadJobState(routineLoadJob, RoutineLoadJob.JobState.RUNNING);\n+            }\n+        }\n+\n+    }\n+\n+    private List<RoutineLoadJob> getNeedSchedulerRoutineJobs() throws LoadException {\n+        RoutineLoad routineLoad = Catalog.getInstance().getRoutineLoadInstance();","path":"fe/src/main/java/org/apache/doris/load/routineload/RoutineLoadScheduler.java","position":74,"original_position":74,"commit_id":"d807a08072bc9cbf7e48795bd94e6824509e2358","original_commit_id":"d807a08072bc9cbf7e48795bd94e6824509e2358","user":{"login":"EmmyMiao87","id":25147274,"node_id":"MDQ6VXNlcjI1MTQ3Mjc0","avatar_url":"https://avatars3.githubusercontent.com/u/25147274?v=4","gravatar_id":"","url":"https://api.github.com/users/EmmyMiao87","html_url":"https://github.com/EmmyMiao87","followers_url":"https://api.github.com/users/EmmyMiao87/followers","following_url":"https://api.github.com/users/EmmyMiao87/following{/other_user}","gists_url":"https://api.github.com/users/EmmyMiao87/gists{/gist_id}","starred_url":"https://api.github.com/users/EmmyMiao87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmmyMiao87/subscriptions","organizations_url":"https://api.github.com/users/EmmyMiao87/orgs","repos_url":"https://api.github.com/users/EmmyMiao87/repos","events_url":"https://api.github.com/users/EmmyMiao87/events{/privacy}","received_events_url":"https://api.github.com/users/EmmyMiao87/received_events","type":"User","site_admin":false},"body":"Got it","created_at":"2018-11-15T06:16:36Z","updated_at":"2018-11-15T06:16:36Z","html_url":"https://github.com/apache/incubator-doris/pull/313#discussion_r233722846","pull_request_url":"https://api.github.com/repos/apache/incubator-doris/pulls/313","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-doris/pulls/comments/233722846"},"html":{"href":"https://github.com/apache/incubator-doris/pull/313#discussion_r233722846"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-doris/pulls/313"}},"in_reply_to_id":233690864},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-doris/pulls/313","id":230866225,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwODY2MjI1","html_url":"https://github.com/apache/incubator-doris/pull/313","diff_url":"https://github.com/apache/incubator-doris/pull/313.diff","patch_url":"https://github.com/apache/incubator-doris/pull/313.patch","issue_url":"https://api.github.com/repos/apache/incubator-doris/issues/313","number":313,"state":"open","locked":false,"title":"scheduler routine load job for stream load","user":{"login":"EmmyMiao87","id":25147274,"node_id":"MDQ6VXNlcjI1MTQ3Mjc0","avatar_url":"https://avatars3.githubusercontent.com/u/25147274?v=4","gravatar_id":"","url":"https://api.github.com/users/EmmyMiao87","html_url":"https://github.com/EmmyMiao87","followers_url":"https://api.github.com/users/EmmyMiao87/followers","following_url":"https://api.github.com/users/EmmyMiao87/following{/other_user}","gists_url":"https://api.github.com/users/EmmyMiao87/gists{/gist_id}","starred_url":"https://api.github.com/users/EmmyMiao87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmmyMiao87/subscriptions","organizations_url":"https://api.github.com/users/EmmyMiao87/orgs","repos_url":"https://api.github.com/users/EmmyMiao87/repos","events_url":"https://api.github.com/users/EmmyMiao87/events{/privacy}","received_events_url":"https://api.github.com/users/EmmyMiao87/received_events","type":"User","site_admin":false},"body":"1. fetch need_scheduler routine load job\r\n2. caculate current concurrent task number of job\r\n3. divide kafka partition into tasks","created_at":"2018-11-14T15:00:26Z","updated_at":"2018-11-15T06:16:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"402796f69b0224f927cec681d04d8ec6f70daa2e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-doris/pulls/313/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-doris/pulls/313/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-doris/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-doris/issues/313/comments","statuses_url":"https://api.github.com/repos/apache/incubator-doris/statuses/d807a08072bc9cbf7e48795bd94e6824509e2358","head":{"label":"EmmyMiao87:master","ref":"master","sha":"d807a08072bc9cbf7e48795bd94e6824509e2358","user":{"login":"EmmyMiao87","id":25147274,"node_id":"MDQ6VXNlcjI1MTQ3Mjc0","avatar_url":"https://avatars3.githubusercontent.com/u/25147274?v=4","gravatar_id":"","url":"https://api.github.com/users/EmmyMiao87","html_url":"https://github.com/EmmyMiao87","followers_url":"https://api.github.com/users/EmmyMiao87/followers","following_url":"https://api.github.com/users/EmmyMiao87/following{/other_user}","gists_url":"https://api.github.com/users/EmmyMiao87/gists{/gist_id}","starred_url":"https://api.github.com/users/EmmyMiao87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmmyMiao87/subscriptions","organizations_url":"https://api.github.com/users/EmmyMiao87/orgs","repos_url":"https://api.github.com/users/EmmyMiao87/repos","events_url":"https://api.github.com/users/EmmyMiao87/events{/privacy}","received_events_url":"https://api.github.com/users/EmmyMiao87/received_events","type":"User","site_admin":false},"repo":{"id":155680801,"node_id":"MDEwOlJlcG9zaXRvcnkxNTU2ODA4MDE=","name":"incubator-doris","full_name":"EmmyMiao87/incubator-doris","private":false,"owner":{"login":"EmmyMiao87","id":25147274,"node_id":"MDQ6VXNlcjI1MTQ3Mjc0","avatar_url":"https://avatars3.githubusercontent.com/u/25147274?v=4","gravatar_id":"","url":"https://api.github.com/users/EmmyMiao87","html_url":"https://github.com/EmmyMiao87","followers_url":"https://api.github.com/users/EmmyMiao87/followers","following_url":"https://api.github.com/users/EmmyMiao87/following{/other_user}","gists_url":"https://api.github.com/users/EmmyMiao87/gists{/gist_id}","starred_url":"https://api.github.com/users/EmmyMiao87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmmyMiao87/subscriptions","organizations_url":"https://api.github.com/users/EmmyMiao87/orgs","repos_url":"https://api.github.com/users/EmmyMiao87/repos","events_url":"https://api.github.com/users/EmmyMiao87/events{/privacy}","received_events_url":"https://api.github.com/users/EmmyMiao87/received_events","type":"User","site_admin":false},"html_url":"https://github.com/EmmyMiao87/incubator-doris","description":"Apache Doris (Incubating)","fork":true,"url":"https://api.github.com/repos/EmmyMiao87/incubator-doris","forks_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/forks","keys_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/teams","hooks_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/hooks","issue_events_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/issues/events{/number}","events_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/events","assignees_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/assignees{/user}","branches_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/branches{/branch}","tags_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/tags","blobs_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/git/refs{/sha}","trees_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/statuses/{sha}","languages_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/languages","stargazers_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/stargazers","contributors_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/contributors","subscribers_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/subscribers","subscription_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/subscription","commits_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/commits{/sha}","git_commits_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/git/commits{/sha}","comments_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/comments{/number}","issue_comment_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/issues/comments{/number}","contents_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/contents/{+path}","compare_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/merges","archive_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/downloads","issues_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/issues{/number}","pulls_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/pulls{/number}","milestones_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/milestones{/number}","notifications_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/labels{/name}","releases_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/releases{/id}","deployments_url":"https://api.github.com/repos/EmmyMiao87/incubator-doris/deployments","created_at":"2018-11-01T07:52:59Z","updated_at":"2018-11-14T14:55:23Z","pushed_at":"2018-11-14T14:55:09Z","git_url":"git://github.com/EmmyMiao87/incubator-doris.git","ssh_url":"git@github.com:EmmyMiao87/incubator-doris.git","clone_url":"https://github.com/EmmyMiao87/incubator-doris.git","svn_url":"https://github.com/EmmyMiao87/incubator-doris","homepage":"","size":255321,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"3a878fcf09e92b8de6a39f9c0a785b7b2f2dd55b","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":99919302,"node_id":"MDEwOlJlcG9zaXRvcnk5OTkxOTMwMg==","name":"incubator-doris","full_name":"apache/incubator-doris","private":false,"owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/apache/incubator-doris","description":"Apache Doris (Incubating)","fork":false,"url":"https://api.github.com/repos/apache/incubator-doris","forks_url":"https://api.github.com/repos/apache/incubator-doris/forks","keys_url":"https://api.github.com/repos/apache/incubator-doris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-doris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-doris/teams","hooks_url":"https://api.github.com/repos/apache/incubator-doris/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-doris/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-doris/events","assignees_url":"https://api.github.com/repos/apache/incubator-doris/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-doris/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-doris/tags","blobs_url":"https://api.github.com/repos/apache/incubator-doris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-doris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-doris/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-doris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-doris/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-doris/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-doris/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-doris/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-doris/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-doris/subscription","commits_url":"https://api.github.com/repos/apache/incubator-doris/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-doris/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-doris/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-doris/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-doris/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-doris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-doris/merges","archive_url":"https://api.github.com/repos/apache/incubator-doris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-doris/downloads","issues_url":"https://api.github.com/repos/apache/incubator-doris/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-doris/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-doris/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-doris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-doris/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-doris/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-doris/deployments","created_at":"2017-08-10T12:13:30Z","updated_at":"2018-11-15T06:04:05Z","pushed_at":"2018-11-15T06:03:53Z","git_url":"git://github.com/apache/incubator-doris.git","ssh_url":"git@github.com:apache/incubator-doris.git","clone_url":"https://github.com/apache/incubator-doris.git","svn_url":"https://github.com/apache/incubator-doris","homepage":"http://doris.incubator.apache.org","size":255299,"stargazers_count":942,"watchers_count":942,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":236,"mirror_url":null,"archived":false,"open_issues_count":38,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":236,"open_issues":38,"watchers":942,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-doris/pulls/313"},"html":{"href":"https://github.com/apache/incubator-doris/pull/313"},"issue":{"href":"https://api.github.com/repos/apache/incubator-doris/issues/313"},"comments":{"href":"https://api.github.com/repos/apache/incubator-doris/issues/313/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-doris/pulls/313/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-doris/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-doris/pulls/313/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-doris/statuses/d807a08072bc9cbf7e48795bd94e6824509e2358"}},"author_association":"NONE"}}
{"actor":{"display_login":"EmmyMiao87"}}