{"action":"created","comment":{"url":"https://api.github.com/repos/youtube/vitess/pulls/comments/81768188","pull_request_review_id":2723338,"id":81768188,"diff_hunk":"@@ -0,0 +1,174 @@\n+package vtctl\n+\n+import (\n+\t\"flag\"\n+\t\"fmt\"\n+\n+\t\"golang.org/x/net/context\"\n+\n+\t\"github.com/youtube/vitess/go/vt/servenv\"\n+\t\"github.com/youtube/vitess/go/vt/workflow\"\n+\t\"github.com/youtube/vitess/go/vt/wrangler\"\n+)\n+\n+// This file contains the workflows command group for vtctl.\n+\n+const workflowsGroupName = \"Workflows\"\n+\n+var (\n+\t// WorkflowManager contains our manager. It needs to be set before\n+\t// servenv.Run is called, or this command group will be disabled.\n+\tWorkflowManager *workflow.Manager\n+)\n+\n+func init() {\n+\tservenv.OnRun(func() {\n+\t\tif WorkflowManager == nil {\n+\t\t\treturn\n+\t\t}\n+\n+\t\taddCommandGroup(workflowsGroupName)\n+\n+\t\taddCommand(workflowsGroupName, command{\n+\t\t\t\"WorkflowCreate\",\n+\t\t\tcommandWorkflowCreate,\n+\t\t\t\"[-nostart] <factoryName> [parameters...]\",\n+\t\t\t\"Creates the workflow with the provided parameters. The workflow is also started, unless -nostart is specified.\"})\n+\t\taddCommand(workflowsGroupName, command{\n+\t\t\t\"WorkflowStart\",\n+\t\t\tcommandWorkflowStart,\n+\t\t\t\"<uuid>\",\n+\t\t\t\"Starts the workflow.\"})\n+\t\taddCommand(workflowsGroupName, command{\n+\t\t\t\"WorkflowStop\",\n+\t\t\tcommandWorkflowStop,\n+\t\t\t\"<uuid>\",\n+\t\t\t\"Stops the workflow.\"})\n+\t\taddCommand(workflowsGroupName, command{\n+\t\t\t\"WorkflowWait\",\n+\t\t\tcommandWorkflowWait,\n+\t\t\t\"<uuid>\",\n+\t\t\t\"Waits for the workflow to finish.\"})\n+\n+\t\taddCommand(workflowsGroupName, command{\n+\t\t\t\"WorkflowTree\",\n+\t\t\tcommandWorkflowTree,\n+\t\t\t\"\",\n+\t\t\t\"Displays a JSON representation of the workflow tree.\"})\n+\t\taddCommand(workflowsGroupName, command{\n+\t\t\t\"WorkflowAction\",\n+\t\t\tcommandWorkflowAction,\n+\t\t\t\"<path> <name>\",\n+\t\t\t\"Sends the provided action name on the specified path.\"})\n+\t})\n+}\n+\n+func commandWorkflowCreate(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {\n+\tif WorkflowManager == nil {","path":"go/vt/vtctl/workflow.go","position":67,"original_position":67,"commit_id":"f5955fdbac8580d870be845dacd186608cc0c318","original_commit_id":"f5955fdbac8580d870be845dacd186608cc0c318","user":{"login":"alainjobart","id":4625714,"avatar_url":"https://avatars.githubusercontent.com/u/4625714?v=3","gravatar_id":"","url":"https://api.github.com/users/alainjobart","html_url":"https://github.com/alainjobart","followers_url":"https://api.github.com/users/alainjobart/followers","following_url":"https://api.github.com/users/alainjobart/following{/other_user}","gists_url":"https://api.github.com/users/alainjobart/gists{/gist_id}","starred_url":"https://api.github.com/users/alainjobart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alainjobart/subscriptions","organizations_url":"https://api.github.com/users/alainjobart/orgs","repos_url":"https://api.github.com/users/alainjobart/repos","events_url":"https://api.github.com/users/alainjobart/events{/privacy}","received_events_url":"https://api.github.com/users/alainjobart/received_events","type":"User","site_admin":false},"body":"This command is registered in servenv.OnRun(), so nobody should come here before that, and by then WorkflowManager is either initialized or will never be. I agree we have to be careful in tests.","created_at":"2016-10-04T14:24:52Z","updated_at":"2016-10-04T14:24:52Z","html_url":"https://github.com/youtube/vitess/pull/2100#discussion_r81768188","pull_request_url":"https://api.github.com/repos/youtube/vitess/pulls/2100","_links":{"self":{"href":"https://api.github.com/repos/youtube/vitess/pulls/comments/81768188"},"html":{"href":"https://github.com/youtube/vitess/pull/2100#discussion_r81768188"},"pull_request":{"href":"https://api.github.com/repos/youtube/vitess/pulls/2100"}}},"pull_request":{"url":"https://api.github.com/repos/youtube/vitess/pulls/2100","id":87742121,"html_url":"https://github.com/youtube/vitess/pull/2100","diff_url":"https://github.com/youtube/vitess/pull/2100.diff","patch_url":"https://github.com/youtube/vitess/pull/2100.patch","issue_url":"https://api.github.com/repos/youtube/vitess/issues/2100","number":2100,"state":"open","locked":false,"title":"Adding workflow library.","user":{"login":"alainjobart","id":4625714,"avatar_url":"https://avatars.githubusercontent.com/u/4625714?v=3","gravatar_id":"","url":"https://api.github.com/users/alainjobart","html_url":"https://github.com/alainjobart","followers_url":"https://api.github.com/users/alainjobart/followers","following_url":"https://api.github.com/users/alainjobart/following{/other_user}","gists_url":"https://api.github.com/users/alainjobart/gists{/gist_id}","starred_url":"https://api.github.com/users/alainjobart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alainjobart/subscriptions","organizations_url":"https://api.github.com/users/alainjobart/orgs","repos_url":"https://api.github.com/users/alainjobart/repos","events_url":"https://api.github.com/users/alainjobart/events{/privacy}","received_events_url":"https://api.github.com/users/alainjobart/received_events","type":"User","site_admin":false},"body":"To manage long running workflows within Vitess.\r\nIt contains a sample Sleep workflow.\r\nWiring up the UI using WebSockets.\r\nAlso adding vtctl commands.","created_at":"2016-10-03T15:55:44Z","updated_at":"2016-10-04T15:01:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea758dcc1f0e3d9ebed599bec0841e50cc6e007c","assignee":{"login":"michael-berlin","id":3919251,"avatar_url":"https://avatars.githubusercontent.com/u/3919251?v=3","gravatar_id":"","url":"https://api.github.com/users/michael-berlin","html_url":"https://github.com/michael-berlin","followers_url":"https://api.github.com/users/michael-berlin/followers","following_url":"https://api.github.com/users/michael-berlin/following{/other_user}","gists_url":"https://api.github.com/users/michael-berlin/gists{/gist_id}","starred_url":"https://api.github.com/users/michael-berlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michael-berlin/subscriptions","organizations_url":"https://api.github.com/users/michael-berlin/orgs","repos_url":"https://api.github.com/users/michael-berlin/repos","events_url":"https://api.github.com/users/michael-berlin/events{/privacy}","received_events_url":"https://api.github.com/users/michael-berlin/received_events","type":"User","site_admin":false},"assignees":[{"login":"michael-berlin","id":3919251,"avatar_url":"https://avatars.githubusercontent.com/u/3919251?v=3","gravatar_id":"","url":"https://api.github.com/users/michael-berlin","html_url":"https://github.com/michael-berlin","followers_url":"https://api.github.com/users/michael-berlin/followers","following_url":"https://api.github.com/users/michael-berlin/following{/other_user}","gists_url":"https://api.github.com/users/michael-berlin/gists{/gist_id}","starred_url":"https://api.github.com/users/michael-berlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michael-berlin/subscriptions","organizations_url":"https://api.github.com/users/michael-berlin/orgs","repos_url":"https://api.github.com/users/michael-berlin/repos","events_url":"https://api.github.com/users/michael-berlin/events{/privacy}","received_events_url":"https://api.github.com/users/michael-berlin/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/youtube/vitess/pulls/2100/commits","review_comments_url":"https://api.github.com/repos/youtube/vitess/pulls/2100/comments","review_comment_url":"https://api.github.com/repos/youtube/vitess/pulls/comments{/number}","comments_url":"https://api.github.com/repos/youtube/vitess/issues/2100/comments","statuses_url":"https://api.github.com/repos/youtube/vitess/statuses/f5955fdbac8580d870be845dacd186608cc0c318","head":{"label":"alainjobart:workflowmanager","ref":"workflowmanager","sha":"f5955fdbac8580d870be845dacd186608cc0c318","user":{"login":"alainjobart","id":4625714,"avatar_url":"https://avatars.githubusercontent.com/u/4625714?v=3","gravatar_id":"","url":"https://api.github.com/users/alainjobart","html_url":"https://github.com/alainjobart","followers_url":"https://api.github.com/users/alainjobart/followers","following_url":"https://api.github.com/users/alainjobart/following{/other_user}","gists_url":"https://api.github.com/users/alainjobart/gists{/gist_id}","starred_url":"https://api.github.com/users/alainjobart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alainjobart/subscriptions","organizations_url":"https://api.github.com/users/alainjobart/orgs","repos_url":"https://api.github.com/users/alainjobart/repos","events_url":"https://api.github.com/users/alainjobart/events{/privacy}","received_events_url":"https://api.github.com/users/alainjobart/received_events","type":"User","site_admin":false},"repo":{"id":37342150,"name":"vitess","full_name":"alainjobart/vitess","owner":{"login":"alainjobart","id":4625714,"avatar_url":"https://avatars.githubusercontent.com/u/4625714?v=3","gravatar_id":"","url":"https://api.github.com/users/alainjobart","html_url":"https://github.com/alainjobart","followers_url":"https://api.github.com/users/alainjobart/followers","following_url":"https://api.github.com/users/alainjobart/following{/other_user}","gists_url":"https://api.github.com/users/alainjobart/gists{/gist_id}","starred_url":"https://api.github.com/users/alainjobart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alainjobart/subscriptions","organizations_url":"https://api.github.com/users/alainjobart/orgs","repos_url":"https://api.github.com/users/alainjobart/repos","events_url":"https://api.github.com/users/alainjobart/events{/privacy}","received_events_url":"https://api.github.com/users/alainjobart/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alainjobart/vitess","description":"vitess provides servers and tools which facilitate scaling of MySQL databases for large scale web services.","fork":true,"url":"https://api.github.com/repos/alainjobart/vitess","forks_url":"https://api.github.com/repos/alainjobart/vitess/forks","keys_url":"https://api.github.com/repos/alainjobart/vitess/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alainjobart/vitess/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alainjobart/vitess/teams","hooks_url":"https://api.github.com/repos/alainjobart/vitess/hooks","issue_events_url":"https://api.github.com/repos/alainjobart/vitess/issues/events{/number}","events_url":"https://api.github.com/repos/alainjobart/vitess/events","assignees_url":"https://api.github.com/repos/alainjobart/vitess/assignees{/user}","branches_url":"https://api.github.com/repos/alainjobart/vitess/branches{/branch}","tags_url":"https://api.github.com/repos/alainjobart/vitess/tags","blobs_url":"https://api.github.com/repos/alainjobart/vitess/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alainjobart/vitess/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alainjobart/vitess/git/refs{/sha}","trees_url":"https://api.github.com/repos/alainjobart/vitess/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alainjobart/vitess/statuses/{sha}","languages_url":"https://api.github.com/repos/alainjobart/vitess/languages","stargazers_url":"https://api.github.com/repos/alainjobart/vitess/stargazers","contributors_url":"https://api.github.com/repos/alainjobart/vitess/contributors","subscribers_url":"https://api.github.com/repos/alainjobart/vitess/subscribers","subscription_url":"https://api.github.com/repos/alainjobart/vitess/subscription","commits_url":"https://api.github.com/repos/alainjobart/vitess/commits{/sha}","git_commits_url":"https://api.github.com/repos/alainjobart/vitess/git/commits{/sha}","comments_url":"https://api.github.com/repos/alainjobart/vitess/comments{/number}","issue_comment_url":"https://api.github.com/repos/alainjobart/vitess/issues/comments{/number}","contents_url":"https://api.github.com/repos/alainjobart/vitess/contents/{+path}","compare_url":"https://api.github.com/repos/alainjobart/vitess/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alainjobart/vitess/merges","archive_url":"https://api.github.com/repos/alainjobart/vitess/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alainjobart/vitess/downloads","issues_url":"https://api.github.com/repos/alainjobart/vitess/issues{/number}","pulls_url":"https://api.github.com/repos/alainjobart/vitess/pulls{/number}","milestones_url":"https://api.github.com/repos/alainjobart/vitess/milestones{/number}","notifications_url":"https://api.github.com/repos/alainjobart/vitess/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alainjobart/vitess/labels{/name}","releases_url":"https://api.github.com/repos/alainjobart/vitess/releases{/id}","deployments_url":"https://api.github.com/repos/alainjobart/vitess/deployments","created_at":"2015-06-12T20:07:42Z","updated_at":"2016-06-30T23:25:30Z","pushed_at":"2016-10-03T17:12:52Z","git_url":"git://github.com/alainjobart/vitess.git","ssh_url":"git@github.com:alainjobart/vitess.git","clone_url":"https://github.com/alainjobart/vitess.git","svn_url":"https://github.com/alainjobart/vitess","homepage":null,"size":63900,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"youtube:master","ref":"master","sha":"fc419acc5520e07afa0062ddd7a20e222a42fa27","user":{"login":"youtube","id":4052902,"avatar_url":"https://avatars.githubusercontent.com/u/4052902?v=3","gravatar_id":"","url":"https://api.github.com/users/youtube","html_url":"https://github.com/youtube","followers_url":"https://api.github.com/users/youtube/followers","following_url":"https://api.github.com/users/youtube/following{/other_user}","gists_url":"https://api.github.com/users/youtube/gists{/gist_id}","starred_url":"https://api.github.com/users/youtube/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youtube/subscriptions","organizations_url":"https://api.github.com/users/youtube/orgs","repos_url":"https://api.github.com/users/youtube/repos","events_url":"https://api.github.com/users/youtube/events{/privacy}","received_events_url":"https://api.github.com/users/youtube/received_events","type":"Organization","site_admin":false},"repo":{"id":11008207,"name":"vitess","full_name":"youtube/vitess","owner":{"login":"youtube","id":4052902,"avatar_url":"https://avatars.githubusercontent.com/u/4052902?v=3","gravatar_id":"","url":"https://api.github.com/users/youtube","html_url":"https://github.com/youtube","followers_url":"https://api.github.com/users/youtube/followers","following_url":"https://api.github.com/users/youtube/following{/other_user}","gists_url":"https://api.github.com/users/youtube/gists{/gist_id}","starred_url":"https://api.github.com/users/youtube/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youtube/subscriptions","organizations_url":"https://api.github.com/users/youtube/orgs","repos_url":"https://api.github.com/users/youtube/repos","events_url":"https://api.github.com/users/youtube/events{/privacy}","received_events_url":"https://api.github.com/users/youtube/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/youtube/vitess","description":"Vitess is a database clustering system for horizontal scaling of MySQL.","fork":false,"url":"https://api.github.com/repos/youtube/vitess","forks_url":"https://api.github.com/repos/youtube/vitess/forks","keys_url":"https://api.github.com/repos/youtube/vitess/keys{/key_id}","collaborators_url":"https://api.github.com/repos/youtube/vitess/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/youtube/vitess/teams","hooks_url":"https://api.github.com/repos/youtube/vitess/hooks","issue_events_url":"https://api.github.com/repos/youtube/vitess/issues/events{/number}","events_url":"https://api.github.com/repos/youtube/vitess/events","assignees_url":"https://api.github.com/repos/youtube/vitess/assignees{/user}","branches_url":"https://api.github.com/repos/youtube/vitess/branches{/branch}","tags_url":"https://api.github.com/repos/youtube/vitess/tags","blobs_url":"https://api.github.com/repos/youtube/vitess/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/youtube/vitess/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/youtube/vitess/git/refs{/sha}","trees_url":"https://api.github.com/repos/youtube/vitess/git/trees{/sha}","statuses_url":"https://api.github.com/repos/youtube/vitess/statuses/{sha}","languages_url":"https://api.github.com/repos/youtube/vitess/languages","stargazers_url":"https://api.github.com/repos/youtube/vitess/stargazers","contributors_url":"https://api.github.com/repos/youtube/vitess/contributors","subscribers_url":"https://api.github.com/repos/youtube/vitess/subscribers","subscription_url":"https://api.github.com/repos/youtube/vitess/subscription","commits_url":"https://api.github.com/repos/youtube/vitess/commits{/sha}","git_commits_url":"https://api.github.com/repos/youtube/vitess/git/commits{/sha}","comments_url":"https://api.github.com/repos/youtube/vitess/comments{/number}","issue_comment_url":"https://api.github.com/repos/youtube/vitess/issues/comments{/number}","contents_url":"https://api.github.com/repos/youtube/vitess/contents/{+path}","compare_url":"https://api.github.com/repos/youtube/vitess/compare/{base}...{head}","merges_url":"https://api.github.com/repos/youtube/vitess/merges","archive_url":"https://api.github.com/repos/youtube/vitess/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/youtube/vitess/downloads","issues_url":"https://api.github.com/repos/youtube/vitess/issues{/number}","pulls_url":"https://api.github.com/repos/youtube/vitess/pulls{/number}","milestones_url":"https://api.github.com/repos/youtube/vitess/milestones{/number}","notifications_url":"https://api.github.com/repos/youtube/vitess/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/youtube/vitess/labels{/name}","releases_url":"https://api.github.com/repos/youtube/vitess/releases{/id}","deployments_url":"https://api.github.com/repos/youtube/vitess/deployments","created_at":"2013-06-27T21:20:28Z","updated_at":"2016-10-04T10:13:21Z","pushed_at":"2016-10-04T07:19:02Z","git_url":"git://github.com/youtube/vitess.git","ssh_url":"git@github.com:youtube/vitess.git","clone_url":"https://github.com/youtube/vitess.git","svn_url":"https://github.com/youtube/vitess","homepage":"http://vitess.io","size":92042,"stargazers_count":3910,"watchers_count":3910,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":506,"mirror_url":null,"open_issues_count":19,"forks":506,"open_issues":19,"watchers":3910,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/youtube/vitess/pulls/2100"},"html":{"href":"https://github.com/youtube/vitess/pull/2100"},"issue":{"href":"https://api.github.com/repos/youtube/vitess/issues/2100"},"comments":{"href":"https://api.github.com/repos/youtube/vitess/issues/2100/comments"},"review_comments":{"href":"https://api.github.com/repos/youtube/vitess/pulls/2100/comments"},"review_comment":{"href":"https://api.github.com/repos/youtube/vitess/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/youtube/vitess/pulls/2100/commits"},"statuses":{"href":"https://api.github.com/repos/youtube/vitess/statuses/f5955fdbac8580d870be845dacd186608cc0c318"}}}}
{"actor":{"display_login":"alainjobart"}}