Job Object is Not Retuning EndTime After Completion of Job 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







    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 = GetScheduler();

    ISchedulerJob job = GetJob(scheduler);


    var cmdparams = "Ping ...."

    ISchedulerTask task = job.CreateTask();

    task.CommandLine = cmdparams;


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


    // 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();


    return scheduler;



    private void job_OnJobState(object sender, JobStateEventArg e)


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


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



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


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



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





    Monday, July 14, 2008 9:25 AM


  • for the #1 issue, please call "job.Refresh()" before  getting job.EndTime. The job object need to be refreshed so that it can get its EndTime. 

    when you do scheduler.OpenJob(job.Id).EndTime, the job information is retrieved from the database directly. and the information in the DB is the updated one.

    • Marked as answer by PVASNMurthy Wednesday, July 23, 2008 6:57 AM
    Tuesday, July 22, 2008 9:54 PM