Repository: reef Updated Branches: refs/heads/REEF-335 72ecec743 -> b759764c7
[REEF-1910] Fix TestResubmitEvaluator unit test failure Fix concurrency issue in the test driver. JIRA: [REEF-1910](https://issues.apache.org/jira/browse/REEF-1910) Pull Request: This closes #1400 Project: http://git-wip-us.apache.org/repos/asf/reef/repo Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/e147293f Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/e147293f Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/e147293f Branch: refs/heads/REEF-335 Commit: e147293f2f6635171851aaabbd220e11d7465642 Parents: 72ecec7 Author: Julia Wang <[email protected]> Authored: Wed Oct 25 11:57:29 2017 -0700 Committer: Markus Weimer <[email protected]> Committed: Wed Oct 25 15:07:31 2017 -0700 ---------------------------------------------------------------------- .../Functional/FaultTolerant/TestResubmitEvaluator.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/reef/blob/e147293f/lang/cs/Org.Apache.REEF.Tests/Functional/FaultTolerant/TestResubmitEvaluator.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tests/Functional/FaultTolerant/TestResubmitEvaluator.cs b/lang/cs/Org.Apache.REEF.Tests/Functional/FaultTolerant/TestResubmitEvaluator.cs index d0bddde..bb96848 100644 --- a/lang/cs/Org.Apache.REEF.Tests/Functional/FaultTolerant/TestResubmitEvaluator.cs +++ b/lang/cs/Org.Apache.REEF.Tests/Functional/FaultTolerant/TestResubmitEvaluator.cs @@ -103,8 +103,8 @@ namespace Org.Apache.REEF.Tests.Functional.FaultTolerant private static readonly Logger Logger = Logger.GetLogger(typeof(ResubmitEvaluatorDriver)); private readonly IEvaluatorRequestor _requestor; - private int _taskNumber = 1; - private int _contextNumber = 1; + private int _taskNumber; + private int _contextNumber; private string _failedContextId; private string _failedTaskId = TaskId + "1"; private readonly ISet<ICompletedTask> _completedTasks = new HashSet<ICompletedTask>(); @@ -126,21 +126,19 @@ namespace Org.Apache.REEF.Tests.Functional.FaultTolerant Logger.Log(Level.Info, "AllocatedEvaluator: " + value.Id); value.SubmitContext( ContextConfiguration.ConfigurationModule - .Set(ContextConfiguration.Identifier, ContextId + _contextNumber) + .Set(ContextConfiguration.Identifier, ContextId + Interlocked.Increment(ref _contextNumber)) .Build()); - Interlocked.Increment(ref _contextNumber); } public void OnNext(IActiveContext value) { Logger.Log(Level.Info, "ActiveContext: " + value.Id); value.SubmitTask(TaskConfiguration.ConfigurationModule - .Set(TaskConfiguration.Identifier, TaskId + _taskNumber) + .Set(TaskConfiguration.Identifier, TaskId + Interlocked.Increment(ref _taskNumber)) .Set(TaskConfiguration.Task, GenericType<FailEvaluatorTask>.Class) .Set(TaskConfiguration.OnMessage, GenericType<FailEvaluatorTask>.Class) .Set(TaskConfiguration.OnClose, GenericType<FailEvaluatorTask>.Class) .Build()); - Interlocked.Increment(ref _taskNumber); } public void OnNext(IRunningTask value)
