{"action":"created","comment":{"url":"https://api.github.com/repos/elifesciences/elife-bot/pulls/comments/228174131","pull_request_review_id":168382936,"id":228174131,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyODE3NDEzMQ==","diff_hunk":"@@ -0,0 +1,130 @@\n+import os\n+import json\n+import time\n+from S3utility.s3_notification_info import parse_activity_data\n+import provider.digest_provider as digest_provider\n+import provider.email_provider as email_provider\n+from .activity import Activity\n+\n+\n+class activity_ValidateDigestInput(Activity):\n+    \"ValidateDigestInput activity\"\n+    def __init__(self, settings, logger, conn=None, token=None, activity_task=None):\n+        super(activity_ValidateDigestInput, self).__init__(\n+            settings, logger, conn, token, activity_task)\n+\n+        self.name = \"ValidateDigestInput\"\n+        self.version = \"1\"\n+        self.default_task_heartbeat_timeout = 30\n+        self.default_task_schedule_to_close_timeout = 60 * 30\n+        self.default_task_schedule_to_start_timeout = 30\n+        self.default_task_start_to_close_timeout = 60 * 5\n+        self.description = (\"Download digest file input from the bucket, parse it, check for \" +\n+                            \"valid data, and raise an error if it is invalid.\")\n+\n+        # Track some values\n+        self.input_file = None\n+        self.digest = None\n+\n+        # Local directory settings\n+        self.temp_dir = os.path.join(self.get_tmp_dir(), \"tmp_dir\")\n+        self.input_dir = os.path.join(self.get_tmp_dir(), \"input_dir\")\n+\n+        # Create output directories\n+        self.create_activity_directories()\n+\n+        # Track the success of some steps\n+        self.statuses = {\n+            \"build\": None,\n+            \"valid\": None,\n+            \"email\": None\n+        }\n+\n+        # Load the config\n+        self.digest_config = digest_provider.digest_config(\n+            self.settings.digest_config_section,\n+            self.settings.digest_config_file)\n+\n+    def do_activity(self, data=None):\n+        \"\"\"\n+        Activity, do the work\n+        \"\"\"\n+        if self.logger:\n+            self.logger.info('data: %s' % json.dumps(data, sort_keys=True, indent=4))\n+\n+        # parse the data with the digest_provider\n+        real_filename, bucket_name, bucket_folder = parse_activity_data(data)\n+\n+        # Download from S3\n+        self.input_file = digest_provider.download_digest_from_s3(\n+            self.settings, real_filename, bucket_name, bucket_folder, self.input_dir)\n+\n+        # Parse input and build digest\n+        self.statuses[\"build\"], self.digest = digest_provider.build_digest(\n+            self.input_file, self.temp_dir, self.logger, self.digest_config)\n+\n+        # Approve files for emailing\n+        self.statuses[\"valid\"], error_message = digest_provider.validate_digest(self.digest)\n+\n+        if self.statuses.get(\"build\") is not True or self.statuses.get(\"valid\") is not True:","path":"activity/activity_ValidateDigestInput.py","position":69,"original_position":69,"commit_id":"692d9433bbe056d9532e0d8fb606ff4fd9c6a51a","original_commit_id":"692d9433bbe056d9532e0d8fb606ff4fd9c6a51a","user":{"login":"giorgiosironi","id":160299,"node_id":"MDQ6VXNlcjE2MDI5OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/160299?v=4","gravatar_id":"","url":"https://api.github.com/users/giorgiosironi","html_url":"https://github.com/giorgiosironi","followers_url":"https://api.github.com/users/giorgiosironi/followers","following_url":"https://api.github.com/users/giorgiosironi/following{/other_user}","gists_url":"https://api.github.com/users/giorgiosironi/gists{/gist_id}","starred_url":"https://api.github.com/users/giorgiosironi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giorgiosironi/subscriptions","organizations_url":"https://api.github.com/users/giorgiosironi/orgs","repos_url":"https://api.github.com/users/giorgiosironi/repos","events_url":"https://api.github.com/users/giorgiosironi/events{/privacy}","received_events_url":"https://api.github.com/users/giorgiosironi/received_events","type":"User","site_admin":false},"body":"just need `not self.statuses.get(\"build\")` as `False`, `None` etc would all result in the if being triggered","created_at":"2018-10-25T13:33:35Z","updated_at":"2018-10-25T13:33:35Z","html_url":"https://github.com/elifesciences/elife-bot/pull/808#discussion_r228174131","pull_request_url":"https://api.github.com/repos/elifesciences/elife-bot/pulls/808","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/elifesciences/elife-bot/pulls/comments/228174131"},"html":{"href":"https://github.com/elifesciences/elife-bot/pull/808#discussion_r228174131"},"pull_request":{"href":"https://api.github.com/repos/elifesciences/elife-bot/pulls/808"}}},"pull_request":{"url":"https://api.github.com/repos/elifesciences/elife-bot/pulls/808","id":225598595,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI1NTk4NTk1","html_url":"https://github.com/elifesciences/elife-bot/pull/808","diff_url":"https://github.com/elifesciences/elife-bot/pull/808.diff","patch_url":"https://github.com/elifesciences/elife-bot/pull/808.patch","issue_url":"https://api.github.com/repos/elifesciences/elife-bot/issues/808","number":808,"state":"open","locked":false,"title":"ValidateDigestInput activity","user":{"login":"gnott","id":1779115,"node_id":"MDQ6VXNlcjE3NzkxMTU=","avatar_url":"https://avatars1.githubusercontent.com/u/1779115?v=4","gravatar_id":"","url":"https://api.github.com/users/gnott","html_url":"https://github.com/gnott","followers_url":"https://api.github.com/users/gnott/followers","following_url":"https://api.github.com/users/gnott/following{/other_user}","gists_url":"https://api.github.com/users/gnott/gists{/gist_id}","starred_url":"https://api.github.com/users/gnott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gnott/subscriptions","organizations_url":"https://api.github.com/users/gnott/orgs","repos_url":"https://api.github.com/users/gnott/repos","events_url":"https://api.github.com/users/gnott/events{/privacy}","received_events_url":"https://api.github.com/users/gnott/received_events","type":"User","site_admin":false},"body":"Fixes https://github.com/elifesciences/issues/issues/4537\r\n\r\nSome refactoring to move the validation logic to the `digest_provider`, otherwise the changes planned on the ticket went fairly smoothly.","created_at":"2018-10-25T01:38:09Z","updated_at":"2018-10-25T13:33:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"064a5b17db55eb7b33de7c1c996a7a9e15b700f6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/elifesciences/elife-bot/pulls/808/commits","review_comments_url":"https://api.github.com/repos/elifesciences/elife-bot/pulls/808/comments","review_comment_url":"https://api.github.com/repos/elifesciences/elife-bot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elifesciences/elife-bot/issues/808/comments","statuses_url":"https://api.github.com/repos/elifesciences/elife-bot/statuses/692d9433bbe056d9532e0d8fb606ff4fd9c6a51a","head":{"label":"elifesciences:feature-validate-digest-input","ref":"feature-validate-digest-input","sha":"692d9433bbe056d9532e0d8fb606ff4fd9c6a51a","user":{"login":"elifesciences","id":1777367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NzczNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"repo":{"id":7503542,"node_id":"MDEwOlJlcG9zaXRvcnk3NTAzNTQy","name":"elife-bot","full_name":"elifesciences/elife-bot","private":false,"owner":{"login":"elifesciences","id":1777367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NzczNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/elifesciences/elife-bot","description":"tools for creating an automatic publishing workflow. ","fork":false,"url":"https://api.github.com/repos/elifesciences/elife-bot","forks_url":"https://api.github.com/repos/elifesciences/elife-bot/forks","keys_url":"https://api.github.com/repos/elifesciences/elife-bot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elifesciences/elife-bot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elifesciences/elife-bot/teams","hooks_url":"https://api.github.com/repos/elifesciences/elife-bot/hooks","issue_events_url":"https://api.github.com/repos/elifesciences/elife-bot/issues/events{/number}","events_url":"https://api.github.com/repos/elifesciences/elife-bot/events","assignees_url":"https://api.github.com/repos/elifesciences/elife-bot/assignees{/user}","branches_url":"https://api.github.com/repos/elifesciences/elife-bot/branches{/branch}","tags_url":"https://api.github.com/repos/elifesciences/elife-bot/tags","blobs_url":"https://api.github.com/repos/elifesciences/elife-bot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elifesciences/elife-bot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elifesciences/elife-bot/git/refs{/sha}","trees_url":"https://api.github.com/repos/elifesciences/elife-bot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elifesciences/elife-bot/statuses/{sha}","languages_url":"https://api.github.com/repos/elifesciences/elife-bot/languages","stargazers_url":"https://api.github.com/repos/elifesciences/elife-bot/stargazers","contributors_url":"https://api.github.com/repos/elifesciences/elife-bot/contributors","subscribers_url":"https://api.github.com/repos/elifesciences/elife-bot/subscribers","subscription_url":"https://api.github.com/repos/elifesciences/elife-bot/subscription","commits_url":"https://api.github.com/repos/elifesciences/elife-bot/commits{/sha}","git_commits_url":"https://api.github.com/repos/elifesciences/elife-bot/git/commits{/sha}","comments_url":"https://api.github.com/repos/elifesciences/elife-bot/comments{/number}","issue_comment_url":"https://api.github.com/repos/elifesciences/elife-bot/issues/comments{/number}","contents_url":"https://api.github.com/repos/elifesciences/elife-bot/contents/{+path}","compare_url":"https://api.github.com/repos/elifesciences/elife-bot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elifesciences/elife-bot/merges","archive_url":"https://api.github.com/repos/elifesciences/elife-bot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elifesciences/elife-bot/downloads","issues_url":"https://api.github.com/repos/elifesciences/elife-bot/issues{/number}","pulls_url":"https://api.github.com/repos/elifesciences/elife-bot/pulls{/number}","milestones_url":"https://api.github.com/repos/elifesciences/elife-bot/milestones{/number}","notifications_url":"https://api.github.com/repos/elifesciences/elife-bot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elifesciences/elife-bot/labels{/name}","releases_url":"https://api.github.com/repos/elifesciences/elife-bot/releases{/id}","deployments_url":"https://api.github.com/repos/elifesciences/elife-bot/deployments","created_at":"2013-01-08T15:09:54Z","updated_at":"2018-10-24T22:05:29Z","pushed_at":"2018-10-25T01:38:10Z","git_url":"git://github.com/elifesciences/elife-bot.git","ssh_url":"git@github.com:elifesciences/elife-bot.git","clone_url":"https://github.com/elifesciences/elife-bot.git","svn_url":"https://github.com/elifesciences/elife-bot","homepage":null,"size":104245,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":37,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":8,"open_issues":37,"watchers":15,"default_branch":"develop"}},"base":{"label":"elifesciences:develop","ref":"develop","sha":"45f0cf05796cd289f9673b30955e9ac8f37e0542","user":{"login":"elifesciences","id":1777367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NzczNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"repo":{"id":7503542,"node_id":"MDEwOlJlcG9zaXRvcnk3NTAzNTQy","name":"elife-bot","full_name":"elifesciences/elife-bot","private":false,"owner":{"login":"elifesciences","id":1777367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NzczNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/elifesciences/elife-bot","description":"tools for creating an automatic publishing workflow. ","fork":false,"url":"https://api.github.com/repos/elifesciences/elife-bot","forks_url":"https://api.github.com/repos/elifesciences/elife-bot/forks","keys_url":"https://api.github.com/repos/elifesciences/elife-bot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elifesciences/elife-bot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elifesciences/elife-bot/teams","hooks_url":"https://api.github.com/repos/elifesciences/elife-bot/hooks","issue_events_url":"https://api.github.com/repos/elifesciences/elife-bot/issues/events{/number}","events_url":"https://api.github.com/repos/elifesciences/elife-bot/events","assignees_url":"https://api.github.com/repos/elifesciences/elife-bot/assignees{/user}","branches_url":"https://api.github.com/repos/elifesciences/elife-bot/branches{/branch}","tags_url":"https://api.github.com/repos/elifesciences/elife-bot/tags","blobs_url":"https://api.github.com/repos/elifesciences/elife-bot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elifesciences/elife-bot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elifesciences/elife-bot/git/refs{/sha}","trees_url":"https://api.github.com/repos/elifesciences/elife-bot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elifesciences/elife-bot/statuses/{sha}","languages_url":"https://api.github.com/repos/elifesciences/elife-bot/languages","stargazers_url":"https://api.github.com/repos/elifesciences/elife-bot/stargazers","contributors_url":"https://api.github.com/repos/elifesciences/elife-bot/contributors","subscribers_url":"https://api.github.com/repos/elifesciences/elife-bot/subscribers","subscription_url":"https://api.github.com/repos/elifesciences/elife-bot/subscription","commits_url":"https://api.github.com/repos/elifesciences/elife-bot/commits{/sha}","git_commits_url":"https://api.github.com/repos/elifesciences/elife-bot/git/commits{/sha}","comments_url":"https://api.github.com/repos/elifesciences/elife-bot/comments{/number}","issue_comment_url":"https://api.github.com/repos/elifesciences/elife-bot/issues/comments{/number}","contents_url":"https://api.github.com/repos/elifesciences/elife-bot/contents/{+path}","compare_url":"https://api.github.com/repos/elifesciences/elife-bot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elifesciences/elife-bot/merges","archive_url":"https://api.github.com/repos/elifesciences/elife-bot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elifesciences/elife-bot/downloads","issues_url":"https://api.github.com/repos/elifesciences/elife-bot/issues{/number}","pulls_url":"https://api.github.com/repos/elifesciences/elife-bot/pulls{/number}","milestones_url":"https://api.github.com/repos/elifesciences/elife-bot/milestones{/number}","notifications_url":"https://api.github.com/repos/elifesciences/elife-bot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elifesciences/elife-bot/labels{/name}","releases_url":"https://api.github.com/repos/elifesciences/elife-bot/releases{/id}","deployments_url":"https://api.github.com/repos/elifesciences/elife-bot/deployments","created_at":"2013-01-08T15:09:54Z","updated_at":"2018-10-24T22:05:29Z","pushed_at":"2018-10-25T01:38:10Z","git_url":"git://github.com/elifesciences/elife-bot.git","ssh_url":"git@github.com:elifesciences/elife-bot.git","clone_url":"https://github.com/elifesciences/elife-bot.git","svn_url":"https://github.com/elifesciences/elife-bot","homepage":null,"size":104245,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":37,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":8,"open_issues":37,"watchers":15,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/elifesciences/elife-bot/pulls/808"},"html":{"href":"https://github.com/elifesciences/elife-bot/pull/808"},"issue":{"href":"https://api.github.com/repos/elifesciences/elife-bot/issues/808"},"comments":{"href":"https://api.github.com/repos/elifesciences/elife-bot/issues/808/comments"},"review_comments":{"href":"https://api.github.com/repos/elifesciences/elife-bot/pulls/808/comments"},"review_comment":{"href":"https://api.github.com/repos/elifesciences/elife-bot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elifesciences/elife-bot/pulls/808/commits"},"statuses":{"href":"https://api.github.com/repos/elifesciences/elife-bot/statuses/692d9433bbe056d9532e0d8fb606ff4fd9c6a51a"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"giorgiosironi"}}