locked
how to change job priority of a queued job by c# RRS feed

  • Question

  • hi ,

    i need to change the priority of a queued job by using c# .

    i tried to simply give a new priority to a queued job, but i get an error that it is not possible to change the priority.

    however by the hpc gui, it is possible to change the priority by right click on a queued job and clicking the "modify" option.

    i think that there must be a way to achive that in c#.

    Ben

    Sunday, July 3, 2011 6:59 AM

Answers

  • Hi,

    You may want to try this:

    using (IScheduler scheduler = new Scheduler())
    {
                    scheduler.Connect("headnode");
                    ISchedulerJob job = scheduler.OpenJob(jobId);
                    job.Priority = JobPriority.AboveNormal;
                    job.Commit();
    }

    This should work for Hpc Server 2008 R2.

    • Marked as answer by Ben.Alterzon Thursday, July 21, 2011 10:54 AM
    Thursday, July 7, 2011 2:38 AM

All replies

  • Hi,

    You can't change the job priority without requeueing it, even with C# API. So the easiest way is to cancel the job, set priority, and requeue it through gui. Note that the job will be put to the end of the queue. Doing that through C# API will have the same result.

    Wednesday, July 6, 2011 10:03 AM
  • Hi,

    You may want to try this:

    using (IScheduler scheduler = new Scheduler())
    {
                    scheduler.Connect("headnode");
                    ISchedulerJob job = scheduler.OpenJob(jobId);
                    job.Priority = JobPriority.AboveNormal;
                    job.Commit();
    }

    This should work for Hpc Server 2008 R2.

    • Marked as answer by Ben.Alterzon Thursday, July 21, 2011 10:54 AM
    Thursday, July 7, 2011 2:38 AM
  • thanks a lot

    ben

    Thursday, July 21, 2011 10:54 AM