locked
Task Object Get Counters Object is Returning Null value RRS feed

  • Question



  • Task Object Get Counters Object is Returning Null value for the below code.

    We are executing the following code after Jobcompletion.We are able to get the other properties of the Task.

    j.GetCounters().TotalCpuTime.ToString()) returning Null Value.



    The same is working fine for Job.GetCounters().Totalcputime.



    Could you please confirm us is it bug? or any coding mistake from our side.

     

    foreach (var item in job.GetTaskList(null, null))

    {

    var j = (Microsoft.Hpc.Scheduler.SchedulerTask)item;

    ArrayList a = new ArrayList();

    Dictionary<string, string> x = new Dictionary<string, string>();

    x.Add("Job Id", jobid.Name);

    x.Add("Task Id", j.Name);

    x.Add("Time Taken", tim.ElapsedMilliseconds.ToString());

    x.Add("Job Execution Time", (j.EndTime - j.CreateTime).TotalMilliseconds.ToString());

    x.Add("Total CPU Time", j.GetCounters().TotalCpuTime.ToString());

    x.Add("Total User Time", j.GetCounters().TotalUserTime.ToString());

    x.Add("Total Kernel Time", j.GetCounters().TotalKernelTime.ToString());

    x.Add("Total Memory", j.GetCounters().TotalMemory.ToString());

    ReportService.Reports.WriteToReport("TaskDetail", x);

    }

    Monday, July 14, 2008 12:38 PM

Answers

  • I believe this bug was related to the one you posted about earlier where TotalCpuTime was not being calculated correctly; this appears to be fixed at this point.  Check it out in our next beta release and let me know if you still see a problem.

    Thanks for Beta-Testing!
    -Josh


    -Josh
    Monday, July 28, 2008 8:44 PM
    Moderator

All replies

  • Can you confirm that you called Refresh() on your job object after the job completed?  This call will update the locally cached oblject with information from the server, including these properties which might not be there if you have not called Refresh().
    -Josh
    Monday, July 14, 2008 5:25 PM
    Moderator
  • Hi Josh


    Thanks for the Reply

    After Calling Refresh Method on Job object also The same problem is there.By invoking OpenTask with the Task id as Parameter it is working. Is it Mandotary to call the OpenTask Method?



    var j = (Microsoft.Hpc.Scheduler.SchedulerTask)item;

    var t = jobid.OpenTask(j.TaskId);

    ---- Murthy------------

    Tuesday, July 15, 2008 4:28 AM
  • Did you try calling Refresh() on the task?  In general, I'd recommend calling Refresh() on any job or task which may have gone through some state changes.

    If that fixes your problem, please let me know; perhaps we can figure out a way to make this a bit more intuitive (or at least clearer in the SDK).

    Thanks,
    Josh


    -Josh
    Tuesday, July 15, 2008 7:31 AM
    Moderator
  • In my Program I am using the following sequense of steps.

    1) Creating Job

    2) Adding Multiple Tasks to Job

    3)Submitting the Job with Listener

    4)In Completion Event Invoking the Job.Refresh() to get the latest object

    5)Using GetTasklist from the above Refreshed JobObject.

    Here My doubt is  what is the need of callng Task.Refresh() as i am getting all the Task object from Completed Refresh Job object.

    Please correct me if i am wrong.


    foreach (var item in job.GetTaskList(null, null))

    {

    var j = (Microsoft.Hpc.Scheduler.SchedulerTask)item;


    }
    Tuesday, July 15, 2008 12:06 PM
  • I believe this bug was related to the one you posted about earlier where TotalCpuTime was not being calculated correctly; this appears to be fixed at this point.  Check it out in our next beta release and let me know if you still see a problem.

    Thanks for Beta-Testing!
    -Josh


    -Josh
    Monday, July 28, 2008 8:44 PM
    Moderator