{"action":"created","comment":{"url":"https://api.github.com/repos/jupyter/jupyter_client/pulls/comments/241904569","pull_request_review_id":185302499,"id":241904569,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MTkwNDU2OQ==","diff_hunk":"@@ -454,6 +454,19 @@ def is_alive(self):\n             # we don't have a kernel\n             return False\n \n+    def memory_usage(self):\n+        \"\"\"\n+        Returns memory usage of the kernel in MB.\n+        Function should be overwritten if there is a\n+        need for a different kind of ram check, hence the import of the\n+        'psutil' package is inside the memory usage function\n+        \"\"\"\n+        from psutil import Process\n+        kernel_pid = self.kernel.pid\n+        process = Process(kernel_pid)\n+        mem = process.memory_info().vms  # in bytes\n+        return int(mem / 1024**2)  # in MB\n+","path":"jupyter_client/manager.py","position":16,"original_position":16,"commit_id":"81265086f196ebfa168f4f8dbe020a117ca3157c","original_commit_id":"81265086f196ebfa168f4f8dbe020a117ca3157c","user":{"login":"rgbkrk","id":836375,"node_id":"MDQ6VXNlcjgzNjM3NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/836375?v=4","gravatar_id":"","url":"https://api.github.com/users/rgbkrk","html_url":"https://github.com/rgbkrk","followers_url":"https://api.github.com/users/rgbkrk/followers","following_url":"https://api.github.com/users/rgbkrk/following{/other_user}","gists_url":"https://api.github.com/users/rgbkrk/gists{/gist_id}","starred_url":"https://api.github.com/users/rgbkrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgbkrk/subscriptions","organizations_url":"https://api.github.com/users/rgbkrk/orgs","repos_url":"https://api.github.com/users/rgbkrk/repos","events_url":"https://api.github.com/users/rgbkrk/events{/privacy}","received_events_url":"https://api.github.com/users/rgbkrk/received_events","type":"User","site_admin":false},"body":"I'm definitely cool with this for a start.","created_at":"2018-12-14T22:05:24Z","updated_at":"2018-12-14T22:05:29Z","html_url":"https://github.com/jupyter/jupyter_client/pull/407#discussion_r241904569","pull_request_url":"https://api.github.com/repos/jupyter/jupyter_client/pulls/407","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/jupyter/jupyter_client/pulls/comments/241904569"},"html":{"href":"https://github.com/jupyter/jupyter_client/pull/407#discussion_r241904569"},"pull_request":{"href":"https://api.github.com/repos/jupyter/jupyter_client/pulls/407"}}},"pull_request":{"url":"https://api.github.com/repos/jupyter/jupyter_client/pulls/407","id":234053895,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0MDUzODk1","html_url":"https://github.com/jupyter/jupyter_client/pull/407","diff_url":"https://github.com/jupyter/jupyter_client/pull/407.diff","patch_url":"https://github.com/jupyter/jupyter_client/pull/407.patch","issue_url":"https://api.github.com/repos/jupyter/jupyter_client/issues/407","number":407,"state":"open","locked":false,"title":"Add method for kernel manager for checking ram.","user":{"login":"Hyaxia","id":36747317,"node_id":"MDQ6VXNlcjM2NzQ3MzE3","avatar_url":"https://avatars3.githubusercontent.com/u/36747317?v=4","gravatar_id":"","url":"https://api.github.com/users/Hyaxia","html_url":"https://github.com/Hyaxia","followers_url":"https://api.github.com/users/Hyaxia/followers","following_url":"https://api.github.com/users/Hyaxia/following{/other_user}","gists_url":"https://api.github.com/users/Hyaxia/gists{/gist_id}","starred_url":"https://api.github.com/users/Hyaxia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hyaxia/subscriptions","organizations_url":"https://api.github.com/users/Hyaxia/orgs","repos_url":"https://api.github.com/users/Hyaxia/repos","events_url":"https://api.github.com/users/Hyaxia/events{/privacy}","received_events_url":"https://api.github.com/users/Hyaxia/received_events","type":"User","site_admin":false},"body":"A new method called 'memory_usage' that checks the kernel ram usage\r\n*locally*.\r\n\r\nAdded a test for the method and inserted the psutil package (definitely not sure if its a good test, there might a better check to perform)\r\nas a new dependency for the project.\r\n\r\nBackground:\r\nThe reason i want to add this method to the kernel manager is that in the notebook project we \r\nwanted to create a functionality that lets us query the ram usage of the usage of the kernels \r\nthat are active.\r\nIn the PR https://github.com/jupyter/notebook/pull/4075 it has been brought to my attention that implementing it in notebook will break\r\napplications that use the kernels remotely.\r\n\r\nFor that reason I have implemented the method for checking the ram the way I did,\r\nimporting the package 'psutil' inside the method so if the implementation is swapped out\r\nand wont be using the package anymore, it wont bother anyone.","created_at":"2018-11-27T20:44:05Z","updated_at":"2018-12-14T22:05:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9b04ba099870108a3f38a39f357b7c5d9c0e661d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/jupyter/jupyter_client/pulls/407/commits","review_comments_url":"https://api.github.com/repos/jupyter/jupyter_client/pulls/407/comments","review_comment_url":"https://api.github.com/repos/jupyter/jupyter_client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jupyter/jupyter_client/issues/407/comments","statuses_url":"https://api.github.com/repos/jupyter/jupyter_client/statuses/81265086f196ebfa168f4f8dbe020a117ca3157c","head":{"label":"Hyaxia:master","ref":"master","sha":"81265086f196ebfa168f4f8dbe020a117ca3157c","user":{"login":"Hyaxia","id":36747317,"node_id":"MDQ6VXNlcjM2NzQ3MzE3","avatar_url":"https://avatars3.githubusercontent.com/u/36747317?v=4","gravatar_id":"","url":"https://api.github.com/users/Hyaxia","html_url":"https://github.com/Hyaxia","followers_url":"https://api.github.com/users/Hyaxia/followers","following_url":"https://api.github.com/users/Hyaxia/following{/other_user}","gists_url":"https://api.github.com/users/Hyaxia/gists{/gist_id}","starred_url":"https://api.github.com/users/Hyaxia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hyaxia/subscriptions","organizations_url":"https://api.github.com/users/Hyaxia/orgs","repos_url":"https://api.github.com/users/Hyaxia/repos","events_url":"https://api.github.com/users/Hyaxia/events{/privacy}","received_events_url":"https://api.github.com/users/Hyaxia/received_events","type":"User","site_admin":false},"repo":{"id":159386872,"node_id":"MDEwOlJlcG9zaXRvcnkxNTkzODY4NzI=","name":"jupyter_client","full_name":"Hyaxia/jupyter_client","private":false,"owner":{"login":"Hyaxia","id":36747317,"node_id":"MDQ6VXNlcjM2NzQ3MzE3","avatar_url":"https://avatars3.githubusercontent.com/u/36747317?v=4","gravatar_id":"","url":"https://api.github.com/users/Hyaxia","html_url":"https://github.com/Hyaxia","followers_url":"https://api.github.com/users/Hyaxia/followers","following_url":"https://api.github.com/users/Hyaxia/following{/other_user}","gists_url":"https://api.github.com/users/Hyaxia/gists{/gist_id}","starred_url":"https://api.github.com/users/Hyaxia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hyaxia/subscriptions","organizations_url":"https://api.github.com/users/Hyaxia/orgs","repos_url":"https://api.github.com/users/Hyaxia/repos","events_url":"https://api.github.com/users/Hyaxia/events{/privacy}","received_events_url":"https://api.github.com/users/Hyaxia/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Hyaxia/jupyter_client","description":"Jupyter protocol client APIs","fork":true,"url":"https://api.github.com/repos/Hyaxia/jupyter_client","forks_url":"https://api.github.com/repos/Hyaxia/jupyter_client/forks","keys_url":"https://api.github.com/repos/Hyaxia/jupyter_client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Hyaxia/jupyter_client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Hyaxia/jupyter_client/teams","hooks_url":"https://api.github.com/repos/Hyaxia/jupyter_client/hooks","issue_events_url":"https://api.github.com/repos/Hyaxia/jupyter_client/issues/events{/number}","events_url":"https://api.github.com/repos/Hyaxia/jupyter_client/events","assignees_url":"https://api.github.com/repos/Hyaxia/jupyter_client/assignees{/user}","branches_url":"https://api.github.com/repos/Hyaxia/jupyter_client/branches{/branch}","tags_url":"https://api.github.com/repos/Hyaxia/jupyter_client/tags","blobs_url":"https://api.github.com/repos/Hyaxia/jupyter_client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Hyaxia/jupyter_client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Hyaxia/jupyter_client/git/refs{/sha}","trees_url":"https://api.github.com/repos/Hyaxia/jupyter_client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Hyaxia/jupyter_client/statuses/{sha}","languages_url":"https://api.github.com/repos/Hyaxia/jupyter_client/languages","stargazers_url":"https://api.github.com/repos/Hyaxia/jupyter_client/stargazers","contributors_url":"https://api.github.com/repos/Hyaxia/jupyter_client/contributors","subscribers_url":"https://api.github.com/repos/Hyaxia/jupyter_client/subscribers","subscription_url":"https://api.github.com/repos/Hyaxia/jupyter_client/subscription","commits_url":"https://api.github.com/repos/Hyaxia/jupyter_client/commits{/sha}","git_commits_url":"https://api.github.com/repos/Hyaxia/jupyter_client/git/commits{/sha}","comments_url":"https://api.github.com/repos/Hyaxia/jupyter_client/comments{/number}","issue_comment_url":"https://api.github.com/repos/Hyaxia/jupyter_client/issues/comments{/number}","contents_url":"https://api.github.com/repos/Hyaxia/jupyter_client/contents/{+path}","compare_url":"https://api.github.com/repos/Hyaxia/jupyter_client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Hyaxia/jupyter_client/merges","archive_url":"https://api.github.com/repos/Hyaxia/jupyter_client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Hyaxia/jupyter_client/downloads","issues_url":"https://api.github.com/repos/Hyaxia/jupyter_client/issues{/number}","pulls_url":"https://api.github.com/repos/Hyaxia/jupyter_client/pulls{/number}","milestones_url":"https://api.github.com/repos/Hyaxia/jupyter_client/milestones{/number}","notifications_url":"https://api.github.com/repos/Hyaxia/jupyter_client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Hyaxia/jupyter_client/labels{/name}","releases_url":"https://api.github.com/repos/Hyaxia/jupyter_client/releases{/id}","deployments_url":"https://api.github.com/repos/Hyaxia/jupyter_client/deployments","created_at":"2018-11-27T19:18:07Z","updated_at":"2018-11-27T20:50:46Z","pushed_at":"2018-11-27T20:50:44Z","git_url":"git://github.com/Hyaxia/jupyter_client.git","ssh_url":"git@github.com:Hyaxia/jupyter_client.git","clone_url":"https://github.com/Hyaxia/jupyter_client.git","svn_url":"https://github.com/Hyaxia/jupyter_client","homepage":"https://jupyter-client.readthedocs.io","size":1490,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jupyter:master","ref":"master","sha":"50ddc227e0baa9be5e4302621624545e59f4bfa6","user":{"login":"jupyter","id":7388996,"node_id":"MDEyOk9yZ2FuaXphdGlvbjczODg5OTY=","avatar_url":"https://avatars1.githubusercontent.com/u/7388996?v=4","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"repo":{"id":33653575,"node_id":"MDEwOlJlcG9zaXRvcnkzMzY1MzU3NQ==","name":"jupyter_client","full_name":"jupyter/jupyter_client","private":false,"owner":{"login":"jupyter","id":7388996,"node_id":"MDEyOk9yZ2FuaXphdGlvbjczODg5OTY=","avatar_url":"https://avatars1.githubusercontent.com/u/7388996?v=4","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/jupyter/jupyter_client","description":"Jupyter protocol client APIs","fork":false,"url":"https://api.github.com/repos/jupyter/jupyter_client","forks_url":"https://api.github.com/repos/jupyter/jupyter_client/forks","keys_url":"https://api.github.com/repos/jupyter/jupyter_client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jupyter/jupyter_client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jupyter/jupyter_client/teams","hooks_url":"https://api.github.com/repos/jupyter/jupyter_client/hooks","issue_events_url":"https://api.github.com/repos/jupyter/jupyter_client/issues/events{/number}","events_url":"https://api.github.com/repos/jupyter/jupyter_client/events","assignees_url":"https://api.github.com/repos/jupyter/jupyter_client/assignees{/user}","branches_url":"https://api.github.com/repos/jupyter/jupyter_client/branches{/branch}","tags_url":"https://api.github.com/repos/jupyter/jupyter_client/tags","blobs_url":"https://api.github.com/repos/jupyter/jupyter_client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jupyter/jupyter_client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jupyter/jupyter_client/git/refs{/sha}","trees_url":"https://api.github.com/repos/jupyter/jupyter_client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jupyter/jupyter_client/statuses/{sha}","languages_url":"https://api.github.com/repos/jupyter/jupyter_client/languages","stargazers_url":"https://api.github.com/repos/jupyter/jupyter_client/stargazers","contributors_url":"https://api.github.com/repos/jupyter/jupyter_client/contributors","subscribers_url":"https://api.github.com/repos/jupyter/jupyter_client/subscribers","subscription_url":"https://api.github.com/repos/jupyter/jupyter_client/subscription","commits_url":"https://api.github.com/repos/jupyter/jupyter_client/commits{/sha}","git_commits_url":"https://api.github.com/repos/jupyter/jupyter_client/git/commits{/sha}","comments_url":"https://api.github.com/repos/jupyter/jupyter_client/comments{/number}","issue_comment_url":"https://api.github.com/repos/jupyter/jupyter_client/issues/comments{/number}","contents_url":"https://api.github.com/repos/jupyter/jupyter_client/contents/{+path}","compare_url":"https://api.github.com/repos/jupyter/jupyter_client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jupyter/jupyter_client/merges","archive_url":"https://api.github.com/repos/jupyter/jupyter_client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jupyter/jupyter_client/downloads","issues_url":"https://api.github.com/repos/jupyter/jupyter_client/issues{/number}","pulls_url":"https://api.github.com/repos/jupyter/jupyter_client/pulls{/number}","milestones_url":"https://api.github.com/repos/jupyter/jupyter_client/milestones{/number}","notifications_url":"https://api.github.com/repos/jupyter/jupyter_client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jupyter/jupyter_client/labels{/name}","releases_url":"https://api.github.com/repos/jupyter/jupyter_client/releases{/id}","deployments_url":"https://api.github.com/repos/jupyter/jupyter_client/deployments","created_at":"2015-04-09T06:57:29Z","updated_at":"2018-12-12T23:33:21Z","pushed_at":"2018-12-10T20:55:40Z","git_url":"git://github.com/jupyter/jupyter_client.git","ssh_url":"git@github.com:jupyter/jupyter_client.git","clone_url":"https://github.com/jupyter/jupyter_client.git","svn_url":"https://github.com/jupyter/jupyter_client","homepage":"https://jupyter-client.readthedocs.io","size":1494,"stargazers_count":115,"watchers_count":115,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":134,"mirror_url":null,"archived":false,"open_issues_count":87,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":134,"open_issues":87,"watchers":115,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jupyter/jupyter_client/pulls/407"},"html":{"href":"https://github.com/jupyter/jupyter_client/pull/407"},"issue":{"href":"https://api.github.com/repos/jupyter/jupyter_client/issues/407"},"comments":{"href":"https://api.github.com/repos/jupyter/jupyter_client/issues/407/comments"},"review_comments":{"href":"https://api.github.com/repos/jupyter/jupyter_client/pulls/407/comments"},"review_comment":{"href":"https://api.github.com/repos/jupyter/jupyter_client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jupyter/jupyter_client/pulls/407/commits"},"statuses":{"href":"https://api.github.com/repos/jupyter/jupyter_client/statuses/81265086f196ebfa168f4f8dbe020a117ca3157c"}},"author_association":"NONE"}}
{"actor":{"display_login":"rgbkrk"}}