locked
Job Priority Hpc RRS feed

  • Question

  • Hey,

    I need to change a job priority from my user interface written in c#

    if anyone can help.......

    Tuesday, April 5, 2011 10:43 AM

All replies

  • using System;
    
    using Microsoft.Hpc.Scheduler;
    using Microsoft.Hpc.Scheduler.Properties;
    
    namespace ChangeJobPriority
    {
     class Program
     {
      static void Main(string[] args)
      {
       const string ClusterHeadnode = "LUKASZTCLUSTER";
       const int JobIdToFind = 1091;
    
       using (IScheduler scheduler = new Scheduler())
       {
        scheduler.Connect(ClusterHeadnode);
    
        ISchedulerJob job = scheduler.OpenJob(JobIdToFind);
    
        job.Priority = JobPriority.Lowest;
    
        job.Commit();
       }
      }
     }
    }
    
    

    Thing to remember is, that only jobs in certain states can have their priority modified.

    Tuesday, April 5, 2011 5:24 PM
  • thank you for the answer,

    through the interface of the hpc(job manager), the user can modify the priority to jobs in queue.

    but when i try to do the same in my interface written in c#, i get an exception that i cannot change priority of job in queue.

    why is that?

    and in regards to my first question, i need to give the user the option to choose the priority from a list of possible priorities.

    how do i set the priority choosen to a specific job?

    the only thing i could think of is a method that look like this:(but i am sure that there is a better way)

    namespace ChangeJobPriority
    {
    class Program
    {
      static void Main(string[] args)
      {
       const string ClusterHeadnode = "LUKASZTCLUSTER";
       const int JobIdToFind = 1091;

       using (IScheduler scheduler = new Scheduler())
       {
        scheduler.Connect(ClusterHeadnode);

        ISchedulerJob job = scheduler.OpenJob(JobIdToFind);

        change.priority(job)

        //job.Priority = JobPriority.Lowest;

        job.Commit();
       }
      }

    function change.priority(ischedulerJob)

    {

    if (dropdownlist.selectedvalue = Lowest)

    {

    job.Priority = JobPriority.Lowest;

    }

    }
     }
    }

     

     

    Wednesday, April 6, 2011 8:31 AM