Unanswered Get Job State in HPC

  • Tuesday, 8 May, 2012 3:00 PM
     
     

    What C# code do I need to use to get the job state out of HPC?  It looks like the ISchedulerjob.State property would work, but I'm not sure how to implement this in C#.  I should mention that I have a job running already in HPC.  I plan to run this code in parallel with the job that is currently running in HPC (i.e., MyCodeFile.exe & MyHPCJob will be on the task line).  

    I am going to launch them both at the same time and then have the MyCodeFile.exe update me on the progress.  I just need to be able to monitor the other application that is going to be running, and I will need to know when it is finished.  As I mentioned above, I did check this out http://msdn.microsoft.com/en-us/library/microsoft.hpc.scheduler.ischedulerjob.state(v=vs.85).aspx but I'm not sure how to code this into MyCodeFile.exe.

    Thank you for your assistance.


All Replies

  • Tuesday, 8 May, 2012 6:37 PM
     
     

    Hi,

    Page 17 - 28 of this document http://www.clustervision.com/Windows_HPC_Server_2008_Job_Scheduler.pdf should have the code you need.

    Michael

  • Tuesday, 8 May, 2012 8:37 PM
     
     

    This shows what to so if you are submitting a job from within the code file.  My job is being submitted from the GUI, and I would like to read the jobState from the C# code file I am running concurrently.  I am getting stuck on the line:  

    job.OnJobState += new EventHandler<JobStateEventArg>(job_OnJobState);

    I don't have the line: ISchedulerJob job = scheduler.CreateJob(); included in my code since I am not going to be creating a job, but rather just reading the status of an existing job.   Any ideas where to go from here?

  • Tuesday, 8 May, 2012 8:42 PM
     
     

    Yes.

    When you submit your job, you will get the job id, which is what you will use in your c# code to get the job object. just call scheduler.OpenJob(id);

    http://msdn.microsoft.com/en-us/library/microsoft.hpc.scheduler.ischeduler.openjob(v=vs.85).aspx

    Michael