Partners High Performance Computing Cluster
Partners applications via Mac/PC
Clinical & research applications
DFCI bioinformatics computer
PHS Research Computing cluster
Bioinformatics news
Data Storage & Backup
Sharing files & collaboration
HIPAA, ePHI and research (internal)
RPDR
HPCGG
Biomedical Engineering Model Shop
Harvard's GForge Implementation
Institutional research distribution lists

 

pHPC account registration pHPC user guide pHPC services pHPC web protal


A quick example about how to submit batch jobs with a C# program from client to Windows cluster RCWINCLU



Intro: Please read "Access windows cluster rcwinclu" and How to submit a job in Windows cluster before proceed.



1> Please download the C# "SubmitJobs" source code and recompile it it with MS Visual Studio 2008. Copy the executable HelloSweep.exe to \\rcwinclu\$PARTNERSID\ (Note: $PARTNERSID refers to your own Parners ID.

  a> If you want to compile it in your own environment instead of in HPCWIN, You need to download MS HPC 2008 SDK and use the schedule API (import Microsoft.Hpc.Scheduler.dll ..etc).

  b> Change the "testy" in the example code to your own Partners ID.

  c> The example code construct a serial of sequence blast jobs. It assumes you have 9 input sequence file stored in your home directory. You can change mycommand to call your own executable program.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Hpc.Scheduler;
using Microsoft.Hpc.Scheduler.Properties;
using System.Threading;

namespace SubmitJobs
{
class Program
 {
  private static ManualResetEvent jobFinishEvt = new ManualResetEvent(false);

   static void Main(string[] args)
    {


    int i = 0;


    Scheduler scheduler = new Scheduler();

    scheduler.Connect("rcwinclu.partners.org");
    ISchedulerJob job = scheduler.CreateJob();
    job.MinimumNumberOfNodes = 1;
    job.MaximumNumberOfNodes = 1;
    job.Name = "loopblast";

    string mycommand="";
    mycommand=@"\\rcwinclu\sharedApp\ncbi_blast\bin\blastall" ;
    mycommand= mycommand + @"-p blastn -d \\rcwinclu\sharedApp\ncbi_data\db\nt -i ";
    mycommand= mycommand + @"\\rcwinclu\testy\inputseq_" + Convert.ToString(i);
    mycommand= mycommand+ " -o output_" + Convert.ToString(i) + ".blastoutput";

    for (i=0; i<9; i++){
    ISchedulerTask task = job.CreateTask();

    task.CommandLine = mycommand ;

    task.WorkDirectory = @"\\rcwinclu\testy\";

    job.AddTask(task);
    }

    job.OnJobState += new EventHandler(job_OnJobState);

    scheduler.SubmitJob(job, null, null);

    jobFinishEvt.WaitOne();


  }

 static void job_OnJobState(object sender, JobStateEventArg e)
        {
         Console.WriteLine("Job <{0}> has changed from state <{1}> to <{2}>",
                              e.JobId, e.PreviousState.ToString(), e.NewState.ToString());
         if (e.NewState.Equals(JobState.Finished))
         {
           Console.WriteLine("Job <{0}> has finished", e.JobId);
           jobFinishEvt.Set();
         }
        }
    }


}



2> Run the program. You can either run within VS2008 environment or run the executable from command line.

After you run the program, you will have screen output showing the job status.