Changeset 122


Ignore:
Timestamp:
Apr 3, 2017, 5:31:53 PM (7 years ago)
Author:
g7moreau
Message:
  • Change log format to version 2
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/oarutils/oar-parexec

    r121 r122  
    5555chomp $oar_version;
    5656
     57# global time
     58my $global_time_atstart    = time;
     59my $global_time_total      = 0;
     60my $global_time_cumulative = 0;
     61
    5762# re-run, keep trace of job already done
    5863my %state;
     
    6267      or die "error: can't read log file: $!";
    6368   while (<$log_h>) {
     69      # log version 1
    6470      $state{$1} = 'start' if m/^start\s+job\s+([^\s]+)\s/;
    6571      $state{$1} = 'end'   if m/^end\s+job\s+([^\s]+)\s/;
     72      # log version 2
     73      $state{$1} = 'start' if m/^start\s+subjob\s+([^\s]+)\s/;
     74      $state{$1} = 'end'   if m/^end\s+subjob\s+([^\s]+)\s/;
     75      ($global_time_total, $global_time_cumulative) = ($1, $2) if m/^global-time\s.*total\s+(\d+)\s+cumulative\s+(\d+)/;
    6676      }
    6777   $log_h->close();
     
    260270      $fh = unblock $fh;
    261271
    262       my $msg = sprintf "start job %${job_name_maxlen}s / %5i at %s oar job %i on node %s\n",
    263          $job_name, $job_pid, time, $ENV{OAR_JOB_ID}, $job_ressource;
     272      my $begin_at = time;
     273      #my $msg = sprintf "start job %${job_name_maxlen}s / %5i at %s oar job %i on node %s\n",
     274      my $msg = sprintf "start subjob %${job_name_maxlen}s pid %5i at %s oarjob %i onnode %s\n",
     275         $job_name, $job_pid, $begin_at, $ENV{OAR_JOB_ID}, $job_ressource;
    264276      $log_h->print($msg) if $logtrace;
    265277      print($msg) if $verbose;
     
    279291         name         => $job_name,
    280292         pidfile      => $job_pidfile,
     293         begin_at     => $begin_at,
    281294         };
    282295
     
    328341            #print "ERREUR0 $job_pid $job_retcode0\n" if $job_retcode0;
    329342
    330             my $msg = sprintf "end   job %${job_name_maxlen}s / %5i at %s oar job %i on node %s\n",
     343            # job time
     344            my $end_at = time;
     345            my $duration = $end_at - $scheduled{$job_pid}->{begin_at};
     346            my $global_time_cumulative += $duration;
     347
     348            #my $msg = sprintf "end   job %${job_name_maxlen}s / %5i at %s oar job %i on node %s\n",
     349            my $msg = sprintf "end     subjob %${job_name_maxlen}s pid %5i at %s oarjob %i onnode %s duration %i status %i\n",
    331350               $scheduled{$job_pid}->{name},
    332                $job_pid, time, $ENV{OAR_JOB_ID}, $scheduled{$job_pid}->{ressource};
     351               $job_pid, $end_at, $ENV{OAR_JOB_ID}, $scheduled{$job_pid}->{ressource},
     352               $duration, $job_retcode0;
    333353
    334354            # Job error
    335             $msg =~ s/^end\s+job/error:$job_retcode0 job/
     355            $msg =~ s/^end\s+subjob/error   subjob/
    336356               if $job_retcode0 > 0 and $job_retcode0 != 99;
    337357
    338358            # Job non finish, just suspend if received checkpoint signal
    339             $msg =~ s/^end\s+job/suspend job/
     359            $msg =~ s/^end\s+subjob/suspend subjob/
    340360               if $sig_transmit and $oar_checkpoint->count() > 0;
    341361
     
    364384$finished->wait;
    365385
     386# global time
     387$global_time_total += (time - $global_time_atstart);
     388$log_h->print("global-time total $global_time_total cumulative $global_time_cumulative\n") if $logtrace;
     389print("global-time total $global_time_total cumulative $global_time_cumulative\n") if $verbose;
     390
    366391# close log trace file
    367392$log_h->close() if $logtrace;
     
    696721 error   subjob  1 pid 101468 at 1450482556 oarjob 71725 onnode cl7n001 duration 657 status 0
    697722 suspend subjob  1 pid 101468 at 1450482556 oarjob 71725 onnode cl7n001 duration 657 status 0
     723 global-time total 555 cumulative 44444
    698724
    699725=item B<Version 1>
     
    702728 start job 1 / 101468 at 1450482228 oar job 71725 on node cl7n001
    703729 end   job 1 / 101468 at 1450482556 oar job 71725 on node cl7n001
     730 end   job 1 / 101468 at 1450482556 oar job 71725 on node cl7n001
     731 error:retcode job 1 / 101468 at 1450482556 oar job 71725 on node cl7n00
    704732
    705733=back
     734
    706735
    707736=head1 SEE ALSO
Note: See TracChangeset for help on using the changeset viewer.