Creating a Custom User Interface

Updated: June 6, 2006

Applies To: Windows Compute Cluster Server 2003

For most users, the Job Manager and the command line interface (CLI) provide all of the functionality needed to use the Job Scheduler. For some purposes however, users, administrators and developers will want to bypass these interfaces and communicate with the Job Scheduler directly, at the API level. This is performed using the Compute Cluster Pack API (CCPAPI).The CCPAPI is installed with the Compute Cluster Pack and includes the C# and COM API bindings necessary to communicate with the Job Scheduler and other CCP services.


Complete documentation of the CCPAPI can be found online at the MSDN Web site. For more information, see Microsoft Compute Cluster Pack (

The following table shows the five basic steps involved in creating and submitting a job through the CCPAPI and the CCPAPI method used for each.


Step CCPAPI Method

Connect to the cluster


Create a job


Create a task


Add the task to the job


Submit the job/task for execution




(Combines SubmitJob() with another method, AddJob()

The following examples show how these CCPAPI methods can be used to submit a simple job in three different contexts: a Perl script, a VBS script, and a C# program.


$objCluster = Win32::OLE->new("Microsoft.ComputeCluster.Cluster") || 
die "Can't create Cluster object\n";
print "Connected to head node $objCluster->{Name}\n";
$objJob = $objCluster->CreateJob();
$objTask = $objCluster->CreateTask();
$objTask->{CommandLine} = "mpiexec myapp.exe";
$objJob->{MinimumNumberOfProcessors} = 4;
$objTask->{MininumNumberOfProcessors} = 4;
$objJob->{MaximumNumberOfProcessors} = 4;
$objTask->{MaximumNumberOfProcessors} = 4;
$objTask->{Stdin} = "infile.txt";
$objTask->{Stdout} = "outfile.txt";
$objTask->{Stderr} = "errfile.txt";
$objCluster->QueueJob($objJob, "<domain>\\<userid>", "", 1, 0) || die "Failed to submit job:" . $objCluster->{ErrorMessage} . "\n";
print "Job " . $objJob->{Id} . " submitted\n";
exit 0;
$objCluster->QueueJob($objJob, "<domain>\\<userid>", "", 1, 0) || 
die "Failed to submit job:" . $objCluster->{ErrorMessage} . "\n";
print "Job " . $objJob->{Id} . " submitted\n";
exit 0;

Visual Basic Script

strClusterName = "localhost" 'Change to name of cluster if not run locally.
strCommandLine = "mpiexec myapp.exe"
strUsername = "" 'If empty string, script prompts for user name.
strPassword = "" 'If empty string, script prompts for password.
blnIsConsole = True 'True = cmd-line, False = GUI
intHandle = 0
Set objComputeCluster = CreateObject("Microsoft.ComputeCluster.Cluster")
WScript.Echo "Compute Cluster Name: " & objComputeCluster.Name
Set objJob = objComputeCluster.CreateJob
objJob.MinimumNumberOfProcessors = "4"
objJob.MaximumNumberOfProcessors = "4"
intJobID = objComputeCluster.AddJob((objJob))
WScript.Echo "Job ID: " & intJobID
Set objTask = objComputeCluster.CreateTask
objTask.MinimumNumberOfProcessors = "4"
objTask.MaximumNumberOfProcessors = "4"
objTask.CommandLine = strCommandLine
objTask.Name = "Task1"
objTask.Stdin = "infile.txt"
objTask.Stdout = "outfile.txt"
objTask.Stderr = "errfile.txt"
intTaskID = objComputeCluster.AddTask(objJob.ID, (objTask))
WScript.Echo "Task ID: " & objTask.ID
objComputeCluster.SubmitJob intJobID, strUsername, strPassword, _
 blnIsConsole, intHandle
WScript.Echo "Submitted Job " & intJobID

For more information about scripting jobs for Compute Cluster Server, see Compute Cluster Server - Jobs ( The Scripting Center Script Repository contains many scripts for cluster administration and job submission tasks.


To compile and run a C# program using CCPAPI, it is necessary to reference CcpApi.dll, which can be found in the Compute Cluster Pack SDK. For information and to download, see Microsoft Compute Cluster Pack SDK (

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ComputeCluster;

namespace SerialJobSub
    class my_Program
        static int Main(string[] args)
            Cluster cluster = new Cluster();


                IJob job = cluster.CreateJob();
                ITask task = new Task();
                job.MinimumNumberOfProcessors = 4;
                job.MaximumNumberOfProcessors = 4;
                task.MinimumNumberOfProcessors = 4;
                task.MaximumNumberOfProcessors = 4;
                task.CommandLine = @"mpiexec myapp.exe";
                task.Stdin = @"infile.txt"; 
                task.Stdout = @"outfile.txt";

                int jobId = cluster.AddJob(job);
                cluster.SubmitJob(jobId, @"mydomain\jsmith", null, true, 0);
                Console.WriteLine("Job " + jobId + " submitted successfully");
                return 0;
            catch (Exception ex)
                return 1;

Community Additions