No connection could be made because the target machine actively refused it [::1]:5800
-
Friday, March 02, 2012 12:25 AM
Hi,
I'm running this code for test purposes "http://msdn.microsoft.com/en-us/library/cc853426%28v=vs.85%29.aspx"
I'm a mac user, so I'm running Win 7 Pro 32 bit with VS2010 and I installed the HPC scheduler sdk.So, I can run the Windows Azure emulator all that inside a Virtual machine (Vmware Fusion)
But I'm getting this error "No connection could be made because the target machine actively refused it [::1]:5800"this is the code I'm using
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Microsoft.Hpc.Scheduler;
using Microsoft.Hpc.Scheduler.Properties;
namespace ConsoleApplicationHPCScheduler
{
class Program
{
private static ManualResetEvent manualEvent = new ManualResetEvent(false);
static void Main(string[] args)
{
IScheduler scheduler = null;
ISchedulerJob job = null;
ISchedulerTask task = null;
try
{
scheduler = new Scheduler();
scheduler.Connect("localhost"); //here is where the error occur -->No connection could be made because the target machine actively refused it [::1]:5800
job = scheduler.CreateJob();
job.OnJobState += JobStateCallback;
job.OnTaskState += TaskStateCallback;
task = job.CreateTask();
task.CommandLine = @"echo *";
task.StartValue = 1;
task.EndValue = 5;
task.IncrementValue = 1;
job.AddTask(task);
scheduler.SubmitJob(job, @"WIN-GV9CQ7DLPRK\Victorino", null);
manualEvent.WaitOne();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
Console.ReadLine();
}
}
private static void JobStateCallback(object sender, IJobStateEventArg args)
{
Console.WriteLine("Job state: {0}\n", args.NewState);
if (JobState.Canceled == args.NewState ||
JobState.Failed == args.NewState ||
JobState.Finished == args.NewState)
{
manualEvent.Set();
}
}
private static void TaskStateCallback(object sender, ITaskStateEventArg args)
{
IScheduler scheduler = (IScheduler)sender;
ISchedulerTask task = null;
if (TaskState.Queued == args.NewState)
Console.WriteLine("State for task {0}: {1}\n",
args.TaskId.JobTaskId, args.NewState);
else
Console.WriteLine("State for instance {0} of task {1}: {2}\n",
args.TaskId.InstanceId, args.TaskId.JobTaskId, args.NewState);
try
{
if (TaskState.Finished == args.NewState)
{
task = scheduler.OpenJob(args.JobId).OpenTask(args.TaskId);
Console.WriteLine("Output: " + task.Output);
}
else if (TaskState.Failed == args.NewState)
{
task = scheduler.OpenJob(args.JobId).OpenTask(args.TaskId);
Console.WriteLine("Exit code: {0}\n{1}\n", task.ExitCode, task.Output);
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}
All Replies
-
Friday, March 02, 2012 2:01 AM
Hi Victor,
Thanks for your interest in HPC, the product does not support Azure emulator yet, but you are welcome to try it with a free Azure trial account.
Michael
-
Tuesday, March 06, 2012 7:54 PM
After you get the above sorted out: the error you are getting is telling you that the scheduler could not be reached (ie: no listener on the port).
The scheduler will not be running on win7 (and no emulator) so when you stand one up (in Azure or on-premises) make sure the string that is currently "localhost" contains the name of the server running the scheduler (wins, ip, etc).
To run the sample as-is, remote-desktop onto the headnode and run the sample there.
d