Repository: reef
Updated Branches:
  refs/heads/master 3482ace88 -> 50075c244


[REEF-1388] Fix RunningTask to be sent for short-lived .NET tasks

This change:
 * sends RUNNING message immediately before Task.call(), instead of
   relying on time-based heartbeat to report task in Running state.
 * removes Thread.Sleep() calls from tests which don't need them any more.
 * fixes tests which rely on running status improperly.

JIRA:
  [REEF-1388](https://issues.apache.org/jira/browse/REEF-1388)

Pull request:
  This closes #1030


Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/50075c24
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/50075c24
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/50075c24

Branch: refs/heads/master
Commit: 50075c2447e28349fcc6932ecd424dc61da6d26a
Parents: 3482ace
Author: Mariia Mykhailova <[email protected]>
Authored: Wed May 11 15:14:32 2016 -0700
Committer: Andrew Chung <[email protected]>
Committed: Wed Jun 8 11:07:01 2016 -0700

----------------------------------------------------------------------
 .../Runtime/Evaluator/Context/ContextRuntime.cs | 10 +-------
 .../Runtime/Evaluator/Task/TaskRuntime.cs       |  5 ++--
 .../Runtime/Evaluator/Task/TaskStatus.cs        | 27 +++++++++++++++++---
 .../ContextRuntimeTests.cs                      | 14 +++++++---
 .../TaskRuntimeTests.cs                         | 13 +++++++---
 .../TestUtils/TestTask.cs                       |  4 +++
 .../Tasks/HelloTask/HelloTask.cs                |  2 --
 .../Functional/Bridge/TestCloseTask.cs          |  6 ++---
 .../Bridge/TestFailedEvaluatorEventHandler.cs   | 10 ++++----
 .../Functional/Bridge/TestSuspendTask.cs        | 25 +++++++++++++-----
 .../Bridge/TestUnhandledTaskException.cs        |  3 ++-
 .../Functional/RuntimeName/RuntimeNameTask.cs   |  1 -
 .../Functional/RuntimeName/RuntimeNameTest.cs   |  1 +
 13 files changed, 80 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs 
b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs
index 740bb8d..3a49f53 100644
--- a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs
+++ b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs
@@ -440,15 +440,7 @@ namespace Org.Apache.REEF.Common.Runtime.Evaluator.Context
                 }
 
                 var taskStatusProto = _task.Value.GetStatusProto();
-                if (taskStatusProto.state == State.RUNNING)
-                {
-                    // only RUNNING status is allowed to rurn here, all other 
state pushed out to heartbeat 
-                    return Optional<TaskStatusProto>.Of(taskStatusProto);
-                }
-
-                var e = new 
InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Task 
state must be RUNNING, but instead is in {0} state", taskStatusProto.state));
-                Utilities.Diagnostics.Exceptions.Throw(e, LOGGER);
-                return Optional<TaskStatusProto>.Empty();
+                return Optional<TaskStatusProto>.Of(taskStatusProto);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Task/TaskRuntime.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Task/TaskRuntime.cs 
b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Task/TaskRuntime.cs
index f1247cf..6297d2e 100644
--- a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Task/TaskRuntime.cs
+++ b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Task/TaskRuntime.cs
@@ -89,13 +89,14 @@ namespace Org.Apache.REEF.Common.Runtime.Evaluator.Task
                 throw new InvalidOperationException("TaskRun has already been 
called on TaskRuntime.");
             }
 
-            // Send heartbeat such that user receives a TaskRunning message.
-            _currentStatus.SetRunning();
+            _currentStatus.SetInit();
 
             var taskThread = new Thread(() =>
             {
                 try
                 {
+                    Logger.Log(Level.Verbose, "Set running status for task");
+                    _currentStatus.SetRunning();
                     Logger.Log(Level.Verbose, "Calling into user's task.");
                     var result = _userTask.Call(null);
                     Logger.Log(Level.Info, "Task Call Finished");

http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Task/TaskStatus.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Task/TaskStatus.cs 
b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Task/TaskStatus.cs
index 42c62ad..43eb55e 100644
--- a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Task/TaskStatus.cs
+++ b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Task/TaskStatus.cs
@@ -145,21 +145,40 @@ namespace Org.Apache.REEF.Common.Runtime.Evaluator.Task
             }
         }
 
-        public void SetRunning()
+        public void SetInit()
         {
             lock (_heartBeatManager)
             {
-                LOGGER.Log(Level.Verbose, "TaskStatus::SetRunning");
+                LOGGER.Log(Level.Verbose, "TaskStatus::SetInit");
                 if (_state == TaskState.Init)
                 {
                     try
                     {
                         _taskLifeCycle.Start();
-                        
-                        // Need to send an INIT heartbeat to the driver 
prompting it to create an RunningTask event. 
                         LOGGER.Log(Level.Info, "Sending task INIT heartbeat");
                         Heartbeat();
+                    }
+                    catch (Exception e)
+                    {
+                        Utilities.Diagnostics.Exceptions.Caught(e, 
Level.Error, "Cannot set task status to INIT.", LOGGER);
+                        SetException(e);
+                    }
+                }
+            }
+        }
+
+        public void SetRunning()
+        {
+            lock (_heartBeatManager)
+            {
+                LOGGER.Log(Level.Verbose, "TaskStatus::SetRunning");
+                if (_state == TaskState.Init)
+                {
+                    try
+                    {
                         State = TaskState.Running;
+                        LOGGER.Log(Level.Info, "Sending task Running 
heartbeat");
+                        Heartbeat();
                     }
                     catch (Exception e)
                     {

http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Evaluator.Tests/ContextRuntimeTests.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Evaluator.Tests/ContextRuntimeTests.cs 
b/lang/cs/Org.Apache.REEF.Evaluator.Tests/ContextRuntimeTests.cs
index 02a9724..b58544b 100644
--- a/lang/cs/Org.Apache.REEF.Evaluator.Tests/ContextRuntimeTests.cs
+++ b/lang/cs/Org.Apache.REEF.Evaluator.Tests/ContextRuntimeTests.cs
@@ -20,7 +20,6 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading;
-using System.Threading.Tasks;
 using NSubstitute;
 using Org.Apache.REEF.Common.Context;
 using Org.Apache.REEF.Common.Events;
@@ -29,7 +28,6 @@ using Org.Apache.REEF.Common.Runtime.Evaluator;
 using Org.Apache.REEF.Common.Runtime.Evaluator.Context;
 using Org.Apache.REEF.Common.Services;
 using Org.Apache.REEF.Common.Tasks;
-using Org.Apache.REEF.Common.Tasks.Events;
 using Org.Apache.REEF.Evaluator.Tests.TestUtils;
 using Org.Apache.REEF.Tang.Annotations;
 using Org.Apache.REEF.Tang.Implementations.Configuration;
@@ -184,7 +182,11 @@ namespace Org.Apache.REEF.Evaluator.Tests
 
                     Assert.True(contextRuntime.TaskRuntime.IsPresent());
                     Assert.True(contextRuntime.GetTaskStatus().IsPresent());
-                    Assert.Equal(contextRuntime.GetTaskStatus().Value.state, 
State.RUNNING);
+
+                    // wait for the task to start
+                    var testTask = contextRuntime.TaskRuntime.Value.Task as 
TestTask;
+                    testTask.StartEvent.Wait();
+                    Assert.Equal(State.RUNNING, 
contextRuntime.GetTaskStatus().Value.state);
 
                     var childContextConfiguration = 
GetSimpleContextConfiguration();
 
@@ -235,7 +237,11 @@ namespace Org.Apache.REEF.Evaluator.Tests
 
                     Assert.True(contextRuntime.TaskRuntime.IsPresent());
                     Assert.True(contextRuntime.GetTaskStatus().IsPresent());
-                    Assert.Equal(contextRuntime.GetTaskStatus().Value.state, 
State.RUNNING);
+
+                    // wait for the task to start
+                    var testTask = contextRuntime.TaskRuntime.Value.Task as 
TestTask;
+                    testTask.StartEvent.Wait();
+                    Assert.Equal(State.RUNNING, 
contextRuntime.GetTaskStatus().Value.state);
 
                     Assert.Throws<InvalidOperationException>(() => 
contextRuntime.StartTaskOnNewThread(taskConfig));
                 }

http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Evaluator.Tests/TaskRuntimeTests.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Evaluator.Tests/TaskRuntimeTests.cs 
b/lang/cs/Org.Apache.REEF.Evaluator.Tests/TaskRuntimeTests.cs
index 90a5d18..22a572d 100644
--- a/lang/cs/Org.Apache.REEF.Evaluator.Tests/TaskRuntimeTests.cs
+++ b/lang/cs/Org.Apache.REEF.Evaluator.Tests/TaskRuntimeTests.cs
@@ -26,7 +26,6 @@ using Org.Apache.REEF.Common.Runtime.Evaluator;
 using Org.Apache.REEF.Common.Runtime.Evaluator.Task;
 using Org.Apache.REEF.Common.Tasks;
 using Org.Apache.REEF.Common.Tasks.Events;
-using Org.Apache.REEF.Driver.Task;
 using Org.Apache.REEF.Tang.Annotations;
 using Org.Apache.REEF.Tang.Implementations.Tang;
 using Org.Apache.REEF.Tang.Interface;
@@ -122,8 +121,12 @@ namespace Org.Apache.REEF.Evaluator.Tests
 
             var taskThread = taskRuntime.StartTaskOnNewThread();
 
-            Assert.Equal(taskRuntime.GetStatusProto().state, State.RUNNING);
-            Assert.Equal(taskRuntime.GetTaskState(), TaskState.Running);
+            // wait for the task to start
+            var testTask = taskRuntime.Task as TestTask;
+            testTask.StartEvent.Wait();
+
+            Assert.Equal(State.RUNNING, taskRuntime.GetStatusProto().state);
+            Assert.Equal(TaskState.Running, taskRuntime.GetTaskState());
 
             injector.GetInstance<CountDownAction>().CountdownEvent.Signal();
 
@@ -412,6 +415,7 @@ namespace Org.Apache.REEF.Evaluator.Tests
             [Inject]
             private TestTask(IAction action)
             {
+                StartEvent = new CountdownEvent(1);
                 FinishCountdownEvent = new CountdownEvent(1);
                 DisposeCountdownEvent = new CountdownEvent(1);
                 _action = action;
@@ -419,6 +423,8 @@ namespace Org.Apache.REEF.Evaluator.Tests
 
             public bool SuspendInvoked { get; private set; }
 
+            public CountdownEvent StartEvent { get; private set; }
+
             public CountdownEvent FinishCountdownEvent { get; private set; }
 
             public CountdownEvent DisposeCountdownEvent { get; private set; }
@@ -430,6 +436,7 @@ namespace Org.Apache.REEF.Evaluator.Tests
 
             public byte[] Call(byte[] memento)
             {
+                StartEvent.Signal();
                 try
                 {
                     _action.Value();

http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Evaluator.Tests/TestUtils/TestTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Evaluator.Tests/TestUtils/TestTask.cs 
b/lang/cs/Org.Apache.REEF.Evaluator.Tests/TestUtils/TestTask.cs
index 9912b70..64c49ff 100644
--- a/lang/cs/Org.Apache.REEF.Evaluator.Tests/TestUtils/TestTask.cs
+++ b/lang/cs/Org.Apache.REEF.Evaluator.Tests/TestUtils/TestTask.cs
@@ -28,11 +28,14 @@ namespace Org.Apache.REEF.Evaluator.Tests.TestUtils
         [Inject]
         private TestTask()
         {
+            StartEvent = new CountdownEvent(1);
             CountDownEvent = new CountdownEvent(1);
             StopEvent = new CountdownEvent(1);
             DisposedEvent = new CountdownEvent(1);
         }
 
+        public CountdownEvent StartEvent { get; private set; }
+
         public CountdownEvent CountDownEvent { get; private set; }
 
         public CountdownEvent StopEvent { get; private set; }
@@ -46,6 +49,7 @@ namespace Org.Apache.REEF.Evaluator.Tests.TestUtils
 
         public byte[] Call(byte[] memento)
         {
+            StartEvent.Signal();
             CountDownEvent.Wait();
             return null;
         }

http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTask.cs 
b/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTask.cs
index 77ab4a5..89b4cd2 100644
--- a/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTask.cs
+++ b/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTask.cs
@@ -18,7 +18,6 @@
 using System;
 using System.Linq;
 using System.Net;
-using System.Threading;
 using Org.Apache.REEF.Common.Io;
 using Org.Apache.REEF.Common.Tasks;
 using Org.Apache.REEF.Common.Tasks.Events;
@@ -66,7 +65,6 @@ namespace Org.Apache.REEF.Examples.Tasks.HelloTask
                 Console.WriteLine("IP Address: {0}", 
_nameClient.Lookup("abc"));
             }
             PrintGuestList();
-            Thread.Sleep(5 * 1000);
             Console.WriteLine("Bye, CLR REEF!");
 
             return null;

http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestCloseTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestCloseTask.cs 
b/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestCloseTask.cs
index 2e97320..a4b28cc 100644
--- a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestCloseTask.cs
+++ b/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestCloseTask.cs
@@ -118,7 +118,7 @@ namespace Org.Apache.REEF.Tests.Functional.Bridge
             const string failedTaskIndication = 
"Java_org_apache_reef_javabridge_NativeInterop_clrSystemFailedTaskHandlerOnNext";
 
             string testFolder = DefaultRuntimeFolder + 
Guid.NewGuid().ToString("N").Substring(0, 4);
-            TestRun(DriverConfigurations(DisposeMessageFromDriver, 
GetTaskConfigurationForFailToCloseTask()), typeof(CloseTaskTestDriver), 1, 
"testStopTask", "local", testFolder);
+            TestRun(DriverConfigurations(DisposeMessageFromDriver, 
GetTaskConfigurationForFailToCloseTask()), typeof(CloseTaskTestDriver), 1, 
"testStopTaskWithException", "local", testFolder);
             var messages = new List<string>();
             messages.Add(successIndication);
             messages.Add(failedTaskIndication);
@@ -140,7 +140,7 @@ namespace Org.Apache.REEF.Tests.Functional.Bridge
             const string closeHandlerNoBound = "ExceptionCaught 
TaskCloseHandlerNotBoundException";
 
             string testFolder = DefaultRuntimeFolder + 
Guid.NewGuid().ToString("N").Substring(0, 4);
-            TestRun(DriverConfigurations(DisposeMessageFromDriver, 
GetTaskConfigurationForNoCloseHandlerTask()), typeof(CloseTaskTestDriver), 1, 
"testStopTask", "local", testFolder);
+            TestRun(DriverConfigurations(DisposeMessageFromDriver, 
GetTaskConfigurationForNoCloseHandlerTask()), typeof(CloseTaskTestDriver), 1, 
"testStopTaskWithNoCloseHandler", "local", testFolder);
             var messages = new List<string>();
             messages.Add(closeHandlerNoBound);
             ValidateMessageSuccessfullyLogged(messages, "Node-*", 
EvaluatorStdout, testFolder, 1);
@@ -154,7 +154,7 @@ namespace Org.Apache.REEF.Tests.Functional.Bridge
         public void TestStopTaskOnLocalRuntimeWithNullMessage()
         {
             string testFolder = DefaultRuntimeFolder + 
Guid.NewGuid().ToString("N").Substring(0, 4);
-            TestRun(DriverConfigurations(NoMessage, 
GetTaskConfigurationForCloseTask()), typeof(CloseTaskTestDriver), 1, 
"testStopTask", "local", testFolder);
+            TestRun(DriverConfigurations(NoMessage, 
GetTaskConfigurationForCloseTask()), typeof(CloseTaskTestDriver), 1, 
"testStopTaskWithNullMessage", "local", testFolder);
             ValidateSuccessForLocalRuntime(1, testFolder: testFolder);
             
ValidateMessageSuccessfullyLoggedForDriver(CompletedValidationMessage, 
testFolder, 1);
             var messages = new List<string>();

http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestFailedEvaluatorEventHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestFailedEvaluatorEventHandler.cs
 
b/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestFailedEvaluatorEventHandler.cs
index 8d75518..c148c8d 100644
--- 
a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestFailedEvaluatorEventHandler.cs
+++ 
b/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestFailedEvaluatorEventHandler.cs
@@ -55,7 +55,7 @@ namespace Org.Apache.REEF.Tests.Functional.Bridge
             CleanUp(testFolder);
         }
 
-        public IConfiguration DriverConfigurations()
+        private IConfiguration DriverConfigurations()
         {
             return DriverConfiguration.ConfigurationModule
                 .Set(DriverConfiguration.OnDriverStarted, 
GenericType<FailedEvaluatorDriver>.Class)
@@ -106,10 +106,10 @@ namespace Org.Apache.REEF.Tests.Functional.Bridge
             public void OnNext(IFailedEvaluator value)
             {
                 Logger.Log(Level.Error, FailedEvaluatorMessage);
-                Assert.True(value.FailedTask.IsPresent());
-                Assert.Equal(value.FailedTask.Value.Id, TaskId);
-                Assert.Equal(value.FailedContexts.Count, 1);
-                Assert.Equal(value.EvaluatorException.EvaluatorId, value.Id);
+                Assert.True(value.FailedTask.IsPresent(), "No failed task 
found");
+                Assert.Equal(TaskId, value.FailedTask.Value.Id);
+                Assert.Equal(1, value.FailedContexts.Count);
+                Assert.Equal(value.Id, value.EvaluatorException.EvaluatorId);
                 Logger.Log(Level.Error, 
string.Format(CultureInfo.CurrentCulture, "Failed task id:{0}, failed Evaluator 
id: {1}, Failed Exception msg: {2},", value.FailedTask.Value.Id, 
value.EvaluatorException.EvaluatorId, value.EvaluatorException.Message));
                 Logger.Log(Level.Error, RightFailedTaskMessage);
             }

http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestSuspendTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestSuspendTask.cs 
b/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestSuspendTask.cs
index 18725e3..cac342c 100644
--- a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestSuspendTask.cs
+++ b/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestSuspendTask.cs
@@ -61,7 +61,7 @@ namespace Org.Apache.REEF.Tests.Functional.Bridge
             CleanUp(testFolder);
         }
 
-        public IConfiguration DriverConfigurations()
+        private static IConfiguration DriverConfigurations()
         {
             var helloDriverConfiguration = 
DriverConfiguration.ConfigurationModule
                 .Set(DriverConfiguration.OnDriverStarted, 
GenericType<SuspendTaskHandlers>.Class)
@@ -84,11 +84,13 @@ namespace Org.Apache.REEF.Tests.Functional.Bridge
             IObserver<ISuspendedTask>
         {
             private readonly IEvaluatorRequestor _requestor;
+            private bool _firstTask;
 
             [Inject]
             private SuspendTaskHandlers(IEvaluatorRequestor evaluatorRequestor)
             {
                 _requestor = evaluatorRequestor;
+                _firstTask = true;
             }
 
             public void OnNext(IDriverStarted value)
@@ -120,16 +122,25 @@ namespace Org.Apache.REEF.Tests.Functional.Bridge
 
             public void OnNext(ISuspendedTask value)
             {
-                // Submit a second Task once the first Task has been 
successfully suspended
-                // on the same context as the first task.
-                Logger.Log(Level.Warning, SuspendValidationMessage);
-                value.ActiveContext.SubmitTask(GetTaskConfiguration());
+                if (_firstTask)
+                {
+                    // Submit a second Task once the first Task has been 
successfully suspended
+                    // on the same context as the first task.
+                    Logger.Log(Level.Warning, SuspendValidationMessage);
+                    value.ActiveContext.SubmitTask(GetTaskConfiguration());
+                }
+
+                // after this we'll get more RunningTask events which have to 
be ignored
+                _firstTask = false;
             }
 
             public void OnNext(IRunningTask value)
             {
-                // Suspend the first instance of the Task.
-                
value.Suspend(Encoding.UTF8.GetBytes(SuspendMessageFromDriver));
+                if (_firstTask)
+                {
+                    // Suspend the first instance of the Task.
+                    
value.Suspend(Encoding.UTF8.GetBytes(SuspendMessageFromDriver));
+                }
             }
 
             public void OnError(Exception error)

http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestUnhandledTaskException.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestUnhandledTaskException.cs 
b/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestUnhandledTaskException.cs
index 238a143..0f85d71 100644
--- 
a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestUnhandledTaskException.cs
+++ 
b/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestUnhandledTaskException.cs
@@ -49,11 +49,12 @@ namespace Org.Apache.REEF.Tests.Functional.Bridge
         [Fact]
         public void TestUnhandledTaskExceptionCrashesEvaluator()
         {
-            var testFolder = DefaultRuntimeFolder + 
Guid.NewGuid().ToString("N").Substring(0, 4);
+            var testFolder = DefaultRuntimeFolder + TestId;
             TestRun(GetDriverConfiguration(), 
typeof(TestUnhandledTaskException), 1, "testUnhandledTaskException", "local", 
testFolder);
             ValidateSuccessForLocalRuntime(0, numberOfEvaluatorsToFail: 2, 
testFolder: testFolder);
             
ValidateMessageSuccessfullyLoggedForDriver(SerializableSuccessMessage, 
testFolder, 1);
             
ValidateMessageSuccessfullyLoggedForDriver(NonSerializableSuccessMessage, 
testFolder, 1);
+            CleanUp(testFolder);
         }
 
         private static IConfiguration GetDriverConfiguration()

http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Tests/Functional/RuntimeName/RuntimeNameTask.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Tests/Functional/RuntimeName/RuntimeNameTask.cs 
b/lang/cs/Org.Apache.REEF.Tests/Functional/RuntimeName/RuntimeNameTask.cs
index 8718410..d0e38d0 100644
--- a/lang/cs/Org.Apache.REEF.Tests/Functional/RuntimeName/RuntimeNameTask.cs
+++ b/lang/cs/Org.Apache.REEF.Tests/Functional/RuntimeName/RuntimeNameTask.cs
@@ -37,7 +37,6 @@ namespace Org.Apache.REEF.Tests.Functional.Messaging
         public byte[] Call(byte[] memento)
         {
             Logger.Log(Level.Info, "Hello, CLR Task!");
-            Thread.Sleep(5 * 1000);
             return null;
         }
 

http://git-wip-us.apache.org/repos/asf/reef/blob/50075c24/lang/cs/Org.Apache.REEF.Tests/Functional/RuntimeName/RuntimeNameTest.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Tests/Functional/RuntimeName/RuntimeNameTest.cs 
b/lang/cs/Org.Apache.REEF.Tests/Functional/RuntimeName/RuntimeNameTest.cs
index 2d2975b..94a05e9 100644
--- a/lang/cs/Org.Apache.REEF.Tests/Functional/RuntimeName/RuntimeNameTest.cs
+++ b/lang/cs/Org.Apache.REEF.Tests/Functional/RuntimeName/RuntimeNameTest.cs
@@ -65,6 +65,7 @@ namespace Org.Apache.REEF.Tests.Functional.Driver
             string testFolder = DefaultRuntimeFolder + TestId;
             
TestRun(DriverConfigurationsWithEvaluatorRequest(GenericType<EvaluatorRequestingDriverSpecifyingRuntimeName>.Class),
 typeof(EvaluatorRequestingDriverSpecifyingRuntimeName), 1, 
"EvaluatorRequestingDriverSpecifyingRuntimeName", "local", testFolder);
             ValidateMessageSuccessfullyLoggedForDriver("Runtime Name: Local", 
testFolder, 1);
+            CleanUp(testFolder);
         }
 
         /// <summary>

Reply via email to