using Microsoft.Hpc.Scheduler;
using NUnit.Framework;
namespace TestHPC
{
[TestFixture]
internal class TestHpc
{ [TestCase("HEAD-NODE-SERVER", 9)]
public static void AllCoresPresent(string headNode, int expectedCores)
{
int totalCores = 0;
using (IScheduler scheduler = new Scheduler())
{ scheduler.Connect(headNode); ISchedulerCollection nodes = scheduler.GetNodeList(null, null); foreach (ISchedulerNode node in nodes)
{ totalCores += node.NumberOfCores;
}
}
Assert.AreEqual(expectedCores, totalCores);
}
}
}
I am using a Visual Studio 2010 solution that has the project with this test build against .NET 4.0. This is the only test in the solution.
If I use NUnit 2.6.0 GUI or console runner, the test hangs in the middle.
If I use ReSharper 7.1.1 Unit Test runner pointed at my local NUnit 2.6.0 and run the test from the project compiled against 2.6.0 nunit.framework.dll, the test passes quite quickly.
If I switch ReSharper to run tests with build-in NUnit 2.6.2 and compile against 2.6.2, the test fails with this error:
Microsoft.Hpc.Scheduler.Properties.SchedulerException : No connection could be made because the target machine actively refused it 127.0.0.1:6729
----> System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it
Server stack trace:
at Microsoft.Hpc.Scheduler.NodeManagement.NodeQuery.Reconnect()
at Microsoft.Hpc.Scheduler.NodeManagement.NodeQuery.HandleException(Exception e)
at Microsoft.Hpc.Scheduler.NodeManagement.NodeQuery.EnumerateGroupsForNode(String nodeName)
at Microsoft.Hpc.Scheduler.Store.NodePropertyHandler.Tags.GetPropFromQuery(QueryContextBase ctx, PropertyId pid, ref StoreProperty prop)
at Microsoft.Hpc.Scheduler.Store.QueryContextBase.GetPropFromQuery(PropertyId pid)
at Microsoft.Hpc.Scheduler.Store.QueryContextBase.ExecuteRowSetQuery(List`1 ids, PropertyId[] pids)
at Microsoft.Hpc.Scheduler.Store.SnapShotRowSet.GetData(Int32 firstRow, Int32 lastRow, ref Int32 rowCount)
at Microsoft.Hpc.Scheduler.Store.SchedulerStoreInternal.RowSet_GetData(ref ConnectionToken token, Int32 rowsetId, Int32 firstRow, Int32 lastRow)
at Microsoft.Hpc.Scheduler.Store.SchedulerStoreInternal.RowEnum_GetRows(ref ConnectionToken token, Int32 id, Int32 numberOfRows)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at Microsoft.Hpc.Scheduler.Store.StoreServer.HandleException(Exception e, Boolean asyncReconnect)
at Microsoft.Hpc.Scheduler.Store.StoreServer.RowEnum_GetRows(Int32 id, Int32 numberOfRows)
at Microsoft.Hpc.Scheduler.Store.LocalRowEnumerator.GetRows2(Int32 numberOfRows)
at Microsoft.Hpc.Scheduler.Store.RowEnumeratorEnumerator.MoveNext()
at Microsoft.Hpc.Scheduler.Scheduler.GetNodeList(IFilterCollection filter, ISortCollection sort)
at TestHPC.TestHpc.AllCoresPresent(String headNode, Int32 expectedCores) in TestHPC.cs: line 18
--SocketException
Server stack trace:
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ref ITransportHeaders responseHeaders, ref Stream responseStream)
at Microsoft.Hpc.ClientSink.ProcessMessage(IMessage message, ITransportHeaders requestHeaders, Stream requestStream, ref ITransportHeaders responseHeaders, ref Stream responseStream)
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(ref MessageData msgData, Int32 type)
at Microsoft.Hpc.Scheduler.NodeManagement.INodeQuery.EnumerateNodeGroups()
at Microsoft.Hpc.Scheduler.NodeManagement.NodeQuery.Reconnect()
If I use NUnit 2.6.2 GUI or console runner, the test hangs in the middle.
There are no firewalls blocking port 6729 on the HPC server. All I did was switch the version of NUnit.
There seems to be a difference in how ReSharper is launching NUnit from the way NUnit GUI and console runner work. If I did not have ReSharper, I would have no clue that my test could pass.
ReSharper's behavior is observed in TeamCity when I run the test using NUnit runner. Looks like JetBrains have some consistency across their products that work better for execution of NUnit tests than native tools.
I have a variety of other tests that work just fine after the switch, so the problem is constrained to Microsoft.Hpc.Scheduler tests (for now). I can provide more information if needed. Please help!
I have the following test:
using Microsoft. Hpc.Scheduler;
using NUnit.Framework;
namespace TestHPC
[TestCase( "HEAD-NODE- SERVER" , 9)] (string headNode, int expectedCores)
{
[TestFixture]
internal class TestHpc
{
public static void AllCoresPresent
{
int totalCores = 0;
using (IScheduler scheduler = new Scheduler())
scheduler. Connect( headNode) ;
ISchedulerCol lection nodes = scheduler. GetNodeList( null, null);
foreach (ISchedulerNode node in nodes)
totalCore s += node.NumberOfCores;
{
{
}
}
}
}
}
I am using a Visual Studio 2010 solution that has the project with this test build against .NET 4.0. This is the only test in the solution.
If I use NUnit 2.6.0 GUI or console runner, the test hangs in the middle.
If I use ReSharper 7.1.1 Unit Test runner pointed at my local NUnit 2.6.0 and run the test from the project compiled against 2.6.0 nunit.framework .dll, the test passes quite quickly.
If I switch ReSharper to run tests with build-in NUnit 2.6.2 and compile against 2.6.2, the test fails with this error:
Microsoft. Hpc.Scheduler. Properties. SchedulerExcept ion : No connection could be made because the target machine actively refused it 127.0.0.1:6729 Net.Sockets. SocketException : No connection could be made because the target machine actively refused it
----> System.
Server stack trace: Hpc.Scheduler. NodeManagement. NodeQuery. Reconnect( ) Hpc.Scheduler. NodeManagement. NodeQuery. HandleException (Exception e) Hpc.Scheduler. NodeManagement. NodeQuery. EnumerateGroups ForNode( String nodeName) Hpc.Scheduler. Store.NodePrope rtyHandler. Tags.GetPropFro mQuery( QueryContextBas e ctx, PropertyId pid, ref StoreProperty prop) Hpc.Scheduler. Store.QueryCont extBase. GetPropFromQuer y(PropertyId pid) Hpc.Scheduler. Store.QueryCont extBase. ExecuteRowSetQu ery(List` 1 ids, PropertyId[] pids) Hpc.Scheduler. Store.SnapShotR owSet.GetData( Int32 firstRow, Int32 lastRow, ref Int32 rowCount) Hpc.Scheduler. Store.Scheduler StoreInternal. RowSet_ GetData( ref ConnectionToken token, Int32 rowsetId, Int32 firstRow, Int32 lastRow) Hpc.Scheduler. Store.Scheduler StoreInternal. RowEnum_ GetRows( ref ConnectionToken token, Int32 id, Int32 numberOfRows) Runtime. Remoting. Messaging. StackBuilderSin k._PrivateProce ssMessage( IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) Runtime. Remoting. Messaging. StackBuilderSin k.SyncProcessMe ssage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
at Microsoft.
at Microsoft.
at Microsoft.
at Microsoft.
at Microsoft.
at Microsoft.
at Microsoft.
at Microsoft.
at Microsoft.
at System.
at System.
Exception rethrown at [0]: Hpc.Scheduler. Store.StoreServ er.HandleExcept ion(Exception e, Boolean asyncReconnect) Hpc.Scheduler. Store.StoreServ er.RowEnum_ GetRows( Int32 id, Int32 numberOfRows) Hpc.Scheduler. Store.LocalRowE numerator. GetRows2( Int32 numberOfRows) Hpc.Scheduler. Store.RowEnumer atorEnumerator. MoveNext( ) Hpc.Scheduler. Scheduler. GetNodeList( IFilterCollecti on filter, ISortCollection sort) TestHpc. AllCoresPresent (String headNode, Int32 expectedCores) in TestHPC.cs: line 18
at Microsoft.
at Microsoft.
at Microsoft.
at Microsoft.
at Microsoft.
at TestHPC.
--SocketException
Server stack trace: Net.Sockets. Socket. DoConnect( EndPoint endPointSnapshot, SocketAddress socketAddress) Net.Sockets. Socket. Connect( EndPoint remoteEP) Runtime. Remoting. Channels. RemoteConnectio n.CreateNewSock et(EndPoint ipEndPoint) Runtime. Remoting. Channels. RemoteConnectio n.CreateNewSock et() Runtime. Remoting. Channels. SocketCache. GetSocket( String machinePortAndSid, Boolean openNew) Runtime. Remoting. Channels. Tcp.TcpClientTr ansportSink. SendRequestWith Retry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream) Runtime. Remoting. Channels. Tcp.TcpClientTr ansportSink. ProcessMessage( IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ref ITransportHeaders responseHeaders, ref Stream responseStream) Hpc.ClientSink. ProcessMessage( IMessage message, ITransportHeaders requestHeaders, Stream requestStream, ref ITransportHeaders responseHeaders, ref Stream responseStream) Runtime. Remoting. Channels. BinaryClientFor matterSink. SyncProcessMess age(IMessage msg)
at System.
at System.
at System.
at System.
at System.
at System.
at System.
at Microsoft.
at System.
Exception rethrown at [0]: Runtime. Remoting. Proxies. RealProxy. HandleReturnMes sage(IMessage reqMsg, IMessage retMsg) Runtime. Remoting. Proxies. RealProxy. PrivateInvoke( ref MessageData msgData, Int32 type) Hpc.Scheduler. NodeManagement. INodeQuery. EnumerateNodeGr oups() Hpc.Scheduler. NodeManagement. NodeQuery. Reconnect( )
at System.
at System.
at Microsoft.
at Microsoft.
If I use NUnit 2.6.2 GUI or console runner, the test hangs in the middle.
There are no firewalls blocking port 6729 on the HPC server. All I did was switch the version of NUnit.
There seems to be a difference in how ReSharper is launching NUnit from the way NUnit GUI and console runner work. If I did not have ReSharper, I would have no clue that my test could pass.
ReSharper's behavior is observed in TeamCity when I run the test using NUnit runner. Looks like JetBrains have some consistency across their products that work better for execution of NUnit tests than native tools.
I have a variety of other tests that work just fine after the switch, so the problem is constrained to Microsoft. Hpc.Scheduler tests (for now). I can provide more information if needed. Please help!