Can I get the job state in HPC without having to use a callback event?
-
Monday, May 14, 2012 3:29 PM
Is there a way that I can ask the scheduler to give me the job state back using c# where I don't have to use a callback event?
I have a loop that is running in the main method. I would like to stop that loop when the task, or job is finished something like this:
if (jobFinished)
{ //set progress to 100% and end.
}
All Replies
-
Monday, May 14, 2012 6:29 PM
Hey,
you should be able to poll the state of the job
http://msdn.microsoft.com/en-us/library/microsoft.hpc.scheduler.ischedulerjob.state(v=vs.85)
If you don't find the state updating, you will probably also need to refresh it
http://msdn.microsoft.com/en-us/library/microsoft.hpc.scheduler.ischedulerjob.refresh(v=vs.85)
Michael
-
Monday, May 14, 2012 7:52 PM
Michael,
The first link you pasted was dead.
.... never mind...I found it.
- Edited by onemadscientist Monday, May 14, 2012 7:54 PM
-
Tuesday, May 15, 2012 2:42 PM
Ok, this is not working as I would want it to. If I use the JobState State {get} property which the link points to above I can only figure out how to use it in a CommandWriteLine.
I can't seem to use this like I want to which is:
if (job.State < 128)
{
//do stuff here
}
I have a loop that I am running, and I want to know when the "Finished" state occurs so that I can stop looping and end.
-
Tuesday, May 15, 2012 4:51 PM
if(job.State != JobState.Finished)
{
//do stuff here
}
all enums for jobstate are here
http://msdn.microsoft.com/en-us/library/microsoft.hpc.scheduler.properties.jobstate(v=VS.85).aspx
- Marked As Answer by onemadscientist Wednesday, May 16, 2012 1:12 PM
-
Wednesday, May 16, 2012 1:14 PM
Michael,
Thank you very much for your assistance. This was the last piece of the puzzle I needed to complete my script (for now). I really do appreciate your help!
P.S. Leave your boss's email address here - I want to call him and get you a raise! :>)
-
Wednesday, May 16, 2012 3:48 PM
Hi,
I'm glad that I can help, thank you for choosing Microsoft HPC!
Michael