{"action":"created","comment":{"url":"https://api.github.com/repos/bluebore/galaxy/pulls/comments/37693943","id":37693943,"diff_hunk":"@@ -865,5 +759,183 @@ Status JobManager::GetJobInfo(const JobId& jobid, JobInfo* job_info) {\n     return kOk;\n }\n \n+bool JobManager::BuildPodFsm(PodStatus* pod, Job* job) {\n+    mutex_.AssertHeld();\n+    if (pod == NULL || job == NULL) {\n+        LOG(WARNING, \"invalidate pod input\");\n+        return false;\n+    }\n+    std::map<PodId, std::map<std::string, Handle> >::iterator it = fsm_.find(pod->podid());\n+    if (it != fsm_.end()) {\n+        LOG(WARNING, \"fsm has been built for pod %s\", pod->podid().c_str());\n+        return true;\n+    }\n+    std::map<std::string, Handle>& handler_map = fsm_[pod->podid()];\n+    LOG(INFO, \"build fsm for pod %s\", pod->podid().c_str());\n+    handler_map.insert(std::make_pair(BuildHandlerKey(kStagePending, kStageRemoved), \n+          boost::bind(&JobManager::HandlePendingToRemoved, this, pod, job)));\n+    handler_map.insert(std::make_pair(BuildHandlerKey(kStagePending, kStageRunning), \n+          boost::bind(&JobManager::HandlePendingToRunning, this, pod, job)));\n+    handler_map.insert(std::make_pair(BuildHandlerKey(kStageRunning, kStageDeath), \n+          boost::bind(&JobManager::HandleRunningToDeath, this, pod, job)));\n+    handler_map.insert(std::make_pair(BuildHandlerKey(kStageRunning, kStageRemoved), \n+          boost::bind(&JobManager::HandleRunningToDeath, this, pod, job)));\n+    handler_map.insert(std::make_pair(BuildHandlerKey(kStageRunning, kStageRunning), \n+          boost::bind(&JobManager::HandleDoNothing, this)));\n+    handler_map.insert(std::make_pair(BuildHandlerKey(kStageDeath, kStageDeath), \n+          boost::bind(&JobManager::HandleDoNothing, this)));\n+    handler_map.insert(std::make_pair(BuildHandlerKey(kStageDeath, kStagePending), \n+          boost::bind(&JobManager::HandleDeathToPending, this, pod, job)));\n+    \n+    handler_map.insert(std::make_pair(BuildHandlerKey(kStageDeath, kStageRemoved), \n+          boost::bind(&JobManager::HandlePendingToRemoved, this, pod, job)));","path":"src/master/job_manager.cc","position":697,"original_position":697,"commit_id":"07f8fc430e05ce8b21b6d61e55634ec88905e498","original_commit_id":"07f8fc430e05ce8b21b6d61e55634ec88905e498","user":{"login":"fxsjy","id":167837,"avatar_url":"https://avatars.githubusercontent.com/u/167837?v=3","gravatar_id":"","url":"https://api.github.com/users/fxsjy","html_url":"https://github.com/fxsjy","followers_url":"https://api.github.com/users/fxsjy/followers","following_url":"https://api.github.com/users/fxsjy/following{/other_user}","gists_url":"https://api.github.com/users/fxsjy/gists{/gist_id}","starred_url":"https://api.github.com/users/fxsjy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fxsjy/subscriptions","organizations_url":"https://api.github.com/users/fxsjy/orgs","repos_url":"https://api.github.com/users/fxsjy/repos","events_url":"https://api.github.com/users/fxsjy/events{/privacy}","received_events_url":"https://api.github.com/users/fxsjy/received_events","type":"User","site_admin":false},"body":"death->removed 和 pending->removed都共用HandlePendingToRemoved一个处理函数吗？","created_at":"2015-08-22T08:03:19Z","updated_at":"2015-08-22T08:03:19Z","html_url":"https://github.com/bluebore/galaxy/pull/189#discussion_r37693943","pull_request_url":"https://api.github.com/repos/bluebore/galaxy/pulls/189","_links":{"self":{"href":"https://api.github.com/repos/bluebore/galaxy/pulls/comments/37693943"},"html":{"href":"https://github.com/bluebore/galaxy/pull/189#discussion_r37693943"},"pull_request":{"href":"https://api.github.com/repos/bluebore/galaxy/pulls/189"}}},"pull_request":{"url":"https://api.github.com/repos/bluebore/galaxy/pulls/189","id":43046306,"html_url":"https://github.com/bluebore/galaxy/pull/189","diff_url":"https://github.com/bluebore/galaxy/pull/189.diff","patch_url":"https://github.com/bluebore/galaxy/pull/189.patch","issue_url":"https://api.github.com/repos/bluebore/galaxy/issues/189","number":189,"state":"open","locked":false,"title":"support scale up & scale down","user":{"login":"imotai","id":8623385,"avatar_url":"https://avatars.githubusercontent.com/u/8623385?v=3","gravatar_id":"","url":"https://api.github.com/users/imotai","html_url":"https://github.com/imotai","followers_url":"https://api.github.com/users/imotai/followers","following_url":"https://api.github.com/users/imotai/following{/other_user}","gists_url":"https://api.github.com/users/imotai/gists{/gist_id}","starred_url":"https://api.github.com/users/imotai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imotai/subscriptions","organizations_url":"https://api.github.com/users/imotai/orgs","repos_url":"https://api.github.com/users/imotai/repos","events_url":"https://api.github.com/users/imotai/events{/privacy}","received_events_url":"https://api.github.com/users/imotai/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-21T14:53:56Z","updated_at":"2015-08-22T08:03:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8e0760dff1451303cb67d50d0eb9fa79d188e95f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bluebore/galaxy/pulls/189/commits","review_comments_url":"https://api.github.com/repos/bluebore/galaxy/pulls/189/comments","review_comment_url":"https://api.github.com/repos/bluebore/galaxy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bluebore/galaxy/issues/189/comments","statuses_url":"https://api.github.com/repos/bluebore/galaxy/statuses/07f8fc430e05ce8b21b6d61e55634ec88905e498","head":{"label":"imotai:pods_on_agent","ref":"pods_on_agent","sha":"07f8fc430e05ce8b21b6d61e55634ec88905e498","user":{"login":"imotai","id":8623385,"avatar_url":"https://avatars.githubusercontent.com/u/8623385?v=3","gravatar_id":"","url":"https://api.github.com/users/imotai","html_url":"https://github.com/imotai","followers_url":"https://api.github.com/users/imotai/followers","following_url":"https://api.github.com/users/imotai/following{/other_user}","gists_url":"https://api.github.com/users/imotai/gists{/gist_id}","starred_url":"https://api.github.com/users/imotai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imotai/subscriptions","organizations_url":"https://api.github.com/users/imotai/orgs","repos_url":"https://api.github.com/users/imotai/repos","events_url":"https://api.github.com/users/imotai/events{/privacy}","received_events_url":"https://api.github.com/users/imotai/received_events","type":"User","site_admin":false},"repo":{"id":40952248,"name":"galaxy","full_name":"imotai/galaxy","owner":{"login":"imotai","id":8623385,"avatar_url":"https://avatars.githubusercontent.com/u/8623385?v=3","gravatar_id":"","url":"https://api.github.com/users/imotai","html_url":"https://github.com/imotai","followers_url":"https://api.github.com/users/imotai/followers","following_url":"https://api.github.com/users/imotai/following{/other_user}","gists_url":"https://api.github.com/users/imotai/gists{/gist_id}","starred_url":"https://api.github.com/users/imotai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imotai/subscriptions","organizations_url":"https://api.github.com/users/imotai/orgs","repos_url":"https://api.github.com/users/imotai/repos","events_url":"https://api.github.com/users/imotai/events{/privacy}","received_events_url":"https://api.github.com/users/imotai/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/imotai/galaxy","description":"Galaxy is a cluster management system.","fork":true,"url":"https://api.github.com/repos/imotai/galaxy","forks_url":"https://api.github.com/repos/imotai/galaxy/forks","keys_url":"https://api.github.com/repos/imotai/galaxy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/imotai/galaxy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/imotai/galaxy/teams","hooks_url":"https://api.github.com/repos/imotai/galaxy/hooks","issue_events_url":"https://api.github.com/repos/imotai/galaxy/issues/events{/number}","events_url":"https://api.github.com/repos/imotai/galaxy/events","assignees_url":"https://api.github.com/repos/imotai/galaxy/assignees{/user}","branches_url":"https://api.github.com/repos/imotai/galaxy/branches{/branch}","tags_url":"https://api.github.com/repos/imotai/galaxy/tags","blobs_url":"https://api.github.com/repos/imotai/galaxy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/imotai/galaxy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/imotai/galaxy/git/refs{/sha}","trees_url":"https://api.github.com/repos/imotai/galaxy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/imotai/galaxy/statuses/{sha}","languages_url":"https://api.github.com/repos/imotai/galaxy/languages","stargazers_url":"https://api.github.com/repos/imotai/galaxy/stargazers","contributors_url":"https://api.github.com/repos/imotai/galaxy/contributors","subscribers_url":"https://api.github.com/repos/imotai/galaxy/subscribers","subscription_url":"https://api.github.com/repos/imotai/galaxy/subscription","commits_url":"https://api.github.com/repos/imotai/galaxy/commits{/sha}","git_commits_url":"https://api.github.com/repos/imotai/galaxy/git/commits{/sha}","comments_url":"https://api.github.com/repos/imotai/galaxy/comments{/number}","issue_comment_url":"https://api.github.com/repos/imotai/galaxy/issues/comments{/number}","contents_url":"https://api.github.com/repos/imotai/galaxy/contents/{+path}","compare_url":"https://api.github.com/repos/imotai/galaxy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/imotai/galaxy/merges","archive_url":"https://api.github.com/repos/imotai/galaxy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/imotai/galaxy/downloads","issues_url":"https://api.github.com/repos/imotai/galaxy/issues{/number}","pulls_url":"https://api.github.com/repos/imotai/galaxy/pulls{/number}","milestones_url":"https://api.github.com/repos/imotai/galaxy/milestones{/number}","notifications_url":"https://api.github.com/repos/imotai/galaxy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/imotai/galaxy/labels{/name}","releases_url":"https://api.github.com/repos/imotai/galaxy/releases{/id}","created_at":"2015-08-18T05:17:43Z","updated_at":"2015-08-18T05:17:44Z","pushed_at":"2015-08-22T05:36:55Z","git_url":"git://github.com/imotai/galaxy.git","ssh_url":"git@github.com:imotai/galaxy.git","clone_url":"https://github.com/imotai/galaxy.git","svn_url":"https://github.com/imotai/galaxy","homepage":"","size":2141,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"refactor"}},"base":{"label":"bluebore:refactor","ref":"refactor","sha":"e36ad0f807ac266f9a016a0293f0f2fcbb442750","user":{"login":"bluebore","id":6851389,"avatar_url":"https://avatars.githubusercontent.com/u/6851389?v=3","gravatar_id":"","url":"https://api.github.com/users/bluebore","html_url":"https://github.com/bluebore","followers_url":"https://api.github.com/users/bluebore/followers","following_url":"https://api.github.com/users/bluebore/following{/other_user}","gists_url":"https://api.github.com/users/bluebore/gists{/gist_id}","starred_url":"https://api.github.com/users/bluebore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluebore/subscriptions","organizations_url":"https://api.github.com/users/bluebore/orgs","repos_url":"https://api.github.com/users/bluebore/repos","events_url":"https://api.github.com/users/bluebore/events{/privacy}","received_events_url":"https://api.github.com/users/bluebore/received_events","type":"User","site_admin":false},"repo":{"id":28955570,"name":"galaxy","full_name":"bluebore/galaxy","owner":{"login":"bluebore","id":6851389,"avatar_url":"https://avatars.githubusercontent.com/u/6851389?v=3","gravatar_id":"","url":"https://api.github.com/users/bluebore","html_url":"https://github.com/bluebore","followers_url":"https://api.github.com/users/bluebore/followers","following_url":"https://api.github.com/users/bluebore/following{/other_user}","gists_url":"https://api.github.com/users/bluebore/gists{/gist_id}","starred_url":"https://api.github.com/users/bluebore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluebore/subscriptions","organizations_url":"https://api.github.com/users/bluebore/orgs","repos_url":"https://api.github.com/users/bluebore/repos","events_url":"https://api.github.com/users/bluebore/events{/privacy}","received_events_url":"https://api.github.com/users/bluebore/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bluebore/galaxy","description":"Galaxy is a cluster management system.","fork":false,"url":"https://api.github.com/repos/bluebore/galaxy","forks_url":"https://api.github.com/repos/bluebore/galaxy/forks","keys_url":"https://api.github.com/repos/bluebore/galaxy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bluebore/galaxy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bluebore/galaxy/teams","hooks_url":"https://api.github.com/repos/bluebore/galaxy/hooks","issue_events_url":"https://api.github.com/repos/bluebore/galaxy/issues/events{/number}","events_url":"https://api.github.com/repos/bluebore/galaxy/events","assignees_url":"https://api.github.com/repos/bluebore/galaxy/assignees{/user}","branches_url":"https://api.github.com/repos/bluebore/galaxy/branches{/branch}","tags_url":"https://api.github.com/repos/bluebore/galaxy/tags","blobs_url":"https://api.github.com/repos/bluebore/galaxy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bluebore/galaxy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bluebore/galaxy/git/refs{/sha}","trees_url":"https://api.github.com/repos/bluebore/galaxy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bluebore/galaxy/statuses/{sha}","languages_url":"https://api.github.com/repos/bluebore/galaxy/languages","stargazers_url":"https://api.github.com/repos/bluebore/galaxy/stargazers","contributors_url":"https://api.github.com/repos/bluebore/galaxy/contributors","subscribers_url":"https://api.github.com/repos/bluebore/galaxy/subscribers","subscription_url":"https://api.github.com/repos/bluebore/galaxy/subscription","commits_url":"https://api.github.com/repos/bluebore/galaxy/commits{/sha}","git_commits_url":"https://api.github.com/repos/bluebore/galaxy/git/commits{/sha}","comments_url":"https://api.github.com/repos/bluebore/galaxy/comments{/number}","issue_comment_url":"https://api.github.com/repos/bluebore/galaxy/issues/comments{/number}","contents_url":"https://api.github.com/repos/bluebore/galaxy/contents/{+path}","compare_url":"https://api.github.com/repos/bluebore/galaxy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bluebore/galaxy/merges","archive_url":"https://api.github.com/repos/bluebore/galaxy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bluebore/galaxy/downloads","issues_url":"https://api.github.com/repos/bluebore/galaxy/issues{/number}","pulls_url":"https://api.github.com/repos/bluebore/galaxy/pulls{/number}","milestones_url":"https://api.github.com/repos/bluebore/galaxy/milestones{/number}","notifications_url":"https://api.github.com/repos/bluebore/galaxy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bluebore/galaxy/labels{/name}","releases_url":"https://api.github.com/repos/bluebore/galaxy/releases{/id}","created_at":"2015-01-08T08:04:16Z","updated_at":"2015-08-12T10:56:17Z","pushed_at":"2015-08-22T05:36:56Z","git_url":"git://github.com/bluebore/galaxy.git","ssh_url":"git@github.com:bluebore/galaxy.git","clone_url":"https://github.com/bluebore/galaxy.git","svn_url":"https://github.com/bluebore/galaxy","homepage":"","size":4449,"stargazers_count":13,"watchers_count":13,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":18,"forks":14,"open_issues":18,"watchers":13,"default_branch":"refactor"}},"_links":{"self":{"href":"https://api.github.com/repos/bluebore/galaxy/pulls/189"},"html":{"href":"https://github.com/bluebore/galaxy/pull/189"},"issue":{"href":"https://api.github.com/repos/bluebore/galaxy/issues/189"},"comments":{"href":"https://api.github.com/repos/bluebore/galaxy/issues/189/comments"},"review_comments":{"href":"https://api.github.com/repos/bluebore/galaxy/pulls/189/comments"},"review_comment":{"href":"https://api.github.com/repos/bluebore/galaxy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bluebore/galaxy/pulls/189/commits"},"statuses":{"href":"https://api.github.com/repos/bluebore/galaxy/statuses/07f8fc430e05ce8b21b6d61e55634ec88905e498"}}}}