locked
Job Objected is Returning Null after completion of Job also........ RRS feed

  • Question

  •   

    Hi

    We are creting Job and Adding task to the job as mentioned in the below code. 
    For getting total Job Execution Time  
      after completion of job also job.EndTime Retuning Null Value.

    Using the following code (Getting the Job object from Scheduler) is returning the Correct Value.

    scheduler.OpenJob(job.Id).EndTime Is Returning Correct Values.

    We had the following 2 doubts about Job Object.

    1)We would like to know what is issue in not able to get the EndTime using the Same Job Object  as mentioned in Yellow Color.

    2) Job object is Retuning the following Values from the GetCounters() Method.

     

    Job Execution Time

       CPU Time

           User Time

            Kernel Time

             Memory

    1667

    2491

    1932

    559

    174364


    We are running the above code from Intel Core Quad CPU Head Node only, no compute nodes.

    We are not able to compare JobExecutionTIme((job.EndTime -job.CreateTime).TotalMilliseconds.ToString() with CPU TIme.


    Please suggest us is there any help document available about this counters(CPU Time, Use Time, Kernel Time).

    )


    Scheduler
    scheduler = GetScheduler();

    ISchedulerJob job = GetJob(scheduler);

     

    var cmdparams = "Ping ...."

    ISchedulerTask task = job.CreateTask();

    task.CommandLine = cmdparams;

    job.AddTask(task);

    scheduler.SubmitJob(job, APPSettings.USER_ID,APPSettings.PASSWORD);

    jobFinishEvt.WaitOne();

    // After Completion of Job Get the job Properties.

    // job.EndTime Returing Null Value

    scheduler.OpenJob(job.Id).EndTime Is Returning Correct Values.


     

     

    private ISchedulerJob GetJob(Scheduler scheduler)

    {

    job = scheduler.CreateJob();

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

    job.Priority = JobPriority.Highest;

    job.Name = "Test Job" + " "+ jobid;

    job.Project = APPSettings.PROJECTNAME;

    job.IsExclusive = false;

    job.UserName = "ABC";

    job.RunUntilCanceled = false;

    return job;

    }

    private static Scheduler GetScheduler()

    {

    Scheduler scheduler = new Scheduler();

    scheduler.Connect(APPSettings.SERVERNAME);

    return scheduler;

    }

     

    private void job_OnJobState(object sender, JobStateEventArg e)

    {

    if (e.NewState.Equals(JobState.Finished))

    {

    MessageBox.Show("Job Completed" + e.JobId);

    jobFinishEvt.Set();

    }

    else if (e.NewState.Equals(JobState.Failed))

    {

    MessageBox.Show("Job Failed" + e.JobId);

    jobFinishEvt.Set();

    }

    else if (e.NewState.Equals(JobState.Running))

    {

    }

    }

    Monday, July 14, 2008 10:11 AM

Answers

  •   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:26 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:26 PM
    Moderator

  • Thanks for you Reply.
    Previously we didnt called this Refresh Method. After this method call job object is working as expected.

    Without calling some of the Properties like Total CpuTime,TotalMemory,TotalPendingTask properties are Updating Properly.But for some of the properties this local cache object is not updating. Is it mandotary to call Refresh Button.


    --- Murthy------

    Tuesday, July 15, 2008 4:23 AM