{"action":"created","comment":{"url":"https://api.github.com/repos/education/classroom/pulls/comments/196596378","pull_request_review_id":130180684,"id":196596378,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NjU5NjM3OA==","diff_hunk":"@@ -0,0 +1,47 @@\n+# frozen_string_literal: true\n+\n+class AssignmentRepo\n+  class CreateGitHubRepositoryJob < ApplicationJob\n+    queue_as :create_repository\n+    retry_on Creator::Result::Error, queue: :create_repository","path":"app/jobs/assignment_repo/create_github_repository_job.rb","position":6,"original_position":6,"commit_id":"9d5098d75e99ebb32df316187dd48d8104a226a0","original_commit_id":"9d5098d75e99ebb32df316187dd48d8104a226a0","user":{"login":"BenEmdon","id":11095731,"node_id":"MDQ6VXNlcjExMDk1NzMx","avatar_url":"https://avatars0.githubusercontent.com/u/11095731?v=4","gravatar_id":"","url":"https://api.github.com/users/BenEmdon","html_url":"https://github.com/BenEmdon","followers_url":"https://api.github.com/users/BenEmdon/followers","following_url":"https://api.github.com/users/BenEmdon/following{/other_user}","gists_url":"https://api.github.com/users/BenEmdon/gists{/gist_id}","starred_url":"https://api.github.com/users/BenEmdon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenEmdon/subscriptions","organizations_url":"https://api.github.com/users/BenEmdon/orgs","repos_url":"https://api.github.com/users/BenEmdon/repos","events_url":"https://api.github.com/users/BenEmdon/events{/privacy}","received_events_url":"https://api.github.com/users/BenEmdon/received_events","type":"User","site_admin":false},"body":"`retry_on` defaults to 3s wait and 5 attempts. \r\nThis should be enough for what we are trying to do, right?\r\n\r\nAlso if we wanted we could pass a `wait: :exponentially_longer` which would perform an exponential backoff algorithm.","created_at":"2018-06-19T22:16:30Z","updated_at":"2018-06-19T22:16:50Z","html_url":"https://github.com/education/classroom/pull/1368#discussion_r196596378","pull_request_url":"https://api.github.com/repos/education/classroom/pulls/1368","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/education/classroom/pulls/comments/196596378"},"html":{"href":"https://github.com/education/classroom/pull/1368#discussion_r196596378"},"pull_request":{"href":"https://api.github.com/repos/education/classroom/pulls/1368"}}},"pull_request":{"url":"https://api.github.com/repos/education/classroom/pulls/1368","id":195664153,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1NjY0MTUz","html_url":"https://github.com/education/classroom/pull/1368","diff_url":"https://github.com/education/classroom/pull/1368.diff","patch_url":"https://github.com/education/classroom/pull/1368.patch","issue_url":"https://api.github.com/repos/education/classroom/issues/1368","number":1368,"state":"open","locked":false,"title":"[WIP] Import resiliency","user":{"login":"BenEmdon","id":11095731,"node_id":"MDQ6VXNlcjExMDk1NzMx","avatar_url":"https://avatars0.githubusercontent.com/u/11095731?v=4","gravatar_id":"","url":"https://api.github.com/users/BenEmdon","html_url":"https://github.com/BenEmdon","followers_url":"https://api.github.com/users/BenEmdon/followers","following_url":"https://api.github.com/users/BenEmdon/following{/other_user}","gists_url":"https://api.github.com/users/BenEmdon/gists{/gist_id}","starred_url":"https://api.github.com/users/BenEmdon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenEmdon/subscriptions","organizations_url":"https://api.github.com/users/BenEmdon/orgs","repos_url":"https://api.github.com/users/BenEmdon/repos","events_url":"https://api.github.com/users/BenEmdon/events{/privacy}","received_events_url":"https://api.github.com/users/BenEmdon/received_events","type":"User","site_admin":false},"body":"## What\r\nThis PR (1/3) proposes a different architecture to improve repository creation/import resiliency for the purpose of addressing #1253.\r\nThe architecture I am proposing is to move repository creation/import into a background job and communicate with the client asynchronously via ActionCable. Moving creation/import to a background job is a easy first step to resiliency since ActiveJobs can be retried.\r\n\r\nI've decided to break this refactor into 3 parts:\r\n1. Create `CreateGitHubRepositoryJob` job which is more resilient than the current offering\r\n1. Create some form of porter polling job that can watch the status of the starter code import\r\n1. Implement the new jobs in place of the current offering. Use ActionCable to asynchronously message the client with status.\r\n\r\n## How\r\nIn this PR I created `CreateGitHubRepositoryJob` which essentially performs the same logic as [what is currently in place](https://github.com/education/classroom/blob/0638f37ce1ebc978926899cb8f64cc2b7fd4e8bf/app/models/assignment_repo/creator.rb#L58-L87). The big difference is that if at any point the repo creation/import fails, the GitHub repository is deleted and the creation/import job is retried.","created_at":"2018-06-18T22:18:03Z","updated_at":"2018-06-19T22:16:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"696738e93676969fab1f46c0caa2ae22db49ea5e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"d12","id":30920216,"node_id":"MDQ6VXNlcjMwOTIwMjE2","avatar_url":"https://avatars0.githubusercontent.com/u/30920216?v=4","gravatar_id":"","url":"https://api.github.com/users/d12","html_url":"https://github.com/d12","followers_url":"https://api.github.com/users/d12/followers","following_url":"https://api.github.com/users/d12/following{/other_user}","gists_url":"https://api.github.com/users/d12/gists{/gist_id}","starred_url":"https://api.github.com/users/d12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d12/subscriptions","organizations_url":"https://api.github.com/users/d12/orgs","repos_url":"https://api.github.com/users/d12/repos","events_url":"https://api.github.com/users/d12/events{/privacy}","received_events_url":"https://api.github.com/users/d12/received_events","type":"User","site_admin":true}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/education/classroom/pulls/1368/commits","review_comments_url":"https://api.github.com/repos/education/classroom/pulls/1368/comments","review_comment_url":"https://api.github.com/repos/education/classroom/pulls/comments{/number}","comments_url":"https://api.github.com/repos/education/classroom/issues/1368/comments","statuses_url":"https://api.github.com/repos/education/classroom/statuses/9d5098d75e99ebb32df316187dd48d8104a226a0","head":{"label":"BenEmdon:import-resiliency","ref":"import-resiliency","sha":"9d5098d75e99ebb32df316187dd48d8104a226a0","user":{"login":"BenEmdon","id":11095731,"node_id":"MDQ6VXNlcjExMDk1NzMx","avatar_url":"https://avatars0.githubusercontent.com/u/11095731?v=4","gravatar_id":"","url":"https://api.github.com/users/BenEmdon","html_url":"https://github.com/BenEmdon","followers_url":"https://api.github.com/users/BenEmdon/followers","following_url":"https://api.github.com/users/BenEmdon/following{/other_user}","gists_url":"https://api.github.com/users/BenEmdon/gists{/gist_id}","starred_url":"https://api.github.com/users/BenEmdon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenEmdon/subscriptions","organizations_url":"https://api.github.com/users/BenEmdon/orgs","repos_url":"https://api.github.com/users/BenEmdon/repos","events_url":"https://api.github.com/users/BenEmdon/events{/privacy}","received_events_url":"https://api.github.com/users/BenEmdon/received_events","type":"User","site_admin":false},"repo":{"id":131529668,"node_id":"MDEwOlJlcG9zaXRvcnkxMzE1Mjk2Njg=","name":"classroom","full_name":"BenEmdon/classroom","owner":{"login":"BenEmdon","id":11095731,"node_id":"MDQ6VXNlcjExMDk1NzMx","avatar_url":"https://avatars0.githubusercontent.com/u/11095731?v=4","gravatar_id":"","url":"https://api.github.com/users/BenEmdon","html_url":"https://github.com/BenEmdon","followers_url":"https://api.github.com/users/BenEmdon/followers","following_url":"https://api.github.com/users/BenEmdon/following{/other_user}","gists_url":"https://api.github.com/users/BenEmdon/gists{/gist_id}","starred_url":"https://api.github.com/users/BenEmdon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenEmdon/subscriptions","organizations_url":"https://api.github.com/users/BenEmdon/orgs","repos_url":"https://api.github.com/users/BenEmdon/repos","events_url":"https://api.github.com/users/BenEmdon/events{/privacy}","received_events_url":"https://api.github.com/users/BenEmdon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BenEmdon/classroom","description":"GitHub Classroom automates repository creation and access control, making it easy for teachers to distribute starter code and collect assignments on GitHub.","fork":true,"url":"https://api.github.com/repos/BenEmdon/classroom","forks_url":"https://api.github.com/repos/BenEmdon/classroom/forks","keys_url":"https://api.github.com/repos/BenEmdon/classroom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BenEmdon/classroom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BenEmdon/classroom/teams","hooks_url":"https://api.github.com/repos/BenEmdon/classroom/hooks","issue_events_url":"https://api.github.com/repos/BenEmdon/classroom/issues/events{/number}","events_url":"https://api.github.com/repos/BenEmdon/classroom/events","assignees_url":"https://api.github.com/repos/BenEmdon/classroom/assignees{/user}","branches_url":"https://api.github.com/repos/BenEmdon/classroom/branches{/branch}","tags_url":"https://api.github.com/repos/BenEmdon/classroom/tags","blobs_url":"https://api.github.com/repos/BenEmdon/classroom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BenEmdon/classroom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BenEmdon/classroom/git/refs{/sha}","trees_url":"https://api.github.com/repos/BenEmdon/classroom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BenEmdon/classroom/statuses/{sha}","languages_url":"https://api.github.com/repos/BenEmdon/classroom/languages","stargazers_url":"https://api.github.com/repos/BenEmdon/classroom/stargazers","contributors_url":"https://api.github.com/repos/BenEmdon/classroom/contributors","subscribers_url":"https://api.github.com/repos/BenEmdon/classroom/subscribers","subscription_url":"https://api.github.com/repos/BenEmdon/classroom/subscription","commits_url":"https://api.github.com/repos/BenEmdon/classroom/commits{/sha}","git_commits_url":"https://api.github.com/repos/BenEmdon/classroom/git/commits{/sha}","comments_url":"https://api.github.com/repos/BenEmdon/classroom/comments{/number}","issue_comment_url":"https://api.github.com/repos/BenEmdon/classroom/issues/comments{/number}","contents_url":"https://api.github.com/repos/BenEmdon/classroom/contents/{+path}","compare_url":"https://api.github.com/repos/BenEmdon/classroom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BenEmdon/classroom/merges","archive_url":"https://api.github.com/repos/BenEmdon/classroom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BenEmdon/classroom/downloads","issues_url":"https://api.github.com/repos/BenEmdon/classroom/issues{/number}","pulls_url":"https://api.github.com/repos/BenEmdon/classroom/pulls{/number}","milestones_url":"https://api.github.com/repos/BenEmdon/classroom/milestones{/number}","notifications_url":"https://api.github.com/repos/BenEmdon/classroom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BenEmdon/classroom/labels{/name}","releases_url":"https://api.github.com/repos/BenEmdon/classroom/releases{/id}","deployments_url":"https://api.github.com/repos/BenEmdon/classroom/deployments","created_at":"2018-04-29T20:59:13Z","updated_at":"2018-06-15T00:08:53Z","pushed_at":"2018-06-19T22:03:41Z","git_url":"git://github.com/BenEmdon/classroom.git","ssh_url":"git@github.com:BenEmdon/classroom.git","clone_url":"https://github.com/BenEmdon/classroom.git","svn_url":"https://github.com/BenEmdon/classroom","homepage":"https://classroom.github.com","size":53015,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"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":"education:master","ref":"master","sha":"0638f37ce1ebc978926899cb8f64cc2b7fd4e8bf","user":{"login":"education","id":6667880,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2Njc4ODA=","avatar_url":"https://avatars2.githubusercontent.com/u/6667880?v=4","gravatar_id":"","url":"https://api.github.com/users/education","html_url":"https://github.com/education","followers_url":"https://api.github.com/users/education/followers","following_url":"https://api.github.com/users/education/following{/other_user}","gists_url":"https://api.github.com/users/education/gists{/gist_id}","starred_url":"https://api.github.com/users/education/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/education/subscriptions","organizations_url":"https://api.github.com/users/education/orgs","repos_url":"https://api.github.com/users/education/repos","events_url":"https://api.github.com/users/education/events{/privacy}","received_events_url":"https://api.github.com/users/education/received_events","type":"Organization","site_admin":false},"repo":{"id":35079964,"node_id":"MDEwOlJlcG9zaXRvcnkzNTA3OTk2NA==","name":"classroom","full_name":"education/classroom","owner":{"login":"education","id":6667880,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2Njc4ODA=","avatar_url":"https://avatars2.githubusercontent.com/u/6667880?v=4","gravatar_id":"","url":"https://api.github.com/users/education","html_url":"https://github.com/education","followers_url":"https://api.github.com/users/education/followers","following_url":"https://api.github.com/users/education/following{/other_user}","gists_url":"https://api.github.com/users/education/gists{/gist_id}","starred_url":"https://api.github.com/users/education/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/education/subscriptions","organizations_url":"https://api.github.com/users/education/orgs","repos_url":"https://api.github.com/users/education/repos","events_url":"https://api.github.com/users/education/events{/privacy}","received_events_url":"https://api.github.com/users/education/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/education/classroom","description":"GitHub Classroom automates repository creation and access control, making it easy for teachers to distribute starter code and collect assignments on GitHub.","fork":false,"url":"https://api.github.com/repos/education/classroom","forks_url":"https://api.github.com/repos/education/classroom/forks","keys_url":"https://api.github.com/repos/education/classroom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/education/classroom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/education/classroom/teams","hooks_url":"https://api.github.com/repos/education/classroom/hooks","issue_events_url":"https://api.github.com/repos/education/classroom/issues/events{/number}","events_url":"https://api.github.com/repos/education/classroom/events","assignees_url":"https://api.github.com/repos/education/classroom/assignees{/user}","branches_url":"https://api.github.com/repos/education/classroom/branches{/branch}","tags_url":"https://api.github.com/repos/education/classroom/tags","blobs_url":"https://api.github.com/repos/education/classroom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/education/classroom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/education/classroom/git/refs{/sha}","trees_url":"https://api.github.com/repos/education/classroom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/education/classroom/statuses/{sha}","languages_url":"https://api.github.com/repos/education/classroom/languages","stargazers_url":"https://api.github.com/repos/education/classroom/stargazers","contributors_url":"https://api.github.com/repos/education/classroom/contributors","subscribers_url":"https://api.github.com/repos/education/classroom/subscribers","subscription_url":"https://api.github.com/repos/education/classroom/subscription","commits_url":"https://api.github.com/repos/education/classroom/commits{/sha}","git_commits_url":"https://api.github.com/repos/education/classroom/git/commits{/sha}","comments_url":"https://api.github.com/repos/education/classroom/comments{/number}","issue_comment_url":"https://api.github.com/repos/education/classroom/issues/comments{/number}","contents_url":"https://api.github.com/repos/education/classroom/contents/{+path}","compare_url":"https://api.github.com/repos/education/classroom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/education/classroom/merges","archive_url":"https://api.github.com/repos/education/classroom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/education/classroom/downloads","issues_url":"https://api.github.com/repos/education/classroom/issues{/number}","pulls_url":"https://api.github.com/repos/education/classroom/pulls{/number}","milestones_url":"https://api.github.com/repos/education/classroom/milestones{/number}","notifications_url":"https://api.github.com/repos/education/classroom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/education/classroom/labels{/name}","releases_url":"https://api.github.com/repos/education/classroom/releases{/id}","deployments_url":"https://api.github.com/repos/education/classroom/deployments","created_at":"2015-05-05T05:33:50Z","updated_at":"2018-06-19T20:50:27Z","pushed_at":"2018-06-19T22:03:42Z","git_url":"git://github.com/education/classroom.git","ssh_url":"git@github.com:education/classroom.git","clone_url":"https://github.com/education/classroom.git","svn_url":"https://github.com/education/classroom","homepage":"https://classroom.github.com","size":52958,"stargazers_count":813,"watchers_count":813,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":230,"mirror_url":null,"archived":false,"open_issues_count":71,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":230,"open_issues":71,"watchers":813,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/education/classroom/pulls/1368"},"html":{"href":"https://github.com/education/classroom/pull/1368"},"issue":{"href":"https://api.github.com/repos/education/classroom/issues/1368"},"comments":{"href":"https://api.github.com/repos/education/classroom/issues/1368/comments"},"review_comments":{"href":"https://api.github.com/repos/education/classroom/pulls/1368/comments"},"review_comment":{"href":"https://api.github.com/repos/education/classroom/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/education/classroom/pulls/1368/commits"},"statuses":{"href":"https://api.github.com/repos/education/classroom/statuses/9d5098d75e99ebb32df316187dd48d8104a226a0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"BenEmdon"}}