[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Condor-users] getting the running time...



Thanks for the prompt replay Alain!.. that will help me out

Oliver

Oliver Hotz
Digital Supervisor / Artist
http://www.oliverhotz.com
ICQ: 6174819
AIM: oliverhotz


-----Original Message-----
From: condor-users-bounces@xxxxxxxxxxx
[mailto:condor-users-bounces@xxxxxxxxxxx] On Behalf Of Alain Roy
Sent: Friday, January 07, 2005 11:29 AM
To: condor-users@xxxxxxxxxxx
Subject: Re: [Condor-users] getting the running time...


>Computing running time of jobs, how do you do it ?..

Here's the answer from the condor_q source code:


     ad->LookupInteger( ATTR_JOB_STATUS, job_status);
     ad->LookupInteger( ATTR_SERVER_TIME, cur_time);
     ad->LookupInteger( ATTR_SHADOW_BIRTHDATE, shadow_bday );
     if ( current_run == false ) {
         ad->LookupFloat( ATTR_JOB_REMOTE_WALL_CLOCK, previous_runs );
     }
...
     /* Compute total wall time as follows:  previous_runs is not the
      * number of seconds accumulated on earlier runs.  cur_time is the
      * time from the point of view of the schedd, and shadow_bday is the
      * epoch time from the schedd's view when the shadow was started for
      * this job.  So, we figure out the time accumulated on this run by
      * computing the time elapsed between cur_time & shadow_bday.
      * NOTE: shadow_bday is set to zero when the job is RUNNING but the
      * shadow has not yet started due to JOB_START_DELAY parameter.  And
      * shadow_bday is undefined (stale value) if the job status is not
      * RUNNING.  So we only compute the time on this run if shadow_bday
      * is not zero and the job status is RUNNING.
      */
     float total_wall_time = previous_runs +
         (cur_time - shadow_bday)*(job_status == RUNNING && shadow_bday);

At some point in the past, I wrote some Perl code to do this. Here is the 
relevant segment:

sub get_remote_time
{
     my $classad = $_[0];
     my $status = $classad->{"JobStatus"};
     my $server_time = $classad->{"ServerTime"};
     my $shadow_birthdate = $classad->{"ShadowBday"};
     my $previous_runs = $classad->{"RemoteWallClockTime"};

     if ($server_time == 0) {
         return -1;
     }

     my $total_wall_time = $previous_runs;
     if ($status == 2 && $shadow_birthdate != 0) {
         $total_wall_time += ($server_time - $shadow_birthdate);
     }
     return $total_wall_time;
}


_______________________________________________
Condor-users mailing list
Condor-users@xxxxxxxxxxx
http://lists.cs.wisc.edu/mailman/listinfo/condor-users