{"action":"created","comment":{"url":"https://api.github.com/repos/apache/reef/pulls/comments/66360224","id":66360224,"diff_hunk":"@@ -98,181 +128,457 @@ internal sealed class IMRUDriver<TMapInput, TMapOutput, TResult, TPartitionType>\n             [Parameter(typeof(MemoryPerMapper))] int memoryPerMapper,\n             [Parameter(typeof(MemoryForUpdateTask))] int memoryForUpdateTask,\n             [Parameter(typeof(AllowedFailedEvaluatorsFraction))] double failedEvaluatorsFraction,\n+            [Parameter(typeof(MaxRetryNumberInRecovery))] int maxRetryNumberInRecovery,\n             [Parameter(typeof(InvokeGC))] bool invokeGC,\n             IGroupCommDriver groupCommDriver)\n         {\n             _configurationManager = configurationManager;\n-            _evaluatorRequestor = evaluatorRequestor;\n             _groupCommDriver = groupCommDriver;\n-            _coresPerMapper = coresPerMapper;\n-            _coresForUpdateTask = coresForUpdateTask;\n-            _memoryPerMapper = memoryPerMapper;\n-            _memoryForUpdateTask = memoryForUpdateTask;\n             _perMapperConfigs = perMapperConfigs;\n             _totalMappers = dataSet.Count;\n-\n-            _allowedFailedEvaluators = (int)(failedEvaluatorsFraction * dataSet.Count);\n             _invokeGC = invokeGC;\n+            _maxRetryNumberForFaultTolerant = maxRetryNumberInRecovery;\n+\n+            _contextManager = new ActiveContextManager(_totalMappers + 1);\n+            _contextManager.Subscribe(this);\n+\n+            var updateSpec = new EvaluatorSpecification(memoryForUpdateTask, coresForUpdateTask);\n+            var mapperSpec = new EvaluatorSpecification(memoryPerMapper, coresPerMapper);\n+            var allowedFailedEvaluators = (int)(failedEvaluatorsFraction * dataSet.Count);\n+            _evaluatorManager = new EvaluatorManager(_totalMappers + 1, allowedFailedEvaluators, evaluatorRequestor, updateSpec, mapperSpec);\n+\n+            _taskManager = new TaskManager(_totalMappers + 1, _groupCommDriver.MasterTaskId);\n \n-            AddGroupCommunicationOperators();\n-            _groupCommTaskStarter = new TaskStarter(_groupCommDriver, _totalMappers + 1);\n-            _perMapperConfiguration = ConstructPerMapperConfigStack(_totalMappers);\n             _serviceAndContextConfigurationProvider =\n                 new ServiceAndContextConfigurationProvider<TMapInput, TMapOutput, TPartitionType>(dataSet);\n \n             var msg =\n-                string.Format(\"map task memory:{0}, update task memory:{1}, map task cores:{2}, update task cores:{3}\",\n-                    _memoryPerMapper,\n-                    _memoryForUpdateTask,\n-                    _coresPerMapper,\n-                    _coresForUpdateTask);\n+                string.Format(CultureInfo.InvariantCulture, \"map task memory:{0}, update task memory:{1}, map task cores:{2}, update task cores:{3}\",\n+                    memoryPerMapper,\n+                    memoryForUpdateTask,\n+                    coresPerMapper,\n+                    coresForUpdateTask);\n             Logger.Log(Level.Info, msg);\n         }\n \n+        #region IDriverStarted\n         /// <summary>\n-        /// Requests for evaluator for update task\n+        /// Requests evaluators when driver starts\n         /// </summary>\n         /// <param name=\"value\">Event fired when driver started</param>\n         public void OnNext(IDriverStarted value)\n         {\n-            RequestUpdateEvaluator();\n-            //// TODO[REEF-598]: Set a timeout for this request to be satisfied. If it is not within that time, exit the Driver.\n+            StartAction();\n         }\n+        #endregion IDriverStarted\n \n+        #region IAllocatedEvaluator\n         /// <summary>\n-        /// Specifies context and service configuration for evaluator depending\n-        /// on whether it is for Update function or for map function\n+        /// IAllocatedEvaluator handler. It will take the following action based on the system state:\n+        /// Case WaitingForEvaluator\n+        ///    Add Evaluator to the Evaluator Manager\n+        ///    submit Context and Services\n+        /// Case Fail\n+        ///    Do nothing. This is because the code that sets system Fail has executed FailedAction. It has shut down all the allocated evaluators/contexts. \n+        ///    If a new IAllocatedEvaluator comes after it, we should not submit anything so that the evaluator is returned.\n+        /// Other cases - not expected\n         /// </summary>\n         /// <param name=\"allocatedEvaluator\">The allocated evaluator</param>\n         public void OnNext(IAllocatedEvaluator allocatedEvaluator)\n         {\n-            var configs =\n-                _serviceAndContextConfigurationProvider.GetContextConfigurationForEvaluatorById(allocatedEvaluator.Id);\n-            allocatedEvaluator.SubmitContextAndService(configs.Context, configs.Service);\n+            Logger.Log(Level.Verbose, string.Format(CultureInfo.InvariantCulture, \"AllocatedEvaluator EvaluatorBatchId [{0}], memory [{1}], systemState {2}.\", allocatedEvaluator.EvaluatorBatchId, allocatedEvaluator.GetEvaluatorDescriptor().Memory, _systemState.CurrentState));","path":"lang/cs/Org.Apache.REEF.IMRU/OnREEF/Driver/IMRUDriver.cs","position":203,"original_position":203,"commit_id":"cc1f69325be36ee0b1aaacb8aa03d254c71e903e","original_commit_id":"cc1f69325be36ee0b1aaacb8aa03d254c71e903e","user":{"login":"afchung","id":2817619,"avatar_url":"https://avatars.githubusercontent.com/u/2817619?v=3","gravatar_id":"","url":"https://api.github.com/users/afchung","html_url":"https://github.com/afchung","followers_url":"https://api.github.com/users/afchung/followers","following_url":"https://api.github.com/users/afchung/following{/other_user}","gists_url":"https://api.github.com/users/afchung/gists{/gist_id}","starred_url":"https://api.github.com/users/afchung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afchung/subscriptions","organizations_url":"https://api.github.com/users/afchung/orgs","repos_url":"https://api.github.com/users/afchung/repos","events_url":"https://api.github.com/users/afchung/events{/privacy}","received_events_url":"https://api.github.com/users/afchung/received_events","type":"User","site_admin":false},"body":"No need for `string.Format`.","created_at":"2016-06-08T23:39:23Z","updated_at":"2016-06-08T23:39:23Z","html_url":"https://github.com/apache/reef/pull/1033#discussion_r66360224","pull_request_url":"https://api.github.com/repos/apache/reef/pulls/1033","_links":{"self":{"href":"https://api.github.com/repos/apache/reef/pulls/comments/66360224"},"html":{"href":"https://github.com/apache/reef/pull/1033#discussion_r66360224"},"pull_request":{"href":"https://api.github.com/repos/apache/reef/pulls/1033"}}},"pull_request":{"url":"https://api.github.com/repos/apache/reef/pulls/1033","id":72822636,"html_url":"https://github.com/apache/reef/pull/1033","diff_url":"https://github.com/apache/reef/pull/1033.diff","patch_url":"https://github.com/apache/reef/pull/1033.patch","issue_url":"https://api.github.com/repos/apache/reef/issues/1033","number":1033,"state":"open","locked":false,"title":"[REEF-1251] IMRU Driver handlers for fault tolerant","user":{"login":"jwang98052","id":5666504,"avatar_url":"https://avatars.githubusercontent.com/u/5666504?v=3","gravatar_id":"","url":"https://api.github.com/users/jwang98052","html_url":"https://github.com/jwang98052","followers_url":"https://api.github.com/users/jwang98052/followers","following_url":"https://api.github.com/users/jwang98052/following{/other_user}","gists_url":"https://api.github.com/users/jwang98052/gists{/gist_id}","starred_url":"https://api.github.com/users/jwang98052/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwang98052/subscriptions","organizations_url":"https://api.github.com/users/jwang98052/orgs","repos_url":"https://api.github.com/users/jwang98052/repos","events_url":"https://api.github.com/users/jwang98052/events{/privacy}","received_events_url":"https://api.github.com/users/jwang98052/received_events","type":"User","site_admin":false},"body":"* IMRU Driver handler re-write to support fault tolerant\r\n* ServiceAndContextConfigurationProvider refactor and clean up for the updated IMRU driver\r\n* IMRUClient update to use the updated IMRUDriver\r\n* Minor changes in ActiveContextManager\r\n* Test case will follow after REEF-1408 is merged.\r\n\r\nJIRA: [REEF-1251](https://issues.apache.org/jira/browse/REEF-1251)\r\nThis closes","created_at":"2016-06-07T06:36:31Z","updated_at":"2016-06-08T23:39:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e8acb239a9c47824fd58de5593a848f74365aa63","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/reef/pulls/1033/commits","review_comments_url":"https://api.github.com/repos/apache/reef/pulls/1033/comments","review_comment_url":"https://api.github.com/repos/apache/reef/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/reef/issues/1033/comments","statuses_url":"https://api.github.com/repos/apache/reef/statuses/cc1f69325be36ee0b1aaacb8aa03d254c71e903e","head":{"label":"jwang98052:REEF-1251","ref":"REEF-1251","sha":"cc1f69325be36ee0b1aaacb8aa03d254c71e903e","user":{"login":"jwang98052","id":5666504,"avatar_url":"https://avatars.githubusercontent.com/u/5666504?v=3","gravatar_id":"","url":"https://api.github.com/users/jwang98052","html_url":"https://github.com/jwang98052","followers_url":"https://api.github.com/users/jwang98052/followers","following_url":"https://api.github.com/users/jwang98052/following{/other_user}","gists_url":"https://api.github.com/users/jwang98052/gists{/gist_id}","starred_url":"https://api.github.com/users/jwang98052/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwang98052/subscriptions","organizations_url":"https://api.github.com/users/jwang98052/orgs","repos_url":"https://api.github.com/users/jwang98052/repos","events_url":"https://api.github.com/users/jwang98052/events{/privacy}","received_events_url":"https://api.github.com/users/jwang98052/received_events","type":"User","site_admin":false},"repo":{"id":25940156,"name":"reef","full_name":"jwang98052/reef","owner":{"login":"jwang98052","id":5666504,"avatar_url":"https://avatars.githubusercontent.com/u/5666504?v=3","gravatar_id":"","url":"https://api.github.com/users/jwang98052","html_url":"https://github.com/jwang98052","followers_url":"https://api.github.com/users/jwang98052/followers","following_url":"https://api.github.com/users/jwang98052/following{/other_user}","gists_url":"https://api.github.com/users/jwang98052/gists{/gist_id}","starred_url":"https://api.github.com/users/jwang98052/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwang98052/subscriptions","organizations_url":"https://api.github.com/users/jwang98052/orgs","repos_url":"https://api.github.com/users/jwang98052/repos","events_url":"https://api.github.com/users/jwang98052/events{/privacy}","received_events_url":"https://api.github.com/users/jwang98052/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jwang98052/reef","description":"Mirror of Apache REEF (Incubating)","fork":true,"url":"https://api.github.com/repos/jwang98052/reef","forks_url":"https://api.github.com/repos/jwang98052/reef/forks","keys_url":"https://api.github.com/repos/jwang98052/reef/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jwang98052/reef/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jwang98052/reef/teams","hooks_url":"https://api.github.com/repos/jwang98052/reef/hooks","issue_events_url":"https://api.github.com/repos/jwang98052/reef/issues/events{/number}","events_url":"https://api.github.com/repos/jwang98052/reef/events","assignees_url":"https://api.github.com/repos/jwang98052/reef/assignees{/user}","branches_url":"https://api.github.com/repos/jwang98052/reef/branches{/branch}","tags_url":"https://api.github.com/repos/jwang98052/reef/tags","blobs_url":"https://api.github.com/repos/jwang98052/reef/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jwang98052/reef/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jwang98052/reef/git/refs{/sha}","trees_url":"https://api.github.com/repos/jwang98052/reef/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jwang98052/reef/statuses/{sha}","languages_url":"https://api.github.com/repos/jwang98052/reef/languages","stargazers_url":"https://api.github.com/repos/jwang98052/reef/stargazers","contributors_url":"https://api.github.com/repos/jwang98052/reef/contributors","subscribers_url":"https://api.github.com/repos/jwang98052/reef/subscribers","subscription_url":"https://api.github.com/repos/jwang98052/reef/subscription","commits_url":"https://api.github.com/repos/jwang98052/reef/commits{/sha}","git_commits_url":"https://api.github.com/repos/jwang98052/reef/git/commits{/sha}","comments_url":"https://api.github.com/repos/jwang98052/reef/comments{/number}","issue_comment_url":"https://api.github.com/repos/jwang98052/reef/issues/comments{/number}","contents_url":"https://api.github.com/repos/jwang98052/reef/contents/{+path}","compare_url":"https://api.github.com/repos/jwang98052/reef/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jwang98052/reef/merges","archive_url":"https://api.github.com/repos/jwang98052/reef/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jwang98052/reef/downloads","issues_url":"https://api.github.com/repos/jwang98052/reef/issues{/number}","pulls_url":"https://api.github.com/repos/jwang98052/reef/pulls{/number}","milestones_url":"https://api.github.com/repos/jwang98052/reef/milestones{/number}","notifications_url":"https://api.github.com/repos/jwang98052/reef/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jwang98052/reef/labels{/name}","releases_url":"https://api.github.com/repos/jwang98052/reef/releases{/id}","deployments_url":"https://api.github.com/repos/jwang98052/reef/deployments","created_at":"2014-10-29T20:32:40Z","updated_at":"2016-06-01T23:24:31Z","pushed_at":"2016-06-08T20:23:50Z","git_url":"git://github.com/jwang98052/reef.git","ssh_url":"git@github.com:jwang98052/reef.git","clone_url":"https://github.com/jwang98052/reef.git","svn_url":"https://github.com/jwang98052/reef","homepage":null,"size":37362,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"apache:master","ref":"master","sha":"b5c807ad6f076202c1e922b91d5596995f1aa336","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":25623941,"name":"reef","full_name":"apache/reef","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/reef","description":"Mirror of Apache REEF","fork":false,"url":"https://api.github.com/repos/apache/reef","forks_url":"https://api.github.com/repos/apache/reef/forks","keys_url":"https://api.github.com/repos/apache/reef/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/reef/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/reef/teams","hooks_url":"https://api.github.com/repos/apache/reef/hooks","issue_events_url":"https://api.github.com/repos/apache/reef/issues/events{/number}","events_url":"https://api.github.com/repos/apache/reef/events","assignees_url":"https://api.github.com/repos/apache/reef/assignees{/user}","branches_url":"https://api.github.com/repos/apache/reef/branches{/branch}","tags_url":"https://api.github.com/repos/apache/reef/tags","blobs_url":"https://api.github.com/repos/apache/reef/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/reef/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/reef/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/reef/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/reef/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/reef/languages","stargazers_url":"https://api.github.com/repos/apache/reef/stargazers","contributors_url":"https://api.github.com/repos/apache/reef/contributors","subscribers_url":"https://api.github.com/repos/apache/reef/subscribers","subscription_url":"https://api.github.com/repos/apache/reef/subscription","commits_url":"https://api.github.com/repos/apache/reef/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/reef/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/reef/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/reef/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/reef/contents/{+path}","compare_url":"https://api.github.com/repos/apache/reef/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/reef/merges","archive_url":"https://api.github.com/repos/apache/reef/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/reef/downloads","issues_url":"https://api.github.com/repos/apache/reef/issues{/number}","pulls_url":"https://api.github.com/repos/apache/reef/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/reef/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/reef/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/reef/labels{/name}","releases_url":"https://api.github.com/repos/apache/reef/releases{/id}","deployments_url":"https://api.github.com/repos/apache/reef/deployments","created_at":"2014-10-23T07:00:10Z","updated_at":"2016-05-26T20:59:10Z","pushed_at":"2016-06-08T20:38:53Z","git_url":"git://github.com/apache/reef.git","ssh_url":"git@github.com:apache/reef.git","clone_url":"https://github.com/apache/reef.git","svn_url":"https://github.com/apache/reef","homepage":"","size":48518,"stargazers_count":51,"watchers_count":51,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":58,"mirror_url":"git://git.apache.org/reef.git","open_issues_count":9,"forks":58,"open_issues":9,"watchers":51,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/reef/pulls/1033"},"html":{"href":"https://github.com/apache/reef/pull/1033"},"issue":{"href":"https://api.github.com/repos/apache/reef/issues/1033"},"comments":{"href":"https://api.github.com/repos/apache/reef/issues/1033/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/reef/pulls/1033/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/reef/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/reef/pulls/1033/commits"},"statuses":{"href":"https://api.github.com/repos/apache/reef/statuses/cc1f69325be36ee0b1aaacb8aa03d254c71e903e"}}}}
{"actor":{"display_login":"afchung"}}