{"action":"created","comment":{"url":"https://api.github.com/repos/jupyter/jupyter_client/pulls/comments/242243253","pull_request_review_id":185708972,"id":242243253,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MjI0MzI1Mw==","diff_hunk":"@@ -128,10 +128,25 @@ def test_start_new_kernel(self):\n         self.assertTrue(km.is_alive())\n         self.assertTrue(kc.is_alive())\n \n+    def test_kernel_stats(self):\n+        c = Config()\n+        km = KernelManager(config=c)\n+        km.start_kernel(stdout=PIPE, stderr=PIPE)\n+        ks = km.kernel_stats\n+        # Has to be a dict\n+        assert type(ks) is dict\n+        # All keys must be a callable function\n+        if sys.version_info[:2] == (2, 7):  # version 2.7\n+            for _, func in ks.iteritems():\n+                assert callable(func)\n+        else:\n+            for _, func in ks.items():  # versions > 3.4\n+                assert callable(func)\n+\n     def test_memory_usage(self):\n         c = Config()\n         km = KernelManager(config=c)\n         km.start_kernel(stdout=PIPE, stderr=PIPE)\n-        mem = km.memory_usage()\n+        mem = km._memory_usage()","path":"jupyter_client/tests/test_kernelmanager.py","position":25,"original_position":24,"commit_id":"dfd7543285ef4817817e164fa371fa1c6cecd90e","original_commit_id":"3c7eac1531bc939d99f768465dc0dd8f0c3916e1","user":{"login":"kevin-bates","id":22599560,"node_id":"MDQ6VXNlcjIyNTk5NTYw","avatar_url":"https://avatars0.githubusercontent.com/u/22599560?v=4","gravatar_id":"","url":"https://api.github.com/users/kevin-bates","html_url":"https://github.com/kevin-bates","followers_url":"https://api.github.com/users/kevin-bates/followers","following_url":"https://api.github.com/users/kevin-bates/following{/other_user}","gists_url":"https://api.github.com/users/kevin-bates/gists{/gist_id}","starred_url":"https://api.github.com/users/kevin-bates/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevin-bates/subscriptions","organizations_url":"https://api.github.com/users/kevin-bates/orgs","repos_url":"https://api.github.com/users/kevin-bates/repos","events_url":"https://api.github.com/users/kevin-bates/events{/privacy}","received_events_url":"https://api.github.com/users/kevin-bates/received_events","type":"User","site_admin":false},"body":"Since `_memory_usage()` is a private method, I would thing just testing `kernel_stats()` is sufficient.","created_at":"2018-12-17T17:30:01Z","updated_at":"2018-12-17T17:44:56Z","html_url":"https://github.com/jupyter/jupyter_client/pull/407#discussion_r242243253","pull_request_url":"https://api.github.com/repos/jupyter/jupyter_client/pulls/407","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/jupyter/jupyter_client/pulls/comments/242243253"},"html":{"href":"https://github.com/jupyter/jupyter_client/pull/407#discussion_r242243253"},"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":"[Work-In-Progress]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-17T17:44:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cf3ce256d04d0e16464f8435990b7d6c861d83dd","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/dfd7543285ef4817817e164fa371fa1c6cecd90e","head":{"label":"Hyaxia:master","ref":"master","sha":"dfd7543285ef4817817e164fa371fa1c6cecd90e","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-12-16T16:10:48Z","pushed_at":"2018-12-16T16:10:46Z","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":1496,"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":"1d807c285ed2ba2c1c05527d21bbe70e16026e3f","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-16T16:10:47Z","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":135,"mirror_url":null,"archived":false,"open_issues_count":87,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":135,"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/dfd7543285ef4817817e164fa371fa1c6cecd90e"}},"author_association":"NONE"}}
{"actor":{"display_login":"kevin-bates"}}