{"action":"created","comment":{"url":"https://api.github.com/repos/apache/storm/pulls/comments/47732871","id":47732871,"diff_hunk":"@@ -28,94 +32,272 @@\n import backtype.storm.scheduler.Topologies;\n import backtype.storm.scheduler.TopologyDetails;\n import backtype.storm.scheduler.WorkerSlot;\n-import backtype.storm.scheduler.resource.strategies.ResourceAwareStrategy;\n \n+import java.util.Arrays;\n import java.util.Collection;\n import java.util.HashMap;\n import java.util.HashSet;\n-import java.util.LinkedList;\n import java.util.Map;\n import java.util.Set;\n \n public class ResourceAwareScheduler implements IScheduler {\n+\n+    private Map<String, User> userMap;\n+    private Cluster cluster;\n+    private Topologies topologies;\n+    private RAS_Nodes nodes;\n+\n+    private class SchedulingState {\n+        private Map<String, User> userMap = new HashMap<String, User>();\n+        private Cluster cluster;\n+        private Topologies topologies;\n+        private RAS_Nodes nodes;\n+        private Map conf = new Config();\n+\n+        public SchedulingState(Map<String, User> userMap, Cluster cluster, Topologies topologies, RAS_Nodes nodes, Map conf) {\n+            for (Map.Entry<String, User> userMapEntry : userMap.entrySet()) {\n+                String userId = userMapEntry.getKey();\n+                User user = userMapEntry.getValue();\n+                this.userMap.put(userId, user.getCopy());\n+            }\n+            this.cluster = cluster.getCopy();\n+            this.topologies = topologies.getCopy();\n+            this.nodes = new RAS_Nodes(this.cluster, this.topologies);\n+            this.conf.putAll(conf);\n+\n+        }\n+    }\n+\n+\n+    @SuppressWarnings(\"rawtypes\")\n+    private Map conf;\n+\n     private static final Logger LOG = LoggerFactory\n             .getLogger(ResourceAwareScheduler.class);\n-    @SuppressWarnings(\"rawtypes\")\n-    private Map _conf;\n \n     @Override\n     public void prepare(Map conf) {\n-        _conf = conf;\n+        this.conf = conf;\n+\n     }\n \n     @Override\n     public void schedule(Topologies topologies, Cluster cluster) {\n-        LOG.debug(\"\\n\\n\\nRerunning ResourceAwareScheduler...\");\n+        LOG.info(\"\\n\\n\\nRerunning ResourceAwareScheduler...\");","path":"storm-core/src/jvm/backtype/storm/scheduler/resource/ResourceAwareScheduler.java","position":70,"original_position":72,"commit_id":"6bde95d8a2aa80b5be33245c61b257460bf3f1c5","original_commit_id":"9dbeb67f4279ee588d540105408cdbf71bd99820","user":{"login":"jerrypeng","id":3613359,"avatar_url":"https://avatars.githubusercontent.com/u/3613359?v=3","gravatar_id":"","url":"https://api.github.com/users/jerrypeng","html_url":"https://github.com/jerrypeng","followers_url":"https://api.github.com/users/jerrypeng/followers","following_url":"https://api.github.com/users/jerrypeng/following{/other_user}","gists_url":"https://api.github.com/users/jerrypeng/gists{/gist_id}","starred_url":"https://api.github.com/users/jerrypeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerrypeng/subscriptions","organizations_url":"https://api.github.com/users/jerrypeng/orgs","repos_url":"https://api.github.com/users/jerrypeng/repos","events_url":"https://api.github.com/users/jerrypeng/events{/privacy}","received_events_url":"https://api.github.com/users/jerrypeng/received_events","type":"User","site_admin":false},"body":"ok will change","created_at":"2015-12-16T03:21:22Z","updated_at":"2015-12-16T03:21:22Z","html_url":"https://github.com/apache/storm/pull/921#discussion_r47732871","pull_request_url":"https://api.github.com/repos/apache/storm/pulls/921","_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/comments/47732871"},"html":{"href":"https://github.com/apache/storm/pull/921#discussion_r47732871"},"pull_request":{"href":"https://api.github.com/repos/apache/storm/pulls/921"}}},"pull_request":{"url":"https://api.github.com/repos/apache/storm/pulls/921","id":52622402,"html_url":"https://github.com/apache/storm/pull/921","diff_url":"https://github.com/apache/storm/pull/921.diff","patch_url":"https://github.com/apache/storm/pull/921.patch","issue_url":"https://api.github.com/repos/apache/storm/issues/921","number":921,"state":"open","locked":false,"title":"[STORM-898] - Add priorities and per user resource guarantees to Resource Aware Scheduler","user":{"login":"jerrypeng","id":3613359,"avatar_url":"https://avatars.githubusercontent.com/u/3613359?v=3","gravatar_id":"","url":"https://api.github.com/users/jerrypeng","html_url":"https://github.com/jerrypeng","followers_url":"https://api.github.com/users/jerrypeng/followers","following_url":"https://api.github.com/users/jerrypeng/following{/other_user}","gists_url":"https://api.github.com/users/jerrypeng/gists{/gist_id}","starred_url":"https://api.github.com/users/jerrypeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerrypeng/subscriptions","organizations_url":"https://api.github.com/users/jerrypeng/orgs","repos_url":"https://api.github.com/users/jerrypeng/repos","events_url":"https://api.github.com/users/jerrypeng/events{/privacy}","received_events_url":"https://api.github.com/users/jerrypeng/received_events","type":"User","site_admin":false},"body":"https://issues.apache.org/jira/browse/STORM-898\r\n\r\nAllows the Resource Aware Scheduler to how multi-tenant capabilites. In a multi-tenant environment we would like to be able to give individual users a guarantee of how much CPU/Memory/Network they will be able to use in a cluster. We would also like to know which topologies a user feels are the most important to keep running if there are not enough resources to run all of their topologies.\r\n\r\nEach user should be able to specify if their topology is production, staging, or development.\r\n\r\nBased on topology priorities and resource guarantees, we need to be able to evict topologies that are less important so that users can have there resource guarantees satisfied\r\n\r\nEach topology can also be scheduled by a different strategy.  Users can define custom scheduling strategies and the user can specify on a per topology basis what strategy to use for a topology\r\n\r\nFor more details please read documentation:\r\n\r\nhttps://issues.apache.org/jira/secure/attachment/12775719/Resource%20Aware%20Scheduler%20for%20Storm.pdf\r\n\r\nI have also recently updated the documentation","created_at":"2015-12-04T02:24:51Z","updated_at":"2015-12-16T03:21:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce3437b14ddd5d5f74b2b3e8b8ef3bfe9cfae1d0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/storm/pulls/921/commits","review_comments_url":"https://api.github.com/repos/apache/storm/pulls/921/comments","review_comment_url":"https://api.github.com/repos/apache/storm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/storm/issues/921/comments","statuses_url":"https://api.github.com/repos/apache/storm/statuses/6bde95d8a2aa80b5be33245c61b257460bf3f1c5","head":{"label":"jerrypeng:STORM-898","ref":"STORM-898","sha":"6bde95d8a2aa80b5be33245c61b257460bf3f1c5","user":{"login":"jerrypeng","id":3613359,"avatar_url":"https://avatars.githubusercontent.com/u/3613359?v=3","gravatar_id":"","url":"https://api.github.com/users/jerrypeng","html_url":"https://github.com/jerrypeng","followers_url":"https://api.github.com/users/jerrypeng/followers","following_url":"https://api.github.com/users/jerrypeng/following{/other_user}","gists_url":"https://api.github.com/users/jerrypeng/gists{/gist_id}","starred_url":"https://api.github.com/users/jerrypeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerrypeng/subscriptions","organizations_url":"https://api.github.com/users/jerrypeng/orgs","repos_url":"https://api.github.com/users/jerrypeng/repos","events_url":"https://api.github.com/users/jerrypeng/events{/privacy}","received_events_url":"https://api.github.com/users/jerrypeng/received_events","type":"User","site_admin":false},"repo":{"id":37741458,"name":"storm","full_name":"jerrypeng/storm","owner":{"login":"jerrypeng","id":3613359,"avatar_url":"https://avatars.githubusercontent.com/u/3613359?v=3","gravatar_id":"","url":"https://api.github.com/users/jerrypeng","html_url":"https://github.com/jerrypeng","followers_url":"https://api.github.com/users/jerrypeng/followers","following_url":"https://api.github.com/users/jerrypeng/following{/other_user}","gists_url":"https://api.github.com/users/jerrypeng/gists{/gist_id}","starred_url":"https://api.github.com/users/jerrypeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerrypeng/subscriptions","organizations_url":"https://api.github.com/users/jerrypeng/orgs","repos_url":"https://api.github.com/users/jerrypeng/repos","events_url":"https://api.github.com/users/jerrypeng/events{/privacy}","received_events_url":"https://api.github.com/users/jerrypeng/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jerrypeng/storm","description":"Mirror of Apache Storm","fork":true,"url":"https://api.github.com/repos/jerrypeng/storm","forks_url":"https://api.github.com/repos/jerrypeng/storm/forks","keys_url":"https://api.github.com/repos/jerrypeng/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jerrypeng/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jerrypeng/storm/teams","hooks_url":"https://api.github.com/repos/jerrypeng/storm/hooks","issue_events_url":"https://api.github.com/repos/jerrypeng/storm/issues/events{/number}","events_url":"https://api.github.com/repos/jerrypeng/storm/events","assignees_url":"https://api.github.com/repos/jerrypeng/storm/assignees{/user}","branches_url":"https://api.github.com/repos/jerrypeng/storm/branches{/branch}","tags_url":"https://api.github.com/repos/jerrypeng/storm/tags","blobs_url":"https://api.github.com/repos/jerrypeng/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jerrypeng/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jerrypeng/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/jerrypeng/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jerrypeng/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/jerrypeng/storm/languages","stargazers_url":"https://api.github.com/repos/jerrypeng/storm/stargazers","contributors_url":"https://api.github.com/repos/jerrypeng/storm/contributors","subscribers_url":"https://api.github.com/repos/jerrypeng/storm/subscribers","subscription_url":"https://api.github.com/repos/jerrypeng/storm/subscription","commits_url":"https://api.github.com/repos/jerrypeng/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/jerrypeng/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/jerrypeng/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/jerrypeng/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/jerrypeng/storm/contents/{+path}","compare_url":"https://api.github.com/repos/jerrypeng/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jerrypeng/storm/merges","archive_url":"https://api.github.com/repos/jerrypeng/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jerrypeng/storm/downloads","issues_url":"https://api.github.com/repos/jerrypeng/storm/issues{/number}","pulls_url":"https://api.github.com/repos/jerrypeng/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/jerrypeng/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/jerrypeng/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jerrypeng/storm/labels{/name}","releases_url":"https://api.github.com/repos/jerrypeng/storm/releases{/id}","created_at":"2015-06-19T19:23:06Z","updated_at":"2015-11-23T22:33:09Z","pushed_at":"2015-12-15T23:31:17Z","git_url":"git://github.com/jerrypeng/storm.git","ssh_url":"git@github.com:jerrypeng/storm.git","clone_url":"https://github.com/jerrypeng/storm.git","svn_url":"https://github.com/jerrypeng/storm","homepage":null,"size":26908,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"8b3c20846a026732a15108e49c5f43fcea37674e","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","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":14135470,"name":"storm","full_name":"apache/storm","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","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},"private":false,"html_url":"https://github.com/apache/storm","description":"Mirror of Apache Storm","fork":false,"url":"https://api.github.com/repos/apache/storm","forks_url":"https://api.github.com/repos/apache/storm/forks","keys_url":"https://api.github.com/repos/apache/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/storm/teams","hooks_url":"https://api.github.com/repos/apache/storm/hooks","issue_events_url":"https://api.github.com/repos/apache/storm/issues/events{/number}","events_url":"https://api.github.com/repos/apache/storm/events","assignees_url":"https://api.github.com/repos/apache/storm/assignees{/user}","branches_url":"https://api.github.com/repos/apache/storm/branches{/branch}","tags_url":"https://api.github.com/repos/apache/storm/tags","blobs_url":"https://api.github.com/repos/apache/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/storm/languages","stargazers_url":"https://api.github.com/repos/apache/storm/stargazers","contributors_url":"https://api.github.com/repos/apache/storm/contributors","subscribers_url":"https://api.github.com/repos/apache/storm/subscribers","subscription_url":"https://api.github.com/repos/apache/storm/subscription","commits_url":"https://api.github.com/repos/apache/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/storm/contents/{+path}","compare_url":"https://api.github.com/repos/apache/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/storm/merges","archive_url":"https://api.github.com/repos/apache/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/storm/downloads","issues_url":"https://api.github.com/repos/apache/storm/issues{/number}","pulls_url":"https://api.github.com/repos/apache/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/storm/labels{/name}","releases_url":"https://api.github.com/repos/apache/storm/releases{/id}","created_at":"2013-11-05T08:00:14Z","updated_at":"2015-12-16T02:50:26Z","pushed_at":"2015-12-16T02:39:57Z","git_url":"git://github.com/apache/storm.git","ssh_url":"git@github.com:apache/storm.git","clone_url":"https://github.com/apache/storm.git","svn_url":"https://github.com/apache/storm","homepage":null,"size":155734,"stargazers_count":2641,"watchers_count":2641,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1973,"mirror_url":"git://git.apache.org/storm.git","open_issues_count":90,"forks":1973,"open_issues":90,"watchers":2641,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/921"},"html":{"href":"https://github.com/apache/storm/pull/921"},"issue":{"href":"https://api.github.com/repos/apache/storm/issues/921"},"comments":{"href":"https://api.github.com/repos/apache/storm/issues/921/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/storm/pulls/921/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/storm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/storm/pulls/921/commits"},"statuses":{"href":"https://api.github.com/repos/apache/storm/statuses/6bde95d8a2aa80b5be33245c61b257460bf3f1c5"}}}}