{"action":"created","comment":{"url":"https://api.github.com/repos/FNNDSC/pman/pulls/comments/211929653","pull_request_review_id":148451394,"id":211929653,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMTkyOTY1Mw==","diff_hunk":"@@ -0,0 +1,79 @@\n+import yaml\n+import json\n+import os\n+from kubernetes import client as k_client, config\n+import time, datetime\n+from kubernetes.client.rest import ApiException\n+\n+class Reaper(object):\n+    def __init__(self,project=None):\n+        self.kube_client = None\n+        self.kube_v1_batch_client = None\n+        self.project = project or os.environ.get('OPENSHIFTMGR_PROJECT') or 'myproject'\n+        self.kube_v1_delete = None\n+        self.age = os.environ.get('AGE') or '1'\n+        self.age = int(self.age)\n+\n+        # init the openshift client\n+        self.init_openshift_client()\n+\n+    def init_openshift_client(self):\n+        \"\"\"\n+        Method to get a OpenShift client connected to remote or local OpenShift\n+        \"\"\"\n+        kubecfg_path = os.environ.get('KUBECFG_PATH')\n+        if kubecfg_path is None:\n+            config.load_kube_config()\n+        else:\n+            config.load_kube_config(config_file='/tmp/.kube/config') \n+        self.kube_client = k_client.CoreV1Api()\n+        self.kube_v1_batch_client = k_client.BatchV1Api()\n+        self.kube_v1_delete = k_client.V1DeleteOptions()\n+\n+    def get_jobs_for_reaper(self, age=1):\n+        \"\"\"\n+        Get all previously scheduled jobs for the name space that are older than a day for reaper to kill them\n+        name : <String> project namespace\n+        age  : <int>    time elaspsed from start of job in days\n+        \"\"\"\n+        jobs_for_reaper = []\n+       ","path":"openshift/pman-reaper/reaper.py","position":40,"original_position":40,"commit_id":"6f234d1049fca96701df1eca51251cbd899a0546","original_commit_id":"6f234d1049fca96701df1eca51251cbd899a0546","user":{"login":"danmcp","id":492994,"node_id":"MDQ6VXNlcjQ5Mjk5NA==","avatar_url":"https://avatars0.githubusercontent.com/u/492994?v=4","gravatar_id":"","url":"https://api.github.com/users/danmcp","html_url":"https://github.com/danmcp","followers_url":"https://api.github.com/users/danmcp/followers","following_url":"https://api.github.com/users/danmcp/following{/other_user}","gists_url":"https://api.github.com/users/danmcp/gists{/gist_id}","starred_url":"https://api.github.com/users/danmcp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danmcp/subscriptions","organizations_url":"https://api.github.com/users/danmcp/orgs","repos_url":"https://api.github.com/users/danmcp/repos","events_url":"https://api.github.com/users/danmcp/events{/privacy}","received_events_url":"https://api.github.com/users/danmcp/received_events","type":"User","site_admin":false},"body":"remove extra tab","created_at":"2018-08-22T12:09:18Z","updated_at":"2018-08-22T12:09:18Z","html_url":"https://github.com/FNNDSC/pman/pull/98#discussion_r211929653","pull_request_url":"https://api.github.com/repos/FNNDSC/pman/pulls/98","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/FNNDSC/pman/pulls/comments/211929653"},"html":{"href":"https://github.com/FNNDSC/pman/pull/98#discussion_r211929653"},"pull_request":{"href":"https://api.github.com/repos/FNNDSC/pman/pulls/98"}}},"pull_request":{"url":"https://api.github.com/repos/FNNDSC/pman/pulls/98","id":206448467,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2NDQ4NDY3","html_url":"https://github.com/FNNDSC/pman/pull/98","diff_url":"https://github.com/FNNDSC/pman/pull/98.diff","patch_url":"https://github.com/FNNDSC/pman/pull/98.patch","issue_url":"https://api.github.com/repos/FNNDSC/pman/issues/98","number":98,"state":"open","locked":false,"title":"[Do Not Merge] Adding reaper module to pman for deleting aged jobs","user":{"login":"husky-parul","id":24639524,"node_id":"MDQ6VXNlcjI0NjM5NTI0","avatar_url":"https://avatars0.githubusercontent.com/u/24639524?v=4","gravatar_id":"","url":"https://api.github.com/users/husky-parul","html_url":"https://github.com/husky-parul","followers_url":"https://api.github.com/users/husky-parul/followers","following_url":"https://api.github.com/users/husky-parul/following{/other_user}","gists_url":"https://api.github.com/users/husky-parul/gists{/gist_id}","starred_url":"https://api.github.com/users/husky-parul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/husky-parul/subscriptions","organizations_url":"https://api.github.com/users/husky-parul/orgs","repos_url":"https://api.github.com/users/husky-parul/repos","events_url":"https://api.github.com/users/husky-parul/events{/privacy}","received_events_url":"https://api.github.com/users/husky-parul/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-06T16:12:51Z","updated_at":"2018-08-22T12:09:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7fc18a146ae75c6cdb884a62dafca22fd8711687","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/FNNDSC/pman/pulls/98/commits","review_comments_url":"https://api.github.com/repos/FNNDSC/pman/pulls/98/comments","review_comment_url":"https://api.github.com/repos/FNNDSC/pman/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FNNDSC/pman/issues/98/comments","statuses_url":"https://api.github.com/repos/FNNDSC/pman/statuses/6f234d1049fca96701df1eca51251cbd899a0546","head":{"label":"husky-parul:scaling-pman","ref":"scaling-pman","sha":"6f234d1049fca96701df1eca51251cbd899a0546","user":{"login":"husky-parul","id":24639524,"node_id":"MDQ6VXNlcjI0NjM5NTI0","avatar_url":"https://avatars0.githubusercontent.com/u/24639524?v=4","gravatar_id":"","url":"https://api.github.com/users/husky-parul","html_url":"https://github.com/husky-parul","followers_url":"https://api.github.com/users/husky-parul/followers","following_url":"https://api.github.com/users/husky-parul/following{/other_user}","gists_url":"https://api.github.com/users/husky-parul/gists{/gist_id}","starred_url":"https://api.github.com/users/husky-parul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/husky-parul/subscriptions","organizations_url":"https://api.github.com/users/husky-parul/orgs","repos_url":"https://api.github.com/users/husky-parul/repos","events_url":"https://api.github.com/users/husky-parul/events{/privacy}","received_events_url":"https://api.github.com/users/husky-parul/received_events","type":"User","site_admin":false},"repo":{"id":130170239,"node_id":"MDEwOlJlcG9zaXRvcnkxMzAxNzAyMzk=","name":"pman","full_name":"husky-parul/pman","owner":{"login":"husky-parul","id":24639524,"node_id":"MDQ6VXNlcjI0NjM5NTI0","avatar_url":"https://avatars0.githubusercontent.com/u/24639524?v=4","gravatar_id":"","url":"https://api.github.com/users/husky-parul","html_url":"https://github.com/husky-parul","followers_url":"https://api.github.com/users/husky-parul/followers","following_url":"https://api.github.com/users/husky-parul/following{/other_user}","gists_url":"https://api.github.com/users/husky-parul/gists{/gist_id}","starred_url":"https://api.github.com/users/husky-parul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/husky-parul/subscriptions","organizations_url":"https://api.github.com/users/husky-parul/orgs","repos_url":"https://api.github.com/users/husky-parul/repos","events_url":"https://api.github.com/users/husky-parul/events{/privacy}","received_events_url":"https://api.github.com/users/husky-parul/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/husky-parul/pman","description":"A process management system written in python.","fork":true,"url":"https://api.github.com/repos/husky-parul/pman","forks_url":"https://api.github.com/repos/husky-parul/pman/forks","keys_url":"https://api.github.com/repos/husky-parul/pman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/husky-parul/pman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/husky-parul/pman/teams","hooks_url":"https://api.github.com/repos/husky-parul/pman/hooks","issue_events_url":"https://api.github.com/repos/husky-parul/pman/issues/events{/number}","events_url":"https://api.github.com/repos/husky-parul/pman/events","assignees_url":"https://api.github.com/repos/husky-parul/pman/assignees{/user}","branches_url":"https://api.github.com/repos/husky-parul/pman/branches{/branch}","tags_url":"https://api.github.com/repos/husky-parul/pman/tags","blobs_url":"https://api.github.com/repos/husky-parul/pman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/husky-parul/pman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/husky-parul/pman/git/refs{/sha}","trees_url":"https://api.github.com/repos/husky-parul/pman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/husky-parul/pman/statuses/{sha}","languages_url":"https://api.github.com/repos/husky-parul/pman/languages","stargazers_url":"https://api.github.com/repos/husky-parul/pman/stargazers","contributors_url":"https://api.github.com/repos/husky-parul/pman/contributors","subscribers_url":"https://api.github.com/repos/husky-parul/pman/subscribers","subscription_url":"https://api.github.com/repos/husky-parul/pman/subscription","commits_url":"https://api.github.com/repos/husky-parul/pman/commits{/sha}","git_commits_url":"https://api.github.com/repos/husky-parul/pman/git/commits{/sha}","comments_url":"https://api.github.com/repos/husky-parul/pman/comments{/number}","issue_comment_url":"https://api.github.com/repos/husky-parul/pman/issues/comments{/number}","contents_url":"https://api.github.com/repos/husky-parul/pman/contents/{+path}","compare_url":"https://api.github.com/repos/husky-parul/pman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/husky-parul/pman/merges","archive_url":"https://api.github.com/repos/husky-parul/pman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/husky-parul/pman/downloads","issues_url":"https://api.github.com/repos/husky-parul/pman/issues{/number}","pulls_url":"https://api.github.com/repos/husky-parul/pman/pulls{/number}","milestones_url":"https://api.github.com/repos/husky-parul/pman/milestones{/number}","notifications_url":"https://api.github.com/repos/husky-parul/pman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/husky-parul/pman/labels{/name}","releases_url":"https://api.github.com/repos/husky-parul/pman/releases{/id}","deployments_url":"https://api.github.com/repos/husky-parul/pman/deployments","created_at":"2018-04-19T06:40:03Z","updated_at":"2018-07-25T15:04:48Z","pushed_at":"2018-08-21T21:57:47Z","git_url":"git://github.com/husky-parul/pman.git","ssh_url":"git@github.com:husky-parul/pman.git","clone_url":"https://github.com/husky-parul/pman.git","svn_url":"https://github.com/husky-parul/pman","homepage":null,"size":658,"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":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"FNNDSC:master","ref":"master","sha":"7221e2c4ddfa72a650aedc8744378493b7233c29","user":{"login":"FNNDSC","id":1093496,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwOTM0OTY=","avatar_url":"https://avatars0.githubusercontent.com/u/1093496?v=4","gravatar_id":"","url":"https://api.github.com/users/FNNDSC","html_url":"https://github.com/FNNDSC","followers_url":"https://api.github.com/users/FNNDSC/followers","following_url":"https://api.github.com/users/FNNDSC/following{/other_user}","gists_url":"https://api.github.com/users/FNNDSC/gists{/gist_id}","starred_url":"https://api.github.com/users/FNNDSC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FNNDSC/subscriptions","organizations_url":"https://api.github.com/users/FNNDSC/orgs","repos_url":"https://api.github.com/users/FNNDSC/repos","events_url":"https://api.github.com/users/FNNDSC/events{/privacy}","received_events_url":"https://api.github.com/users/FNNDSC/received_events","type":"Organization","site_admin":false},"repo":{"id":61242281,"node_id":"MDEwOlJlcG9zaXRvcnk2MTI0MjI4MQ==","name":"pman","full_name":"FNNDSC/pman","owner":{"login":"FNNDSC","id":1093496,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwOTM0OTY=","avatar_url":"https://avatars0.githubusercontent.com/u/1093496?v=4","gravatar_id":"","url":"https://api.github.com/users/FNNDSC","html_url":"https://github.com/FNNDSC","followers_url":"https://api.github.com/users/FNNDSC/followers","following_url":"https://api.github.com/users/FNNDSC/following{/other_user}","gists_url":"https://api.github.com/users/FNNDSC/gists{/gist_id}","starred_url":"https://api.github.com/users/FNNDSC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FNNDSC/subscriptions","organizations_url":"https://api.github.com/users/FNNDSC/orgs","repos_url":"https://api.github.com/users/FNNDSC/repos","events_url":"https://api.github.com/users/FNNDSC/events{/privacy}","received_events_url":"https://api.github.com/users/FNNDSC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FNNDSC/pman","description":"A process management system written in python.","fork":false,"url":"https://api.github.com/repos/FNNDSC/pman","forks_url":"https://api.github.com/repos/FNNDSC/pman/forks","keys_url":"https://api.github.com/repos/FNNDSC/pman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FNNDSC/pman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FNNDSC/pman/teams","hooks_url":"https://api.github.com/repos/FNNDSC/pman/hooks","issue_events_url":"https://api.github.com/repos/FNNDSC/pman/issues/events{/number}","events_url":"https://api.github.com/repos/FNNDSC/pman/events","assignees_url":"https://api.github.com/repos/FNNDSC/pman/assignees{/user}","branches_url":"https://api.github.com/repos/FNNDSC/pman/branches{/branch}","tags_url":"https://api.github.com/repos/FNNDSC/pman/tags","blobs_url":"https://api.github.com/repos/FNNDSC/pman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FNNDSC/pman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FNNDSC/pman/git/refs{/sha}","trees_url":"https://api.github.com/repos/FNNDSC/pman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FNNDSC/pman/statuses/{sha}","languages_url":"https://api.github.com/repos/FNNDSC/pman/languages","stargazers_url":"https://api.github.com/repos/FNNDSC/pman/stargazers","contributors_url":"https://api.github.com/repos/FNNDSC/pman/contributors","subscribers_url":"https://api.github.com/repos/FNNDSC/pman/subscribers","subscription_url":"https://api.github.com/repos/FNNDSC/pman/subscription","commits_url":"https://api.github.com/repos/FNNDSC/pman/commits{/sha}","git_commits_url":"https://api.github.com/repos/FNNDSC/pman/git/commits{/sha}","comments_url":"https://api.github.com/repos/FNNDSC/pman/comments{/number}","issue_comment_url":"https://api.github.com/repos/FNNDSC/pman/issues/comments{/number}","contents_url":"https://api.github.com/repos/FNNDSC/pman/contents/{+path}","compare_url":"https://api.github.com/repos/FNNDSC/pman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FNNDSC/pman/merges","archive_url":"https://api.github.com/repos/FNNDSC/pman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FNNDSC/pman/downloads","issues_url":"https://api.github.com/repos/FNNDSC/pman/issues{/number}","pulls_url":"https://api.github.com/repos/FNNDSC/pman/pulls{/number}","milestones_url":"https://api.github.com/repos/FNNDSC/pman/milestones{/number}","notifications_url":"https://api.github.com/repos/FNNDSC/pman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FNNDSC/pman/labels{/name}","releases_url":"https://api.github.com/repos/FNNDSC/pman/releases{/id}","deployments_url":"https://api.github.com/repos/FNNDSC/pman/deployments","created_at":"2016-06-15T21:30:56Z","updated_at":"2018-07-25T23:45:21Z","pushed_at":"2018-08-21T21:57:48Z","git_url":"git://github.com/FNNDSC/pman.git","ssh_url":"git@github.com:FNNDSC/pman.git","clone_url":"https://github.com/FNNDSC/pman.git","svn_url":"https://github.com/FNNDSC/pman","homepage":null,"size":655,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":14,"open_issues":16,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FNNDSC/pman/pulls/98"},"html":{"href":"https://github.com/FNNDSC/pman/pull/98"},"issue":{"href":"https://api.github.com/repos/FNNDSC/pman/issues/98"},"comments":{"href":"https://api.github.com/repos/FNNDSC/pman/issues/98/comments"},"review_comments":{"href":"https://api.github.com/repos/FNNDSC/pman/pulls/98/comments"},"review_comment":{"href":"https://api.github.com/repos/FNNDSC/pman/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FNNDSC/pman/pulls/98/commits"},"statuses":{"href":"https://api.github.com/repos/FNNDSC/pman/statuses/6f234d1049fca96701df1eca51251cbd899a0546"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"danmcp"}}